All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] selftests: set sysctl bc_forwarding properly in router_broadcast.sh
@ 2019-06-02 11:09 Xin Long
  2019-06-03 22:15 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Xin Long @ 2019-06-02 11:09 UTC (permalink / raw)
  To: network dev; +Cc: davem, David Ahern

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>
---
 tools/testing/selftests/net/forwarding/router_broadcast.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/router_broadcast.sh b/tools/testing/selftests/net/forwarding/router_broadcast.sh
index 9a678ec..4eac0a0 100755
--- a/tools/testing/selftests/net/forwarding/router_broadcast.sh
+++ b/tools/testing/selftests/net/forwarding/router_broadcast.sh
@@ -145,16 +145,19 @@ bc_forwarding_disable()
 {
 	sysctl_set net.ipv4.conf.all.bc_forwarding 0
 	sysctl_set net.ipv4.conf.$rp1.bc_forwarding 0
+	sysctl_set net.ipv4.conf.$rp2.bc_forwarding 0
 }
 
 bc_forwarding_enable()
 {
 	sysctl_set net.ipv4.conf.all.bc_forwarding 1
 	sysctl_set net.ipv4.conf.$rp1.bc_forwarding 1
+	sysctl_set net.ipv4.conf.$rp2.bc_forwarding 1
 }
 
 bc_forwarding_restore()
 {
+	sysctl_restore net.ipv4.conf.$rp2.bc_forwarding
 	sysctl_restore net.ipv4.conf.$rp1.bc_forwarding
 	sysctl_restore net.ipv4.conf.all.bc_forwarding
 }
@@ -171,7 +174,7 @@ ping_test_from()
 	log_info "ping $dip, expected reply from $from"
 	ip vrf exec $(master_name_get $oif) \
 		$PING -I $oif $dip -c 10 -i 0.1 -w $PING_TIMEOUT -b 2>&1 \
-		| grep $from &> /dev/null
+		| grep "bytes from $from" > /dev/null
 	check_err_fail $fail $?
 }
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] selftests: set sysctl bc_forwarding properly in router_broadcast.sh
  2019-06-02 11:09 [PATCH net] selftests: set sysctl bc_forwarding properly in router_broadcast.sh Xin Long
@ 2019-06-03 22:15 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-06-03 22:15 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, dsahern

From: Xin Long <lucien.xin@gmail.com>
Date: Sun,  2 Jun 2019 19:09:55 +0800

> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-03 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-02 11:09 [PATCH net] selftests: set sysctl bc_forwarding properly in router_broadcast.sh Xin Long
2019-06-03 22:15 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.