Skip to contentSkip to conversation

Regression caused by "Don't add route for invalid dst and gateway address combinations”

DISCUSSION Christian Hewitt 3 participants 5 messages Nov 22, 2023 – Dec 6, 2023

lore
Share & tools
lore
#0 lore raw

Commit 9eb1772d31b6 ("Don't add route for invalid dst and gateway address combinations”) causes a regression in WireGuard support through the connman-vpn agent. I presume the wg0 interface matches the definition of "unspecified destination address coupled with unspecified gateway” added.

This is my routing table with the WireGuard interface (wg0) active:

RPi5:~ # route
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.16.50.1     0.0.0.0         UG    0      0        0 eth0
1.1.1.1         *               255.255.255.255 UH    0      0        0 wg0
8.8.8.8         *               255.255.255.255 UH    0      0        0 wg0
10.127.0.0      *               255.255.255.0   U     0      0        0 wg0
65.109.130.17   172.16.50.1     255.255.255.255 UGH   0      0        0 eth0
167.299.200.14  172.16.50.1     255.255.255.255 UGH   0      0        0 eth0
172.16.50.0     *               255.255.255.0   U     0      0        0 eth0
172.16.50.1     *               255.255.255.255 UH    0      0        0 eth0

As wg0 does not have the default route “all-traffic" is not routed down the VPN tunnel as defined in the connman-vpn WireGuard configuration:

WireGuard.AllowedIPs = 0.0.0.0/0

This is the routing table after reverting 9eb1772d31n6:

RPi5:~ # route
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         *               0.0.0.0         U     0      0        0 wg0
1.1.1.1         *               255.255.255.255 UH    0      0        0 wg0
8.8.8.8         *               255.255.255.255 UH    0      0        0 wg0
10.127.0.0      *               255.255.255.0   U     0      0        0 wg0
65.109.130.17   172.16.50.1     255.255.255.255 UGH   0      0        0 eth0
167.299.200.14  172.16.50.1     255.255.255.255 UGH   0      0        0 eth0
172.16.50.0     *               255.255.255.0   U     0      0        0 eth0
172.16.50.1     *               255.255.255.255 UH    0      0        0 eth0

And “all-traffic” is routing through the tunnel again.

I don’t code so can’t figure out how to fix this myself. I’ll happily test any patches you share though, and can provide remote access to test devices if needed.

Christian

#1 lore raw

Someone with a bigger hammer should look into this.

I guess there is a difference between
* intentional default gw with all-zero network and netmask bits for VPN
* dhcp not responding on an interface and then adding a route with all-zero gateway and netmask values

2023. 11. 22. 15:53 keltezéssel, Christian Hewitt írta:

Quoted 39 lines

Commit 9eb1772d31b6 ("Don't add route for invalid dst and gateway address combinations”) causes a regression in WireGuard support through the connman-vpn agent. I presume the wg0 interface matches the definition of "unspecified destination address coupled with unspecified gateway” added.

This is my routing table with the WireGuard interface (wg0) active:

RPi5:~ # route
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.16.50.1     0.0.0.0         UG    0      0        0 eth0
1.1.1.1         *               255.255.255.255 UH    0      0        0 wg0
8.8.8.8         *               255.255.255.255 UH    0      0        0 wg0
10.127.0.0      *               255.255.255.0   U     0      0        0 wg0
65.109.130.17   172.16.50.1     255.255.255.255 UGH   0      0        0 eth0
167.299.200.14  172.16.50.1     255.255.255.255 UGH   0      0        0 eth0
172.16.50.0     *               255.255.255.0   U     0      0        0 eth0
172.16.50.1     *               255.255.255.255 UH    0      0        0 eth0

As wg0 does not have the default route “all-traffic" is not routed down the VPN tunnel as defined in the connman-vpn WireGuard configuration:

WireGuard.AllowedIPs = 0.0.0.0/0

This is the routing table after reverting 9eb1772d31n6:

RPi5:~ # route
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         *               0.0.0.0         U     0      0        0 wg0
1.1.1.1         *               255.255.255.255 UH    0      0        0 wg0
8.8.8.8         *               255.255.255.255 UH    0      0        0 wg0
10.127.0.0      *               255.255.255.0   U     0      0        0 wg0
65.109.130.17   172.16.50.1     255.255.255.255 UGH   0      0        0 eth0
167.299.200.14  172.16.50.1     255.255.255.255 UGH   0      0        0 eth0
172.16.50.0     *               255.255.255.0   U     0      0        0 eth0
172.16.50.1     *               255.255.255.255 UH    0      0        0 eth0

And “all-traffic” is routing through the tunnel again.

I don’t code so can’t figure out how to fix this myself. I’ll happily test any patches you share though, and can provide remote access to test devices if needed.

Christian

#2 lore raw
Quoted 13 lines · Böszörményi Zoltán

Someone with a bigger hammer should look into this.

I guess there is a difference between
* intentional default gw with all-zero network and netmask bits for VPN
* dhcp not responding on an interface and then adding a route with all-zero gateway and netmask values

2023. 11. 22. 15:53 keltezéssel, Christian Hewitt írta:

Quoted 6 lines

[…]

And “all-traffic” is routing through the tunnel again.

I don’t code so can’t figure out how to fix this myself. I’ll happily test any patches you share though, and can provide remote access to test devices if needed.

Zoltán and/or Christian,

Are either of you running this down or working on a patch to revert the prior one until a more comprehensive solution can be found?

Christian, based on your “don’t code” comment, I suspect you are not. :-)

I have some patches that should be flowing shortly that add low-priority default routes for non-default service network interfaces. Those may allow the infrastructure to better address this but could also confound and complicate this by introducing potentially additional VPN breakage since that’s not a use case I currently have a DUT configuration for.

Best,

Grant

Signature · 5 lines
Principal
Nuovations

[email protected]
http://www.nuovations.com/
#3 lore raw
Quoted 15 lines · Grant Erickson
Quoted 12 lines · Böszörményi Zoltán

Someone with a bigger hammer should look into this.

I guess there is a difference between
* intentional default gw with all-zero network and netmask bits for VPN
* dhcp not responding on an interface and then adding a route with all-zero gateway and netmask values

2023. 11. 22. 15:53 keltezéssel, Christian Hewitt írta:

Quoted 5 lines

[…]

And “all-traffic” is routing through the tunnel again.

Quoted 7 lines
Quoted 1 line
Quoted 1 line

I don’t code so can’t figure out how to fix this myself. I’ll happily test any patches you share though, and can provide remote access to test devices if needed.

Zoltán and/or Christian,

Are either of you running this down or working on a patch to revert the prior one until a more comprehensive solution can be found?

Christian, based on your “don’t code” comment, I suspect you are not. :-)

Correct. I’m a competent patch wrangler and scripter but I don’t do proper coding.

Quoted 1 line

I have some patches that should be flowing shortly that add low-priority default routes for non-default service network interfaces. Those may allow the infrastructure to better address this but could also confound and complicate this by introducing potentially additional VPN breakage since that’s not a use case I currently have a DUT configuration for.

I’m not subscribed to the mailing list but I keep an eye on patchwork and can test anything flagged to me (feel free to cc). WireGuard is pretty simple to test on most devices and I can provide access to a server if that will help move things forwards.

Christian

#4 lore raw
In reply to Grant Erickson

2023. 12. 05. 17:57 keltezéssel, Grant Erickson írta:

Quoted 10 lines · Böszörményi Zoltán
Quoted 9 lines

Someone with a bigger hammer should look into this.

I guess there is a difference between
* intentional default gw with all-zero network and netmask bits for VPN
* dhcp not responding on an interface and then adding a route with all-zero gateway and netmask values

2023. 11. 22. 15:53 keltezéssel, Christian Hewitt írta:

Quoted 2 lines

[…]

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

And “all-traffic” is routing through the tunnel again.

I don’t code so can’t figure out how to fix this myself. I’ll happily test any patches you share though, and can provide remote access to test devices if needed.

Zoltán and/or Christian,

Are either of you running this down or working on a patch to revert the prior one until a more comprehensive solution can be found?

I wasn't. I can send a revert, if you really need it.

Quoted 8 lines

Christian, based on your “don’t code” comment, I suspect you are not. :-)

I have some patches that should be flowing shortly that add low-priority default routes for non-default service network interfaces. Those may allow the infrastructure to better address this but could also confound and complicate this by introducing potentially additional VPN breakage since that’s not a use case I currently have a DUT configuration for.

Best,

Grant