[ovs-dev] [PATCH] system-traffic: Use NC_EOF_OPT in truncate tests.

Guru Shetty guru at ovn.org
Mon Jul 11 18:28:55 UTC 2016


On 11 July 2016 at 10:29, Joe Stringer <joe at ovn.org> wrote:

> NC_EOF_OPT should always be passed to netcat in system-traffic tests
> when invoking netcat to send a single packet that does not expect a
> response. While on typical fedora/RH based distributions the default
> behaviour is to send the packet then return, there are multiple other
> implementations of netcat that do not do this (for example, those used
> by Debian and Ubuntu by default). For these alternative implementations,
> we provide $NC_EOF_OPT to ensure that netcat simply sends the packet
> then returns immediately.
>
> Signed-off-by: Joe Stringer <joe at ovn.org>
>

I did notice the "hang" without this patch. But with this patch, those
tests fail now with:
+nc: invalid option -- 'q'
+Try `nc --help' for more information.

My nc --version says:

nc --version
netcat (The GNU Netcat) 0.7.1
Copyright (C) 2002 - 2003  Giovanni Giacobbi

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program under the terms of
the GNU General Public License.
For more information about these matters, see the file named COPYING.

Original idea and design by Avian Research <hobbit at avian.org>,
Written by Giovanni Giacobbi <giovanni at giacobbi.net>.


> ---
>  tests/system-traffic.at | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tests/system-traffic.at b/tests/system-traffic.at
> index 252ed20472f6..d3395d0423d8 100644
> --- a/tests/system-traffic.at
> +++ b/tests/system-traffic.at
> @@ -290,7 +290,7 @@ AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
>  dnl use this file as payload file for ncat
>  AT_CHECK([dd if=/dev/urandom of=payload200.bin bs=200 count=1 2>
> /dev/null])
>  on_exit 'rm -f payload200.bin'
> -NS_CHECK_EXEC([at_ns0], [nc -u 10.1.1.2 1234 < payload200.bin])
> +NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 <
> payload200.bin])
>
>  dnl packet with truncated size
>  AT_CHECK([ovs-appctl revalidator/purge], [0])
> @@ -312,7 +312,7 @@ in_port=1 dl_dst=e6:66:c1:22:22:22
> actions=output(port=2,max_len=100),output:4,o
>  ])
>  AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
>
> -NS_CHECK_EXEC([at_ns0], [nc -u 10.1.1.2 1234 < payload200.bin])
> +NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 <
> payload200.bin])
>
>  dnl 100 + 100 + 242 + min(65535,242) = 684
>  AT_CHECK([ovs-appctl revalidator/purge], [0])
> @@ -346,7 +346,7 @@ This flow is handled by the userspace slow path
> because it:
>  dnl SLOW_ACTION test2: check actual packet truncate
>  AT_CHECK([ovs-ofctl del-flows br0])
>  AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
> -NS_CHECK_EXEC([at_ns0], [nc -u 10.1.1.2 1234 < payload200.bin])
> +NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 1234 <
> payload200.bin])
>
>  dnl 100 + 100 + 242 + min(65535,242) = 684
>  AT_CHECK([ovs-appctl revalidator/purge], [0])
> @@ -428,7 +428,7 @@ priority=1,actions=drop
>  AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt])
>
>  dnl check tunnel push path, from at_ns1 to at_ns0
> -NS_CHECK_EXEC([at_ns1], [nc -u 10.1.1.1 1234 < payload200.bin])
> +NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 <
> payload200.bin])
>  AT_CHECK([ovs-appctl revalidator/purge], [0])
>
>  dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B
> @@ -441,7 +441,7 @@ n_bytes=138
>  ])
>
>  dnl check tunnel pop path, from at_ns0 to at_ns1
> -NS_CHECK_EXEC([at_ns0], [nc -u 10.1.1.2 5678 < payload200.bin])
> +NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 5678 <
> payload200.bin])
>  dnl After truncation = 100 byte at loopback device p2(4)
>  AT_CHECK([ovs-appctl revalidator/purge], [0])
>  AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | awk
> --field-separator=', '  '{print $5}'], [0], [dnl
> @@ -474,7 +474,7 @@ AT_CHECK([ovs-ofctl del-flows br-underlay])
>  AT_CHECK([ovs-ofctl add-flows br-underlay flows-underlay.txt])
>
>  dnl check tunnel push path, from at_ns1 to at_ns0
> -NS_CHECK_EXEC([at_ns1], [nc -u 10.1.1.1 1234 < payload200.bin])
> +NS_CHECK_EXEC([at_ns1], [nc $NC_EOF_OPT -u 10.1.1.1 1234 <
> payload200.bin])
>  AT_CHECK([ovs-appctl revalidator/purge], [0])
>
>  dnl Before truncation = ETH(14) + IP(20) + UDP(8) + 200 = 242B
> @@ -487,7 +487,7 @@ n_bytes=138
>  ])
>
>  dnl check tunnel pop path, from at_ns0 to at_ns1
> -NS_CHECK_EXEC([at_ns0], [nc -u 10.1.1.2 5678 < payload200.bin])
> +NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT -u 10.1.1.2 5678 <
> payload200.bin])
>  dnl After truncation = 100 byte at loopback device p2(4)
>  AT_CHECK([ovs-appctl revalidator/purge], [0])
>  AT_CHECK([ovs-ofctl dump-flows br0 | grep "in_port=4" | awk
> --field-separator=', '  '{print $5}'], [0], [dnl
> --
> 2.9.0
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list