git: e83df5367d30 - main - if_ovpn: fill out sin_len/sin6_len
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 23 Jul 2025 14:23:56 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=e83df5367d30761803e09bd7fcf518638dfe43d2
commit e83df5367d30761803e09bd7fcf518638dfe43d2
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-07-22 12:41:20 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-07-23 13:35:48 +0000
if_ovpn: fill out sin_len/sin6_len
When we parse an nvlist sockaddr we should set the sockaddr_in(6)'s length
field. This isn't currently used by anything yet, but it's reasonable to expect
a sockaddr to contain its length.
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/net/if_ovpn.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c
index 7bdbc565f4ca..6755997fd1f0 100644
--- a/sys/net/if_ovpn.c
+++ b/sys/net/if_ovpn.c
@@ -341,6 +341,7 @@ ovpn_nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *sa)
size_t len;
const void *addr = nvlist_get_binary(nvl, "address", &len);
in->sin_family = af;
+ in->sin_len = sizeof(*in);
if (len != sizeof(in->sin_addr))
return (EINVAL);
@@ -355,6 +356,7 @@ ovpn_nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *sa)
size_t len;
const void *addr = nvlist_get_binary(nvl, "address", &len);
in6->sin6_family = af;
+ in6->sin6_len = sizeof(*in6);
if (len != sizeof(in6->sin6_addr))
return (EINVAL);