@@ -76,12 +76,6 @@ m4_define([CHECK_CONNTRACK],
#
m4_define([CHECK_CONNTRACK_ALG])
-# CHECK_CONNTRACK_FRAG()
-#
-# Perform requirements checks for running conntrack fragmentations tests.
-# The kernel always supports fragmentation, so no check is needed.
-m4_define([CHECK_CONNTRACK_FRAG])
-
# CHECK_CONNTRACK_LOCAL_STACK()
#
# Perform requirements checks for running conntrack tests with local stack.
@@ -115,3 +109,27 @@ m4_define([CHECK_CT_DPIF_GET_NCONNS],
[
AT_SKIP_IF([:])
])
+
+# DPCTL_MODIFY_FRAGMENTATION()
+#
+# The kernel does not support this command.
+m4_define([DPCTL_MODIFY_FRAGMENTATION],
+[
+
+])
+
+# DPCTL_CHECK_FRAGMENTATION_PASS()
+#
+# The kernel does not support this command.
+m4_define([DPCTL_CHECK_FRAGMENTATION_PASS],
+[
+
+])
+
+# DPCTL_CHECK_FRAGMENTATION_FAIL()
+#
+# The kernel does not support this command.
+m4_define([DPCTL_CHECK_FRAGMENTATION_FAIL],
+[
+
+])
@@ -1776,6 +1776,9 @@ priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1
AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
+dnl Modify userspace conntrack fragmentation handling.
+DPCTL_MODIFY_FRAGMENTATION()
+
dnl Ipv4 fragmentation connectivity check.
NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -1786,6 +1789,9 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])
+dnl Check userspace conntrack fragmentation counters.
+DPCTL_CHECK_FRAGMENTATION_PASS()
+
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP
@@ -1811,11 +1817,17 @@ priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1
AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
+dnl Modify userspace conntrack fragmentation handling.
+DPCTL_MODIFY_FRAGMENTATION()
+
dnl Ipv4 fragmentation connectivity check.
NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 1 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
7 packets transmitted, 0 received, 100% packet loss, time 0ms
])
+dnl Check userspace conntrack fragmentation counters.
+DPCTL_CHECK_FRAGMENTATION_FAIL()
+
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP
@@ -1841,6 +1853,9 @@ priority=100,in_port=2,ct_state=+trk+est-new,icmp,action=1
AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
+dnl Modify userspace conntrack fragmentation handling.
+DPCTL_MODIFY_FRAGMENTATION()
+
dnl Ipv4 fragmentation connectivity check.
NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -1851,6 +1866,9 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])
+dnl Check userspace conntrack fragmentation counters.
+DPCTL_CHECK_FRAGMENTATION_PASS()
+
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP
@@ -1883,6 +1901,9 @@ AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2])
+dnl Modify userspace conntrack fragmentation handling.
+DPCTL_MODIFY_FRAGMENTATION()
+
dnl Ipv4 fragmentation connectivity check.
NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -1932,6 +1953,9 @@ dnl waiting, we get occasional failures due to the following error:
dnl "connect: Cannot assign requested address"
OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
+dnl Modify userspace conntrack fragmentation handling.
+DPCTL_MODIFY_FRAGMENTATION()
+
dnl Ipv6 fragmentation connectivity check.
NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -1975,6 +1999,9 @@ dnl waiting, we get occasional failures due to the following error:
dnl "connect: Cannot assign requested address"
OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
+dnl Modify userspace conntrack fragmentation handling.
+DPCTL_MODIFY_FRAGMENTATION()
+
dnl Send an IPv6 fragment. Some time later, it should expire.
NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 1 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl
7 packets transmitted, 0 received, 100% packet loss, time 0ms
@@ -2014,6 +2041,9 @@ dnl waiting, we get occasional failures due to the following error:
dnl "connect: Cannot assign requested address"
OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
+dnl Modify userspace conntrack fragmentation handling.
+DPCTL_MODIFY_FRAGMENTATION()
+
dnl Ipv4 fragmentation connectivity check.
NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -2057,6 +2087,9 @@ AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::4])
+dnl Modify userspace conntrack fragmentation handling.
+DPCTL_MODIFY_FRAGMENTATION()
+
dnl Ipv6 fragmentation connectivity check.
NS_CHECK_EXEC([at_ns0], [ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -73,15 +73,6 @@ m4_define([CHECK_CONNTRACK],
#
m4_define([CHECK_CONNTRACK_ALG])
-# CHECK_CONNTRACK_FRAG()
-#
-# Perform requirements checks for running conntrack fragmentations tests.
-# The userspace doesn't support fragmentation yet, so skip the tests.
-m4_define([CHECK_CONNTRACK_FRAG],
-[
- AT_SKIP_IF([:])
-])
-
# CHECK_CONNTRACK_LOCAL_STACK()
#
# Perform requirements checks for running conntrack tests with local stack.
@@ -111,3 +102,112 @@ m4_define([CHECK_CT_DPIF_SET_GET_MAXCONNS])
# Perform requirements checks for running ovs-dpctl ct-get-nconns. The
# userspace datapath does support this feature.
m4_define([CHECK_CT_DPIF_GET_NCONNS])
+
+# DPCTL_MODIFY_FRAGMENTATION()
+#
+# The userspace datapath supports this command.
+m4_define([DPCTL_MODIFY_FRAGMENTATION],
+[
+AT_CHECK([ovs-appctl dpctl/ipf-set-minfragment v4 1000], [], [dnl
+setting minimum fragment size successful
+])
+AT_CHECK([ovs-appctl dpctl/ipf-set-maxfrags 500], [], [dnl
+setting maximum fragments successful
+])
+AT_CHECK([ovs-appctl dpctl/ipf-get-status], [], [dnl
+ Fragmentation Module Status
+ ---------------------------
+ v4 enabled: 1
+ v6 enabled: 1
+ max num frags (v4/v6): 500
+ num frag: 0
+ min v4 frag size: 1000
+ v4 frags accepted: 0
+ v4 frags completed: 0
+ v4 frags expired: 0
+ v4 frags too small: 0
+ v4 frags overlapped: 0
+ min v6 frag size: 1280
+ v6 frags accepted: 0
+ v6 frags completed: 0
+ v6 frags expired: 0
+ v6 frags too small: 0
+ v6 frags overlapped: 0
+])
+])
+
+# DPCTL_CHECK_FRAGMENTATION_PASS()
+#
+# Used to check fragmentation counters for some fragmentation tests using
+# the userspace datapath.
+m4_define([DPCTL_CHECK_FRAGMENTATION_PASS],
+[
+AT_CHECK([ovs-appctl dpctl/ipf-get-status verbose], [], [dnl
+ Fragmentation Module Status
+ ---------------------------
+ v4 enabled: 1
+ v6 enabled: 1
+ max num frags (v4/v6): 500
+ num frag: 0
+ min v4 frag size: 1000
+ v4 frags accepted: 30
+ v4 frags completed: 30
+ v4 frags expired: 0
+ v4 frags too small: 0
+ v4 frags overlapped: 0
+ min v6 frag size: 1280
+ v6 frags accepted: 0
+ v6 frags completed: 0
+ v6 frags expired: 0
+ v6 frags too small: 0
+ v6 frags overlapped: 0
+
+ Fragment Lists:
+
+])
+])
+
+# FORMAT_FRAG_LIST([])
+#
+# Strip content from the piped input which can differ from test to test; recirc_id
+# and ip_id fields in an ipf_list vary from test to test and hence are cleared.
+m4_define([FORMAT_FRAG_LIST],
+ [[sed -e 's/ip_id=[0-9]*/ip_id=<cleared>/g' -e 's/recirc_id=[0-9]*/recirc_id=<cleared>/g']])
+
+# DPCTL_CHECK_FRAGMENTATION_FAIL()
+#
+# Used to check fragmentation counters for some fragmentation tests using
+# the userspace datapath, when failure to transmit fragments is expected.
+m4_define([DPCTL_CHECK_FRAGMENTATION_FAIL],
+[
+AT_CHECK([ovs-appctl dpctl/ipf-get-status verbose | FORMAT_FRAG_LIST()], [], [dnl
+ Fragmentation Module Status
+ ---------------------------
+ v4 enabled: 1
+ v6 enabled: 1
+ max num frags (v4/v6): 500
+ num frag: 7
+ min v4 frag size: 1000
+ v4 frags accepted: 7
+ v4 frags completed: 0
+ v4 frags expired: 0
+ v4 frags too small: 0
+ v4 frags overlapped: 0
+ min v6 frag size: 1280
+ v6 frags accepted: 0
+ v6 frags completed: 0
+ v6 frags expired: 0
+ v6 frags too small: 0
+ v6 frags overlapped: 0
+
+ Fragment Lists:
+
+frag list elem=(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
+frag list elem=(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
+frag list elem=(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
+frag list elem=(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
+frag list elem=(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
+frag list elem=(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
+frag list elem=(src=10.1.1.1,dst=10.1.1.2,recirc_id=<cleared>,ip_id=<cleared>,dl_type=0x800,zone=9,nw_proto=1,num_fragments=1,state=first frag)
+])
+])
Enhance fragmentation tests for userspace datapath. Signed-off-by: Darrell Ball <dlu998@gmail.com> --- tests/system-kmod-macros.at | 30 ++++++++-- tests/system-traffic.at | 33 +++++++++++ tests/system-userspace-macros.at | 118 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 166 insertions(+), 15 deletions(-)