diff mbox series

[v2] wireguard: Make IPv6 addrs available for automatic prefix assignment

Message ID 20201125174717.3712-1-dxld@darkboxed.org
State Changes Requested
Headers show
Series [v2] wireguard: Make IPv6 addrs available for automatic prefix assignment | expand

Commit Message

Daniel Gröber Nov. 25, 2020, 5:47 p.m. UTC
Currently when assigning IPv6 addresses with large prefixes to a wireguard
interface, like

    config interface 'wg'
            option proto 'wireguard'
            list addresses 'fd::/48'

and having, say, a LAN interface such as

    config interface 'lan'
            option proto 'static'
            option ip6assign '60'

as is default the interface does not automatically receive the wg
interface's prefix.

For this to happen the proto needs to use proto_add_ipv6_prefix to register
the fact that a prefix is available for assignment which is simple enough.

Note that the addresses configured here usually include a non-zero host
part but currently netifd handles this poorly when more than one interface
should receive a sub-prefix.

The required fix can be found in "[PATCH netifd] interface-ip: Normalise
prefix address using netmask before using it" (Message-Id:
<20201125173536.1175-1-dxld@darkboxed.org>)

Signed-off-by: Daniel Gröber <dxld@darkboxed.org>
---
 package/network/utils/wireguard-tools/files/wireguard.sh | 1 +
 1 file changed, 1 insertion(+)

Comments

Adrian Schmutzler Nov. 25, 2020, 6:28 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Daniel Gröber
> Sent: Mittwoch, 25. November 2020 18:47
> To: openwrt-devel@lists.openwrt.org
> Subject: [PATCH v2] wireguard: Make IPv6 addrs available for automatic
> prefix assignment
> 
> Currently when assigning IPv6 addresses with large prefixes to a wireguard
> interface, like
> 
>     config interface 'wg'
>             option proto 'wireguard'
>             list addresses 'fd::/48'
> 
> and having, say, a LAN interface such as
> 
>     config interface 'lan'
>             option proto 'static'
>             option ip6assign '60'
> 
> as is default the interface does not automatically receive the wg interface's
> prefix.
> 
> For this to happen the proto needs to use proto_add_ipv6_prefix to register
> the fact that a prefix is available for assignment which is simple enough.
> 
> Note that the addresses configured here usually include a non-zero host part
> but currently netifd handles this poorly when more than one interface
> should receive a sub-prefix.
> 
> The required fix can be found in "[PATCH netifd] interface-ip: Normalise
> prefix address using netmask before using it" (Message-Id:
> <20201125173536.1175-1-dxld@darkboxed.org>)

This should not land in the final commit message. To make sure of that, and have it in patchwork anyway, please add a line with only "---" after your Signed-off-by and then add anything like that after that line.

Apart from that, please also bump the PKG_RELEASE for wireguard-tools for any change of the content.

So, I fear this will need a v3. ;-)

Best

Adrian

> 
> Signed-off-by: Daniel Gröber <dxld@darkboxed.org>
> ---
>  package/network/utils/wireguard-tools/files/wireguard.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/network/utils/wireguard-tools/files/wireguard.sh
> b/package/network/utils/wireguard-tools/files/wireguard.sh
> index 63261aea71..a18d09eaed 100644
> --- a/package/network/utils/wireguard-tools/files/wireguard.sh
> +++ b/package/network/utils/wireguard-tools/files/wireguard.sh
> @@ -151,6 +151,7 @@ proto_wireguard_setup() {
>  		case "${address}" in
>  			*:*/*)
>  				proto_add_ipv6_address "${address%%/*}"
> "${address##*/}"
> +				proto_add_ipv6_prefix "${address}"
>  				;;
>  			*.*/*)
>  				proto_add_ipv4_address "${address%%/*}"
> "${address##*/}"
> --
> 2.20.1
> 
> v2: Remove netifd patch and submit it separately.
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Daniel Gröber Nov. 25, 2020, 6:43 p.m. UTC | #2
On Wed, Nov 25, 2020 at 07:28:25PM +0100, Adrian Schmutzler wrote:
> > Note that the addresses configured here usually include a non-zero host part
> > but currently netifd handles this poorly when more than one interface
> > should receive a sub-prefix.
> > 
> > The required fix can be found in "[PATCH netifd] interface-ip: Normalise
> > prefix address using netmask before using it" (Message-Id:
> > <20201125173536.1175-1-dxld@darkboxed.org>)
> 
> This should not land in the final commit message. To make sure of that, and have it in patchwork anyway, please add a line with only "---" after your Signed-off-by and then add anything like that after that line.

Are you mainly talking about the message-id bit or about the entire two
paragraphs about the netifd problem?

If the first one I would still like to at least have some kind of linkage
to the fix commit in the commit message here. I figured since this hasn't
been comitted yet the msgid is the next best thing.

> Apart from that, please also bump the PKG_RELEASE for wireguard-tools for any change of the content.

ACK.

--Daniel
Adrian Schmutzler Nov. 25, 2020, 7:01 p.m. UTC | #3
Hi,

> > This should not land in the final commit message. To make sure of that, and
> have it in patchwork anyway, please add a line with only "---" after your
> Signed-off-by and then add anything like that after that line.
> 
> Are you mainly talking about the message-id bit or about the entire two
> paragraphs about the netifd problem?
> 
> If the first one I would still like to at least have some kind of linkage to the fix
> commit in the commit message here. I figured since this hasn't been
> comitted yet the msgid is the next best thing.
> 

I'm talking about changing

"
[...]

Note that the addresses configured here usually include a non-zero host
part but currently netifd handles this poorly when more than one interface
should receive a sub-prefix.

The required fix can be found in "[PATCH netifd] interface-ip: Normalise
prefix address using netmask before using it" (Message-Id:
<20201125173536.1175-1-dxld@darkboxed.org>)

Signed-off-by: Daniel Gröber <dxld@darkboxed.org>
"

into

"
[...]

Note that the addresses configured here usually include a non-zero host
part but currently netifd handles this poorly when more than one interface
should receive a sub-prefix.

Signed-off-by: Daniel Gröber <dxld@darkboxed.org>

---

The required fix can be found in "[PATCH netifd] interface-ip: Normalise
prefix address using netmask before using it" (Message-Id:
<20201125173536.1175-1-dxld@darkboxed.org>)
"

Best

Adrian
diff mbox series

Patch

diff --git a/package/network/utils/wireguard-tools/files/wireguard.sh b/package/network/utils/wireguard-tools/files/wireguard.sh
index 63261aea71..a18d09eaed 100644
--- a/package/network/utils/wireguard-tools/files/wireguard.sh
+++ b/package/network/utils/wireguard-tools/files/wireguard.sh
@@ -151,6 +151,7 @@  proto_wireguard_setup() {
 		case "${address}" in
 			*:*/*)
 				proto_add_ipv6_address "${address%%/*}" "${address##*/}"
+				proto_add_ipv6_prefix "${address}"
 				;;
 			*.*/*)
 				proto_add_ipv4_address "${address%%/*}" "${address##*/}"