Skip to content

Commit

Permalink
Userspace: Add system test with UDP tunneling of UDP traffic.
Browse files Browse the repository at this point in the history
Previously a gap existed in the tunnel system tests where only ICMP and
TCP traffic was tested. However, the code paths using for UDP traffic is
different then either of those and should also be tested.

Some of the modified tests had previously checked for TCP with ncat but
didn't include an appropriate check for ncat support. That check was
added to these tests.

Signed-off-by: Mike Pattrick <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
mkp-rh authored and ovsrobot committed Feb 15, 2024
1 parent 54c91a0 commit f27cc84
Showing 1 changed file with 111 additions and 7 deletions.
118 changes: 111 additions & 7 deletions tests/system-traffic.at
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([datapath - ping over vxlan tunnel])
AT_SKIP_IF([test $HAVE_NC = no])
OVS_CHECK_VXLAN()

OVS_TRAFFIC_VSWITCHD_START()
Expand All @@ -318,6 +319,10 @@ NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Start ncat listeners.
OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])

dnl Okay, now check the overlay with different packet sizes
NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
Expand All @@ -329,15 +334,29 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Verify that ncat is ready.
OVS_WAIT_UNTIL([netstat -ln | grep :1234])
OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])

dnl Check large bidirectional TCP.
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
AT_CHECK([diff -q payload.bin data], [0])
AT_CHECK([diff -q payload.bin tcp_data], [0])

dnl Check UDP
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])

dnl The UDP listener will just listen forever if not terminated.
OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
AT_CHECK([kill $(cat nc2.pid)])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
AT_CHECK([diff -q payload.bin udp_data], [0])
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

Expand Down Expand Up @@ -389,6 +408,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([datapath - ping over vxlan6 tunnel])
AT_SKIP_IF([test $HAVE_NC = no])
OVS_CHECK_VXLAN_UDP6ZEROCSUM()

OVS_TRAFFIC_VSWITCHD_START()
Expand All @@ -412,6 +432,9 @@ ADD_NATIVE_TUNNEL6([vxlan], [at_vxlan1], [at_ns0], [fc00::100], [10.1.1.1/24],

OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::100])

OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])

dnl First, check the underlay
NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -W 2 fc00::100 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
Expand All @@ -428,14 +451,29 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Verify that ncat is ready.
OVS_WAIT_UNTIL([netstat -ln | grep :1234])
OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])

dnl Check large bidirectional TCP.
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
AT_CHECK([diff -q payload.bin data], [0])

dnl Check UDP
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])

dnl The UDP listener will just listen forever if not terminated.
OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
AT_CHECK([kill $(cat nc2.pid)])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
AT_CHECK([diff -q payload.bin udp_data], [0])
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

Expand Down Expand Up @@ -466,6 +504,10 @@ NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Start ncat listeners.
OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])

dnl Okay, now check the overlay with different packet sizes
NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
Expand All @@ -477,6 +519,29 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Verify that ncat is ready.
OVS_WAIT_UNTIL([netstat -ln | grep :1234])
OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])

dnl Check large bidirectional TCP.
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
AT_CHECK([diff -q payload.bin tcp_data], [0])

dnl Check UDP
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])

dnl The UDP listener will just listen forever if not terminated.
OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
AT_CHECK([kill $(cat nc2.pid)])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
AT_CHECK([diff -q payload.bin udp_data], [0])
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

Expand Down Expand Up @@ -672,6 +737,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([datapath - ping over geneve tunnel])
AT_SKIP_IF([test $HAVE_NC = no])
OVS_CHECK_GENEVE()

OVS_TRAFFIC_VSWITCHD_START()
Expand All @@ -698,6 +764,10 @@ NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Start ncat listeners.
OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])

dnl Okay, now check the overlay with different packet sizes
NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
Expand All @@ -709,15 +779,29 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Verify that ncat is ready.
OVS_WAIT_UNTIL([netstat -ln | grep :1234])
OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])

dnl Check large bidirectional TCP.
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
AT_CHECK([diff -q payload.bin data], [0])
AT_CHECK([diff -q payload.bin tcp_data], [0])

dnl Check UDP
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])

dnl The UDP listener will just listen forever if not terminated.
OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
AT_CHECK([kill $(cat nc2.pid)])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
AT_CHECK([diff -q payload.bin udp_data], [0])
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

Expand Down Expand Up @@ -827,6 +911,7 @@ OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([datapath - ping over geneve6 tunnel])
AT_SKIP_IF([test $HAVE_NC = no])
OVS_CHECK_GENEVE_UDP6ZEROCSUM()

OVS_TRAFFIC_VSWITCHD_START()
Expand Down Expand Up @@ -855,6 +940,10 @@ NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -W 2 fc00::100 | FORMAT_PING], [0]
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Start ncat listeners.
OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > tcp_data], [nc.pid])
NETNS_DAEMONIZE([at_ns0], [nc -l -u 10.1.1.1 4321 > udp_data], [nc2.pid])

dnl Okay, now check the overlay with different packet sizes
NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
Expand All @@ -866,14 +955,29 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -W 2 10.1.1.100 | FORMAT_PI
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

dnl Verify that ncat is ready.
OVS_WAIT_UNTIL([netstat -ln | grep :1234])
OVS_WAIT_UNTIL([NS_EXEC([at_ns0], [netstat -ln | grep :4321])])

dnl Check large bidirectional TCP.
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=60000 count=1 2> /dev/null])
OVS_DAEMONIZE([nc -l 10.1.1.100 1234 > data], [nc.pid])
NS_CHECK_EXEC([at_ns0], [nc $NC_EOF_OPT 10.1.1.100 1234 < payload.bin])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc.pid)])
AT_CHECK([diff -q payload.bin data], [0])
AT_CHECK([diff -q payload.bin tcp_data], [0])

dnl Check UDP
AT_CHECK([dd if=/dev/urandom of=payload.bin bs=600 count=1 2> /dev/null])
AT_CHECK([nc $NC_EOF_OPT -u 10.1.1.1 4321 < payload.bin])

dnl The UDP listener will just listen forever if not terminated.
OVS_WAIT_UNTIL([kill -0 $(cat nc2.pid)])
AT_CHECK([kill $(cat nc2.pid)])

dnl Wait until transfer completes before checking.
OVS_WAIT_WHILE([kill -0 $(cat nc2.pid)])
AT_CHECK([diff -q payload.bin udp_data], [0])
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP

Expand Down

0 comments on commit f27cc84

Please sign in to comment.