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
  0 siblings, 1 reply; 2+ 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] 2+ 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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2021-10-14  3:48 UTC | newest]

Thread overview: 2+ 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

Development discussion of WireGuard

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ https://inbox.vuxu.org/wireguard \
		wireguard@lists.zx2c4.com
	public-inbox-index wireguard

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.wireguard


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git