I intend to extend this patch with the following incremental to exercise
out of order fragment handling.
I may also include a separate similar test for overlapping fragments.

diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at
index 8496230..9057104 100644
--- a/tests/system-kmod-macros.at
+++ b/tests/system-kmod-macros.at
@@ -118,6 +118,14 @@ m4_define([DPCTL_MODIFY_FRAGMENTATION],

 ])

+# DPCTL_SET_MIN_FRAG_SIZE()
+#
+# The kernel does not support this command.
+m4_define([DPCTL_SET_MIN_FRAG_SIZE],
+[
+
+])
+
 # DPCTL_CHECK_FRAGMENTATION_PASS()
 #
 # The kernel does not support this command.
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index d801a0d..6489dbf 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -1795,6 +1795,32 @@ DPCTL_CHECK_FRAGMENTATION_PASS()
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP

+AT_SETUP([conntrack - ipv4 fragmentation out of order])
+CHECK_CONNTRACK()
+OVS_TRAFFIC_VSWITCHD_START()
+AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg
ofproto_dpif_upcall:dbg])
+
+ADD_NAMESPACES(at_ns0, at_ns1)
+
+ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
+ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24")
+
+DPCTL_SET_MIN_FRAG_SIZE()
+
+AT_DATA([bundle.txt], [dnl
+packet-out in_port=1,
packet=50540000000a505400000009080045000030000100320011a4860a0101010a01010200010002000800000010203040506070809000010203040506070809,
actions=ct(commit)
+packet-out in_port=1,
+packet=50540000000a5054000000090800450001a400012000001183440a0101010a01010200010002000800000304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809001020304050607080900010203040506070809000102030405060708090001020304050607080900010203040506070809,
actions=ct(commit)
+])
+
+AT_CHECK([ovs-ofctl bundle br0 bundle.txt])
+
+AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.2)], [0], [dnl
+udp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=<cleared>,dport=<cleared>),reply=(src=10.1.1.2,dst=10.1.1.1,sport=<cleared>,dport=<cleared>)
+])
+
+OVS_TRAFFIC_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([conntrack - IPv4 fragmentation expiry])
 CHECK_CONNTRACK()
 OVS_TRAFFIC_VSWITCHD_START()

diff --git a/tests/system-userspace-macros.at b/tests/
system-userspace-macros.at
index d7e4535..4fc662e 100644
--- a/tests/system-userspace-macros.at
+++ b/tests/system-userspace-macros.at
@@ -136,6 +136,16 @@ AT_CHECK([ovs-appctl dpctl/ipf-get-status], [], [dnl
 ])
 ])

+# DPCTL_SET_MIN_FRAG_SIZE()
+#
+# The userspace datapath supports this command.
+m4_define([DPCTL_SET_MIN_FRAG_SIZE],
+[
+AT_CHECK([ovs-appctl dpctl/ipf-set-minfragment v4 400], [], [dnl
+setting minimum fragment size successful
+])
+])
+
 # DPCTL_CHECK_FRAGMENTATION_PASS()
 #
 # Used to check fragmentation counters for some fragmentation tests using

Darrell


On Sun, Apr 8, 2018 at 7:54 PM, Darrell Ball <[email protected]> wrote:

> Enhance fragmentation tests for userspace datapath.
>
> Signed-off-by: Darrell Ball <[email protected]>
> ---
>  tests/system-kmod-macros.at      |  30 ++++++++--
>  tests/system-traffic.at          |  33 +++++++++++
>  tests/system-userspace-macros.at | 118 ++++++++++++++++++++++++++++++
> ++++++---
>  3 files changed, 166 insertions(+), 15 deletions(-)
>
> diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at
> index f23a406..8496230 100644
> --- a/tests/system-kmod-macros.at
> +++ b/tests/system-kmod-macros.at
> @@ -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],
> +[
> +
> +])
> diff --git a/tests/system-traffic.at b/tests/system-traffic.at
> index 115bca9..d801a0d 100644
> --- a/tests/system-traffic.at
> +++ b/tests/system-traffic.at
> @@ -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
> diff --git a/tests/system-userspace-macros.at b/tests/system-userspace-
> macros.at
> index 00e1f81..d7e4535 100644
> --- a/tests/system-userspace-macros.at
> +++ b/tests/system-userspace-macros.at
> @@ -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)
> +])
> +])
> --
> 1.9.1
>
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to