Development discussion of WireGuard
 help / color / mirror / Atom feed
* [PATCH] wireguard-tools: embeddable-wg-library: add named wg_endpoint union
@ 2021-10-10 21:19 mikma.wg
  2021-10-14  3:48 ` Eiji Tanioka
  2021-10-22 19:26 ` Jason A. Donenfeld
  0 siblings, 2 replies; 3+ messages in thread
From: mikma.wg @ 2021-10-10 21:19 UTC (permalink / raw)
  To: WireGuard mailing list

[-- Attachment #1: Type: text/plain, Size: 135 bytes --]

Hello,

It would be useful to have a named wg_endpoint type in the embeddable wg 
library. It's added by the attached patch.

/Mikael


[-- Attachment #2: 0001-embeddable-wg-library-add-named-wg_endpoint-union.patch --]
[-- Type: text/x-patch, Size: 1312 bytes --]

From 62b35cb221af7208399fced86660585080c688f5 Mon Sep 17 00:00:00 2001
From: Mikael Magnusson <mikma@users.sourceforge.net>
Date: Sat, 7 Nov 2020 13:32:56 +0100
Subject: [PATCH] embeddable-wg-library: add named wg_endpoint union

Define wg_endpoint as a named union to allow users of the emeddable
library to use the type in function arguments, variables etc.

Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
---
 contrib/embeddable-wg-library/wireguard.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/contrib/embeddable-wg-library/wireguard.h b/contrib/embeddable-wg-library/wireguard.h
index fbd8765..328fcb4 100644
--- a/contrib/embeddable-wg-library/wireguard.h
+++ b/contrib/embeddable-wg-library/wireguard.h
@@ -40,17 +40,19 @@ enum wg_peer_flags {
 	WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL = 1U << 4
 };
 
+typedef union wg_endpoint {
+	struct sockaddr addr;
+	struct sockaddr_in addr4;
+	struct sockaddr_in6 addr6;
+} wg_endpoint;
+
 typedef struct wg_peer {
 	enum wg_peer_flags flags;
 
 	wg_key public_key;
 	wg_key preshared_key;
 
-	union {
-		struct sockaddr addr;
-		struct sockaddr_in addr4;
-		struct sockaddr_in6 addr6;
-	} endpoint;
+	wg_endpoint endpoint;
 
 	struct timespec64 last_handshake_time;
 	uint64_t rx_bytes, tx_bytes;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wireguard-tools: embeddable-wg-library: add named wg_endpoint union
  2021-10-10 21:19 [PATCH] wireguard-tools: embeddable-wg-library: add named wg_endpoint union mikma.wg
@ 2021-10-14  3:48 ` Eiji Tanioka
  2021-10-22 19:26 ` Jason A. Donenfeld
  1 sibling, 0 replies; 3+ messages in thread
From: Eiji Tanioka @ 2021-10-14  3:48 UTC (permalink / raw)
  To: mikma.wg; +Cc: WireGuard mailing list

Hi,

Your patch is being sent in an undesirable way, so I think it will not
be reviewed.
In this page, contributing to wireguard-tools requires
`git-send-email`, so you should include the patch file in the body of
the email, rather than attaching it.
https://www.wireguard.com/repositories/

Here is an example how to use `git send-email`
https://git-scm.com/docs/git-send-email#_examples

Hope this help.

2021年10月11日(月) 6:24 <mikma.wg@lists.m7n.se>:
>
> Hello,
>
> It would be useful to have a named wg_endpoint type in the embeddable wg
> library. It's added by the attached patch.
>
> /Mikael
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wireguard-tools: embeddable-wg-library: add named wg_endpoint union
  2021-10-10 21:19 [PATCH] wireguard-tools: embeddable-wg-library: add named wg_endpoint union mikma.wg
  2021-10-14  3:48 ` Eiji Tanioka
@ 2021-10-22 19:26 ` Jason A. Donenfeld
  1 sibling, 0 replies; 3+ messages in thread
From: Jason A. Donenfeld @ 2021-10-22 19:26 UTC (permalink / raw)
  To: mikma.wg; +Cc: WireGuard mailing list

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-22 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-10 21:19 [PATCH] wireguard-tools: embeddable-wg-library: add named wg_endpoint union mikma.wg
2021-10-14  3:48 ` Eiji Tanioka
2021-10-22 19:26 ` Jason A. Donenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).