dco-freebsd: pass address scope to the kernel
PATCH 1/2 dco-freebsd: pass address scope to the kernel
From: Kristof Provost <[email protected]...>
To support link-local (IPv6) addresses we must pass the scope to the kernel as well. We should also extract it from the kernel notification for float events.
--- src/openvpn/dco_freebsd.c | 6 ++++++ 1 file changed, 6 insertions(+)
src/openvpn/dco_freebsd.c +6 -0
@@ -62,6 +62,7 @@ sockaddr_to_nvlist(const struct sockaddr *sa)const struct sockaddr_in6 *in6 = (const struct sockaddr_in6 *)sa;nvlist_add_binary (nvl,"address" , &in6->sin6_addr,sizeof (in6->sin6_addr));nvlist_add_number (nvl,"port" , in6->sin6_port); +nvlist_add_number (nvl,"scopeid" , in6->sin6_scope_id);break ; }
@@ -118,6 +119,11 @@ nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss)assert (len ==sizeof (in6->sin6_addr));memcpy (&in6->sin6_addr, data,sizeof (in6->sin6_addr)); in6->sin6_port =nvlist_get_number (nvl,"port" ); + +if (nvlist_exists_number (nvl,"scopeid" )) + { + in6->sin6_scope_id =nvlist_get_number (nvl,"scopeid" ); + }break ; }
Signature · 1 line
2.50.1
This requires kernel side support: [https://reviews.freebsd.org/D51596](https://reviews.freebsd.org/D51596)
—
Kristof
Quoted 36 lines · Kristof Provost
From: Kristof Provost <[email protected]...>
To support link-local (IPv6) addresses we must pass the scope to the kernel as well. We should also extract it from the kernel notification for float events.
Signed-off-by Kristof Provost <[email protected]...>--- src/openvpn/dco_freebsd.c | 6 ++++++ 1 file changed, 6 insertions(+)src/openvpn/dco_freebsd.c +6
-0@@ -62,6 +62,7 @@ sockaddr_to_nvlist(const struct sockaddr *sa)const struct sockaddr_in6 *in6 = (const struct sockaddr_in6 *)sa;nvlist_add_binary (nvl,"address" , &in6->sin6_addr,sizeof (in6->sin6_addr));nvlist_add_number (nvl,"port" , in6->sin6_port); +nvlist_add_number (nvl,"scopeid" , in6->sin6_scope_id);break ; }@@ -118,6 +119,11 @@ nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss)assert (len ==sizeof (in6->sin6_addr));memcpy (&in6->sin6_addr, data,sizeof (in6->sin6_addr)); in6->sin6_port =nvlist_get_number (nvl,"port" ); + +if (nvlist_exists_number (nvl,"scopeid" )) + { + in6->sin6_scope_id =nvlist_get_number (nvl,"scopeid" ); + }break ; }Signature · 1 line
2.50.1
Hi,
Quoted 1 line · Kristof Provost via Openvpn-devel
This requires kernel side support: [https://reviews.freebsd.org/D51596](https://reviews.freebsd.org/D51596)
I did not yet test it, but I assume that including scope-id in the message to an older kernel will not break anything for non-LLA peers?
(For LLA%scope peers, it will not work today, and won't work without kernel-side support - this much is clear ;-) ).
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Quoted 6 lines · Gert Doering
Quoted 1 line · Kristof Provost via Openvpn-devel
This requires kernel side support: [https://reviews.freebsd.org/D51596](https://reviews.freebsd.org/D51596)
I did not yet test it, but I assume that including scope-id in the message to an older kernel will not break anything for non-LLA peers?
Correct. That’s why we’re using nvlists in the ioctl path. We can add fields without confusing either kernel or userspace. They’ll just be ignored.
—
Kristof
I have tested that this does not break on kernels that do not have scope support (as discussed on the list). Good :-) - float notifications also still work fine (unsurprisingly).
Need to setup a testbed with client and server on the same LAN, and then test DCO with link-local addresses, scope, and floating...
Your patch has been applied to the master branch.
commit b5e0032bf09afa928d9728051599a5e738ff4d10
Author: Kristof Provost Date: Tue Jul 29 11:38:57 2025 +0200
dco-freebsd: pass address scope to the kernel
Signed-off-by: Kristof Provost <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32401.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering