Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: set sysctl bc_forwarding properly in router_broadcast.sh

sysctl setting bc_forwarding for $rp2 is needed when ping_test_from h2,
otherwise the bc packets from $rp2 won't be forwarded. This patch is to
add this setting for $rp2.

Also, as ping_test_from does grep "$from" only, which could match some
unexpected output, some test case doesn't really work, like:

# ping_test_from $h2 198.51.200.255 198.51.200.2
PING 198.51.200.255 from 198.51.100.2 veth3: 56(84) bytes of data.
64 bytes from 198.51.100.1: icmp_seq=1 ttl=64 time=0.336 ms

When doing grep $form (198.51.200.2), the output could still match.
So change to grep "bytes from $from" instead.

Fixes: 40f98b9af943 ("selftests: add a selftest for directed broadcast forwarding")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Xin Long and committed by
David S. Miller
67c0aaa1 880c2d4b

+4 -1
+4 -1
tools/testing/selftests/net/forwarding/router_broadcast.sh
··· 145 145 { 146 146 sysctl_set net.ipv4.conf.all.bc_forwarding 0 147 147 sysctl_set net.ipv4.conf.$rp1.bc_forwarding 0 148 + sysctl_set net.ipv4.conf.$rp2.bc_forwarding 0 148 149 } 149 150 150 151 bc_forwarding_enable() 151 152 { 152 153 sysctl_set net.ipv4.conf.all.bc_forwarding 1 153 154 sysctl_set net.ipv4.conf.$rp1.bc_forwarding 1 155 + sysctl_set net.ipv4.conf.$rp2.bc_forwarding 1 154 156 } 155 157 156 158 bc_forwarding_restore() 157 159 { 160 + sysctl_restore net.ipv4.conf.$rp2.bc_forwarding 158 161 sysctl_restore net.ipv4.conf.$rp1.bc_forwarding 159 162 sysctl_restore net.ipv4.conf.all.bc_forwarding 160 163 } ··· 174 171 log_info "ping $dip, expected reply from $from" 175 172 ip vrf exec $(master_name_get $oif) \ 176 173 $PING -I $oif $dip -c 10 -i 0.1 -w $PING_TIMEOUT -b 2>&1 \ 177 - | grep $from &> /dev/null 174 + | grep "bytes from $from" > /dev/null 178 175 check_err_fail $fail $? 179 176 } 180 177