Skip to contentSkip to conversation

selftests/wireguard: make sure rp_filter disabled on vethc

PATCH In review Hangbin Liu 2 participants 7 messages May 25, 2021 – Jun 1, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/wireguard: make sure rp_filter disabled on vethc

Some distros may enable strict rp_filter by default, which will previent vethc receive the packets with unrouteable reverse path address.

---
 tools/testing/selftests/wireguard/netns.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/wireguard/netns.sh +1 -0
index 7ed7cd95e58f..37b12f642254 100755
@@ -363,6 +363,7 @@ ip1 -6 rule add table main suppress_prefixlength 0
 ip1 -4 route add default dev wg0 table 51820
 ip1 -4 rule add not fwmark 51820 table 51820
 ip1 -4 rule add table main suppress_prefixlength 0
+n1 sysctl -w net.ipv4.conf.vethc.rp_filter=0
 # Flood the pings instead of sending just one, to trigger routing table reference counting bugs.
 n1 ping -W 1 -c 100 -f 192.168.99.7
 n1 ping -W 1 -c 100 -f abab::1111
Signature · 1 line
2.26.3
#1 lore raw

Hi Hangbin,

Thanks. I've queued this up in my tree and will send it out on the next wireguard push.

Jason

#2 lore raw
Quoted 5 lines · Jason A. Donenfeld

Hi Hangbin,

Thanks. I've queued this up in my tree and will send it out on the next wireguard push.

Hi Jason,

I have a question about the wg-quick(8)-style policy routing test.

ip1 -6 addr add fc00::9/96 dev vethc
ip1 -6 route add default via fc00::1
^^ Here why we add a
default route via none exist address?
ip2 -4 addr add 192.168.99.7/32 dev wg0
ip2 -6 addr add abab::1111/128 dev wg0

Thanks
Hangbin

#4 lore raw
Quoted 3 lines · Jason A. Donenfeld

Hi Hangbin,

fc00::1 lives inside of fc00::9/96.

Yes, I know fc00::1 belongs to fc00::9/96 subnet. I just don't understand why we need to add a default v6 route for vethc, while the default route address fc00::1 is not configured on any device.

This step looks useless for me.

Thanks
Hangbin

#5 lore raw
In reply to Hangbin Liu
Quoted 14 lines · Hangbin Liu

Some distros may enable strict rp_filter by default, which will previent vethc receive the packets with unrouteable reverse path address.

---
 tools/testing/selftests/wireguard/netns.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/wireguard/netns.sh +0 -0
index 7ed7cd95e58f..37b12f642254 100755

tools/testing/selftests/wireguard/netns.sh ip1 -6 rule add table main suppress_prefixlength 0 · line 366

Quoted 4 lines
tools/testing/selftests/wireguard/netns.sh +1 -0
@@ -363,6 +363,7 @@ ip1 -6 rule add table main suppress_prefixlength 0
 ip1 -4 route add default dev wg0 table 51820
 ip1 -4 rule add not fwmark 51820 table 51820
 ip1 -4 rule add table main suppress_prefixlength 0
+n1 sysctl -w net.ipv4.conf.vethc.rp_filter=0

The VM does not ship with sysctl, and you'll notice that other changes go through /proc directly. Since it's a trivial change, I'll rewrite your commit.

Jason

#6 lore raw
Quoted 5 lines · Jason A. Donenfeld
Quoted 1 line

+n1 sysctl -w net.ipv4.conf.vethc.rp_filter=0

The VM does not ship with sysctl, and you'll notice that other changes go through /proc directly. Since it's a trivial change, I'll rewrite your commit.

Sorry to make this trouble. I saw other selftests also using sysctl, so I didn't realize some VM may not have sysctl installed.

Thanks for your fix.

Hangbin