[ovs-dev] [PATCH v2] ofproto-dpif-xlate: Fix conntrack fields on NXT_RESUME

Yi-Hung Wei yihung.wei at gmail.com
Wed Sep 26 22:08:03 UTC 2018


This patch addresses the issue that the conntrack fields associated
with a packet are missing after a packet is resumed by NXT_RESUME.
For example, the last rule in the following OpenFlow pipeline is not
working without this patch.

table=0, arp,in_port=1 action=2
table=0, arp,in_port=2 action=1
table=0, in_port=2 icmp action=output:1
table=0, in_port=1 icmp action=ct(table=1)
table=1, icmp action=controller(pause) resubmit(,2)
table=2, in_port=1 icmp ct_state=+trk+new action=output:2

A unit test is added to prevent regression.

Fixes: 77ab5fd2a95b ("Implement serializing the state of packet traversal in "continuations".")
VMware-BZ: #2202764
Signed-off-by: Yi-Hung Wei <yihung.wei at gmail.com>
---
v1->v2: A unit test is added.
---
 ofproto/ofproto-dpif-xlate.c |  1 +
 tests/system-traffic.at      | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index d0e7c6b9f55d..f85be6604348 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -7472,6 +7472,7 @@ xlate_resume(struct ofproto_dpif *ofproto,
     dp_packet_use_const(&packet, pin->base.packet,
                         pin->base.packet_len);
 
+    pkt_metadata_from_flow(&packet.md, &pin->base.flow_metadata.flow);
     flow_extract(&packet, flow);
 
     struct xlate_in xin;
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 277227bdd4cf..04f5529f8fc8 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -1320,6 +1320,33 @@ udp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([conntrack - controller pause and resume])
+OVS_TRAFFIC_VSWITCHD_START()
+
+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")
+
+AT_DATA([flows.txt], [dnl
+table=0, arp,in_port=1 action=2
+table=0, arp,in_port=2 action=1
+table=0, in_port=2 icmp action=output:1
+table=0, in_port=1 icmp action=ct(table=1)
+table=1, icmp action=controller(pause) resubmit(,2)
+table=2, in_port=1 icmp ct_state=+trk+new action=output:2
+])
+
+AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
+ovs-ofctl monitor br0 resume --detach --no-chdir
+
+NS_CHECK_EXEC([at_ns0], [ping -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
+])
+
+OVS_TRAFFIC_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([conntrack - force commit])
 CHECK_CONNTRACK()
 OVS_TRAFFIC_VSWITCHD_START()
-- 
2.7.4



More information about the dev mailing list