@@ -8920,21 +8920,29 @@ dnl The flow will encap a nsh header to the TCP syn packet
8920
8920
dnl eth/ip/tcp --> OVS --> eth/nsh/eth/ip/tcp
8921
8921
AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,in_port=ovs-p0,ip,actions=encap(nsh(md_type=1)),set_field:0x1234->nsh_spi,set_field:0x11223344->nsh_c1,encap(ethernet),set_field:f2:ff:00:00:00:02->dl_dst,set_field:f2:ff:00:00:00:01->dl_src,ovs-p1"])
8922
8922
8923
- NETNS_DAEMONIZE([at_ns1], [tcpdump -l -n -xx -U -i p1 > p1.pcap], [tcpdump.pid])
8924
- sleep 1
8923
+ NETNS_DAEMONIZE([at_ns1],
8924
+ [tcpdump -l -n -xx -U -i p1 -w p1.pcap 2>tcpdump_err], [tcpdump.pid])
8925
+ OVS_WAIT_UNTIL([grep "listening" tcpdump_err])
8925
8926
8926
- dnl The hex dump is a TCP syn packet. pkt=eth/ip/tcp
8927
- dnl The packet is sent from p0(at_ns0) interface directed to
8928
- dnl p1(at_ns1) interface
8929
- NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
8927
+ m4_define([TCP_SYN_PKT], [m4_join([,],
8928
+ [eth_src=f2:00:00:00:00:01,eth_dst=f2:00:00:00:00:02,eth_type=0x0800],
8929
+ [nw_src=192.168.0.10,nw_dst=10.0.0.10],
8930
+ [nw_proto=6,nw_ttl=64,nw_frag=no],
8931
+ [tcp_src=1024,tcp_dst=2048,tcp_flags=syn])])
8930
8932
8931
- dnl Check the expected nsh encapsulated packet on the egress interface
8932
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *0fc6" 2>&1 1>/dev/null])
8933
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0010: *0103 *0012 *34ff *1122 *3344 *0000 *0000 *0000" 2>&1 1>/dev/null])
8934
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0020: *0000 *0000 *0000 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null])
8935
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null])
8936
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null])
8937
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null])
8933
+ dnl Send the TCP SYN packet from p0(at_ns0) interface directed to
8934
+ dnl p1(at_ns1) interface.
8935
+ NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 \
8936
+ $(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT')], [0], [ignore])
8937
+
8938
+ m4_define([NSH_HEADER], [m4_join([,],
8939
+ [eth_src=f2:ff:00:00:00:01,eth_dst=f2:ff:00:00:00:02,eth_type=0x894f],
8940
+ [nsh_ttl=63,nsh_np=3,nsh_spi=0x1234,nsh_si=255],
8941
+ [nsh_mdtype=1,nsh_c1=0x11223344])])
8942
+
8943
+ OVS_WAIT_UNTIL([ovs-pcap p1.pcap | grep -q "m4_join([], [^],
8944
+ $(ovs-ofctl compose-packet --bare 'NSH_HEADER'),
8945
+ $(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT'), [\$])"])
8938
8946
8939
8947
OVS_TRAFFIC_VSWITCHD_STOP
8940
8948
AT_CLEANUP
@@ -8952,19 +8960,31 @@ dnl The flow will decap a nsh header which in turn carries a TCP syn packet
8952
8960
dnl eth/nsh/eth/ip/tcp --> OVS --> eth/ip/tcp
8953
8961
AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,in_port=ovs-p0,dl_type=0x894f, actions=decap(),decap(), ovs-p1"])
8954
8962
8955
- NETNS_DAEMONIZE([at_ns1], [tcpdump -l -n -xx -U -i p1 > p1.pcap], [tcpdump.pid])
8956
- sleep 1
8963
+ NETNS_DAEMONIZE([at_ns1],
8964
+ [tcpdump -l -n -xx -U -i p1 -w p1.pcap 2>tcpdump_err], [tcpdump.pid])
8965
+ OVS_WAIT_UNTIL([grep "listening" tcpdump_err])
8957
8966
8958
- dnl The hex dump is NSH packet with TCP syn payload. pkt=eth/nsh/eth/ip/tcp
8959
- dnl The packet is sent from p0(at_ns0) interface directed to
8960
- dnl p1(at_ns1) interface
8961
- NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 00 64 03 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
8967
+ m4_define([TCP_SYN_PKT], [m4_join([,],
8968
+ [eth_src=f2:00:00:00:00:01,eth_dst=f2:00:00:00:00:02,eth_type=0x0800],
8969
+ [nw_src=192.168.0.10,nw_dst=10.0.0.10],
8970
+ [nw_proto=6,nw_ttl=64,nw_frag=no],
8971
+ [tcp_src=1024,tcp_dst=2048,tcp_flags=syn])])
8972
+
8973
+ m4_define([NSH_HEADER], [m4_join([,],
8974
+ [eth_src=f2:ff:00:00:00:01,eth_dst=f2:ff:00:00:00:02,eth_type=0x894f],
8975
+ [nsh_ttl=63,nsh_np=3,nsh_spi=0x1234,nsh_si=255],
8976
+ [nsh_mdtype=1,nsh_c1=0x11223344])])
8977
+
8978
+ dnl Send the NSH packet with TCP SYN payload from p0(at_ns0) interface directed
8979
+ dnl to p1(at_ns1) interface.
8980
+ NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 \
8981
+ "$(ovs-ofctl compose-packet --bare 'NSH_HEADER')" \
8982
+ "$(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT')"],
8983
+ [0], [ignore])
8962
8984
8963
8985
dnl Check the expected de-capsulated TCP packet on the egress interface
8964
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0000: *f200 *0000 *0002 *f200 *0000 *0001 *0800 *4500" 2>&1 1>/dev/null])
8965
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0010: *0028 *0001 *0000 *4006 *b013 *c0a8 *000a *0a00" 2>&1 1>/dev/null])
8966
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0020: *000a *0400 *0800 *0000 *00c8 *0000 *0000 *5002" 2>&1 1>/dev/null])
8967
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0030: *2000 *b85e *0000" 2>&1 1>/dev/null])
8986
+ OVS_WAIT_UNTIL([ovs-pcap p1.pcap | grep -q \
8987
+ "^$(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT')\$"])
8968
8988
8969
8989
OVS_TRAFFIC_VSWITCHD_STOP
8970
8990
AT_CLEANUP
@@ -8984,22 +9004,38 @@ dnl The flow will add another NSH header with nsh_spi=0x101, nsh_si=4,
8984
9004
dnl nsh_ttl=7 and change the md1 context
8985
9005
AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,in_port=ovs-p0,dl_type=0x894f,nsh_spi=0x100,nsh_si=0x03,actions=decap(),decap(),encap(nsh(md_type=1)),set_field:0x07->nsh_ttl,set_field:0x0101->nsh_spi,set_field:0x04->nsh_si,set_field:0x100f0e0d->nsh_c1,set_field:0x0c0b0a09->nsh_c2,set_field:0x08070605->nsh_c3,set_field:0x04030201->nsh_c4,encap(ethernet),set_field:f2:ff:00:00:00:02->dl_dst,set_field:f2:ff:00:00:00:01->dl_src,ovs-p1"])
8986
9006
8987
- NETNS_DAEMONIZE([at_ns1], [tcpdump -l -n -xx -U -i p1 > p1.pcap], [tcpdump.pid])
8988
- sleep 1
9007
+ NETNS_DAEMONIZE([at_ns1],
9008
+ [tcpdump -l -n -xx -U -i p1 -w p1.pcap 2>tcpdump_err], [tcpdump.pid])
9009
+ OVS_WAIT_UNTIL([grep "listening" tcpdump_err])
8989
9010
8990
- dnl The hex dump is NSH packet with TCP syn payload. pkt=eth/nsh/eth/ip/tcp
8991
- dnl The nsh_ttl is 8, nsh_spi is 0x100 and nsh_si is 3
8992
- dnl The packet is sent from p0(at_ns0) interface directed to
8993
- dnl p1(at_ns1) interface
8994
- NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 01 00 03 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
9011
+ m4_define([TCP_SYN_PKT], [m4_join([,],
9012
+ [eth_src=f2:00:00:00:00:01,eth_dst=f2:00:00:00:00:02,eth_type=0x0800],
9013
+ [nw_src=192.168.0.10,nw_dst=10.0.0.10],
9014
+ [nw_proto=6,nw_ttl=64,nw_frag=no],
9015
+ [tcp_src=1024,tcp_dst=2048,tcp_flags=syn])])
9016
+
9017
+ m4_define([NSH_HEADER_1], [m4_join([,],
9018
+ [eth_src=f2:ff:00:00:00:01,eth_dst=f2:ff:00:00:00:02,eth_type=0x894f],
9019
+ [nsh_ttl=8,nsh_np=3,nsh_spi=0x100,nsh_si=3,nsh_mdtype=1],
9020
+ [nsh_c1=0x01020304,nsh_c2=0x05060708,nsh_c3=0x090a0b0c,nsh_c4=0x0d0e0f10])])
8995
9021
8996
- dnl Check the expected NSH packet with new fields in the header
8997
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0000: *f2ff *0000 *0002 *f2ff *0000* 0001 *894f *01c6" 2>&1 1>/dev/null])
8998
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0010: *0103 *0001 *0104 *100f *0e0d *0c0b *0a09 *0807" 2>&1 1>/dev/null])
8999
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0020: *0605 *0403 *0201 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null])
9000
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null])
9001
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null])
9002
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null])
9022
+ dnl Send the NSH packet with TCP SYN payload from p0(at_ns0) interface directed
9023
+ dnl to p1(at_ns1) interface.
9024
+ dnl The nsh_ttl is 8, nsh_spi is 0x100 and nsh_si is 3.
9025
+ NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 \
9026
+ "$(ovs-ofctl compose-packet --bare 'NSH_HEADER_1')" \
9027
+ "$(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT')"],
9028
+ [0], [ignore])
9029
+
9030
+ m4_define([NSH_HEADER_2], [m4_join([,],
9031
+ [eth_src=f2:ff:00:00:00:01,eth_dst=f2:ff:00:00:00:02,eth_type=0x894f],
9032
+ [nsh_ttl=7,nsh_np=3,nsh_spi=0x101,nsh_si=4,nsh_mdtype=1],
9033
+ [nsh_c1=0x100f0e0d,nsh_c2=0x0c0b0a09,nsh_c3=0x08070605,nsh_c4=0x04030201])])
9034
+
9035
+ dnl Check the expected NSH packet with new fields in the header.
9036
+ OVS_WAIT_UNTIL([ovs-pcap p1.pcap | grep -q "m4_join([], [^],
9037
+ $(ovs-ofctl compose-packet --bare 'NSH_HEADER_2'),
9038
+ $(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT'), [\$])"])
9003
9039
9004
9040
OVS_TRAFFIC_VSWITCHD_STOP
9005
9041
AT_CLEANUP
@@ -9020,31 +9056,50 @@ dnl packet to to at_ns2.
9020
9056
AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,dl_type=0x894f,nsh_spi=0x100,nsh_si=0x02,actions=ovs-p1"])
9021
9057
AT_CHECK([ovs-ofctl -Oopenflow13 add-flow br0 "table=0,priority=100,dl_type=0x894f,nsh_spi=0x100,nsh_si=0x01,actions=ovs-p2"])
9022
9058
9023
- NETNS_DAEMONIZE([at_ns1], [tcpdump -l -n -xx -U -i p1 > p1.pcap], [tcpdump.pid])
9024
- NETNS_DAEMONIZE([at_ns2], [tcpdump -l -n -xx -U -i p2 > p2.pcap], [tcpdump2.pid])
9025
- sleep 1
9059
+ NETNS_DAEMONIZE([at_ns1],
9060
+ [tcpdump -l -n -xx -U -i p1 -w p1.pcap 2>tcpdump_err], [tcpdump.pid])
9061
+ OVS_WAIT_UNTIL([grep "listening" tcpdump_err])
9062
+ NETNS_DAEMONIZE([at_ns2],
9063
+ [tcpdump -l -n -xx -U -i p2 -w p2.pcap 2>tcpdump2_err], [tcpdump2.pid])
9064
+ OVS_WAIT_UNTIL([grep "listening" tcpdump2_err])
9065
+
9066
+ m4_define([TCP_SYN_PKT], [m4_join([,],
9067
+ [eth_src=f2:00:00:00:00:01,eth_dst=f2:00:00:00:00:02,eth_type=0x0800],
9068
+ [nw_src=192.168.0.10,nw_dst=10.0.0.10],
9069
+ [nw_proto=6,nw_ttl=64,nw_frag=no],
9070
+ [tcp_src=1024,tcp_dst=2048,tcp_flags=syn])])
9071
+
9072
+ dnl First send packet from at_ns0 --> OVS with SPI=0x100 and SI=2.
9073
+ m4_define([NSH_HEADER_1], [m4_join([,],
9074
+ [eth_src=f2:ff:00:00:00:01,eth_dst=f2:ff:00:00:00:02,eth_type=0x894f],
9075
+ [nsh_ttl=8,nsh_np=3,nsh_spi=0x100,nsh_si=2,nsh_mdtype=1],
9076
+ [nsh_c1=0x01020304,nsh_c2=0x05060708,nsh_c3=0x090a0b0c,nsh_c4=0x0d0e0f10])])
9077
+
9078
+ NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 \
9079
+ "$(ovs-ofctl compose-packet --bare 'NSH_HEADER_1')" \
9080
+ "$(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT')"],
9081
+ [0], [ignore])
9082
+
9083
+ dnl Check for the above packet on p1 interface.
9084
+ OVS_WAIT_UNTIL([ovs-pcap p1.pcap | grep -q "m4_join([], [^],
9085
+ $(ovs-ofctl compose-packet --bare 'NSH_HEADER_1'),
9086
+ $(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT'), [\$])"])
9087
+
9088
+ dnl Send the second packet from at_ns1 --> OVS with SPI=0x100 and SI=1.
9089
+ m4_define([NSH_HEADER_2], [m4_join([,],
9090
+ [eth_src=f2:ff:00:00:00:01,eth_dst=f2:ff:00:00:00:02,eth_type=0x894f],
9091
+ [nsh_ttl=8,nsh_np=3,nsh_spi=0x100,nsh_si=1,nsh_mdtype=1],
9092
+ [nsh_c1=0x01020304,nsh_c2=0x05060708,nsh_c3=0x090a0b0c,nsh_c4=0x0d0e0f10])])
9093
+
9094
+ NS_CHECK_EXEC([at_ns1], [$PYTHON3 $srcdir/sendpkt.py p1 \
9095
+ "$(ovs-ofctl compose-packet --bare 'NSH_HEADER_2')" \
9096
+ "$(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT')"],
9097
+ [0], [ignore])
9026
9098
9027
- dnl First send packet from at_ns0 --> OVS with SPI=0x100 and SI=2
9028
- NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 01 00 02 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
9029
-
9030
- dnl Check for the above packet on p1 interface
9031
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *0206" 2>&1 1>/dev/null])
9032
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0010: *0103 *0001 *0002 *0102 *0304 *0506 *0708 *090a" 2>&1 1>/dev/null])
9033
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0020: *0b0c *0d0e *0f10 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null])
9034
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null])
9035
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null])
9036
- OVS_WAIT_UNTIL([cat p1.pcap | grep -E "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null])
9037
-
9038
- dnl Send the second packet from at_ns1 --> OVS with SPI=0x100 and SI=1
9039
- NS_CHECK_EXEC([at_ns1], [$PYTHON3 $srcdir/sendpkt.py p1 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 01 c6 01 03 00 01 00 01 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
9040
-
9041
- dnl Check for the above packet on p2 interface
9042
- OVS_WAIT_UNTIL([cat p2.pcap | grep -E "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *01c6" 2>&1 1>/dev/null])
9043
- OVS_WAIT_UNTIL([cat p2.pcap | grep -E "0x0010: *0103 *0001 *0001 *0102 *0304 *0506 *0708 *090a" 2>&1 1>/dev/null])
9044
- OVS_WAIT_UNTIL([cat p2.pcap | grep -E "0x0020: *0b0c *0d0e *0f10 *f200 *0000 *0002 *f200 *0000" 2>&1 1>/dev/null])
9045
- OVS_WAIT_UNTIL([cat p2.pcap | grep -E "0x0030: *0001 *0800 *4500 *0028 *0001 *0000 *4006 *b013" 2>&1 1>/dev/null])
9046
- OVS_WAIT_UNTIL([cat p2.pcap | grep -E "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800 *0000 *00c8" 2>&1 1>/dev/null])
9047
- OVS_WAIT_UNTIL([cat p2.pcap | grep -E "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null])
9099
+ dnl Check for the above packet on p2 interface.
9100
+ OVS_WAIT_UNTIL([ovs-pcap p2.pcap | grep -q "m4_join([], [^],
9101
+ $(ovs-ofctl compose-packet --bare 'NSH_HEADER_2'),
9102
+ $(ovs-ofctl compose-packet --bare 'TCP_SYN_PKT'), [\$])"])
9048
9103
9049
9104
OVS_TRAFFIC_VSWITCHD_STOP
9050
9105
AT_CLEANUP
0 commit comments