Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174244676
D28933.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28933.diff
View Options
diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c
--- a/sys/dev/if_wg/module/if_wg_session.c
+++ b/sys/dev/if_wg/module/if_wg_session.c
@@ -1882,7 +1882,16 @@
goto free;
}
e = wg_mbuf_endpoint_get(m);
- e->e_remote.r_sa = *srcsa;
+ switch (srcsa->sa_family) {
+ case AF_INET:
+ memcpy(&e->e_remote.r_sa, srcsa, sizeof(struct sockaddr_in));
+ break;
+ case AF_INET6:
+ memcpy(&e->e_remote.r_sa, srcsa, sizeof(struct sockaddr_in6));
+ break;
+ default:
+ memcpy(&e->e_remote.r_sa, srcsa, sizeof(struct sockaddr));
+ }
verify_endpoint(m);
if_inc_counter(sc->sc_ifp, IFCOUNTER_IPACKETS, 1);
diff --git a/sys/dev/if_wg/module/module.c b/sys/dev/if_wg/module/module.c
--- a/sys/dev/if_wg/module/module.c
+++ b/sys/dev/if_wg/module/module.c
@@ -392,7 +392,8 @@
return (NULL);
key = peer->p_remote.r_public;
nvlist_add_binary(nvl, "public-key", key, WG_KEY_SIZE);
- nvlist_add_binary(nvl, "endpoint", &peer->p_endpoint.e_remote, sizeof(struct sockaddr));
+ nvlist_add_binary(nvl, "endpoint", &peer->p_endpoint.e_remote,
+ peer->p_endpoint.e_remote.r_sa.sa_len);
i = count = 0;
CK_LIST_FOREACH(rt, &peer->p_routes, r_entry) {
count++;
@@ -587,13 +588,12 @@
}
if (nvlist_exists_binary(nvl, "endpoint")) {
endpoint = nvlist_get_binary(nvl, "endpoint", &size);
- if (size != sizeof(*endpoint)) {
+ if (size > sizeof(peer->p_endpoint.e_remote)) {
device_printf(dev, "%s bad length for endpoint %zu\n", __func__, size);
err = EBADMSG;
goto out;
}
- memcpy(&peer->p_endpoint.e_remote, endpoint,
- sizeof(peer->p_endpoint.e_remote));
+ memcpy(&peer->p_endpoint.e_remote, endpoint, size);
}
if (nvlist_exists_binary(nvl, "pre-shared-key")) {
const void *key;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 4:33 PM (14 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40090038
Default Alt Text
D28933.diff (1 KB)
Attached To
Mode
D28933: wireguard: allow to set IPv6 endpoint
Attached
Detach File
Event Timeline
Log In to Comment