kernel-5.4: backport latest patches for wireguard
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 080-wireguard-0128-wireguard-selftests-make-sure-rp_filter-is-disabled-.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Fri, 4 Jun 2021 17:17:31 +0200
4 Subject: [PATCH] wireguard: selftests: make sure rp_filter is disabled on
5 vethc
6
7 commit f8873d11d4121aad35024f9379e431e0c83abead upstream.
8
9 Some distros may enable strict rp_filter by default, which will prevent
10 vethc from receiving the packets with an unrouteable reverse path address.
11
12 Reported-by: Hangbin Liu <liuhangbin@gmail.com>
13 Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
14 Cc: stable@vger.kernel.org
15 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
17 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
18 ---
19 tools/testing/selftests/wireguard/netns.sh | 1 +
20 1 file changed, 1 insertion(+)
21
22 --- a/tools/testing/selftests/wireguard/netns.sh
23 +++ b/tools/testing/selftests/wireguard/netns.sh
24 @@ -363,6 +363,7 @@ ip1 -6 rule add table main suppress_pref
25 ip1 -4 route add default dev wg0 table 51820
26 ip1 -4 rule add not fwmark 51820 table 51820
27 ip1 -4 rule add table main suppress_prefixlength 0
28 +n1 bash -c 'printf 0 > /proc/sys/net/ipv4/conf/vethc/rp_filter'
29 # Flood the pings instead of sending just one, to trigger routing table reference counting bugs.
30 n1 ping -W 1 -c 100 -f 192.168.99.7
31 n1 ping -W 1 -c 100 -f abab::1111