[ovs-dev] [PATCH] tests: Check that in_port is preserved from packet-out to packet-in.

Ben Pfaff blp at nicira.com
Tue Jul 10 17:15:52 UTC 2012


OVS 1.0.99 and possibly other versions had a bug such that a packet
injected into the datapath by userspace (e.g. via "packet-out") would lose
its in_port if the packet came back to userspace through a "userspace"
datapath action.  This test checks for a regression.

(A packet sent to the controller doesn't make a round-trip through the
datapath in the current implementation, but the idea of checking that the
in_port specified on packet-in gets propagated through to a resulting
packet-out makes plenty of sense).

NICS-15.
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 tests/ofproto-dpif.at |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 924e97a..93cba92 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -102,7 +102,6 @@ priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(50:54:00:00:00:05->50:54:
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
-
 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
 OVS_VSWITCHD_START(
        [add-port br0 p1 -- set Interface p1 type=dummy --\
@@ -123,6 +122,32 @@ AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+dnl OVS 1.0.99 and possibly other versions had a bug such that a packet
+dnl injected into the datapath by userspace (e.g. via "packet-out") would
+dnl lose its in_port if the packet came back to userspace through a
+dnl "userspace" datapath action.  This test checks for a regression.
+AT_SETUP([ofproto-dpif - in_port preserved across datapath])
+OVS_VSWITCHD_START(
+       [add-port br0 p1 -- set Interface p1 type=dummy --\
+        add-port br0 p2 -- set Interface p2 type=dummy])
+
+AT_CHECK([ovs-ofctl monitor br0 65534 --detach --pidfile 2> ofctl_monitor.log])
+
+AT_CHECK([ovs-ofctl add-flow br0 action=controller])
+
+AT_CHECK([ovs-ofctl packet-out br0 1 output:2,controller 0001020304050010203040501234])
+AT_CHECK([ovs-ofctl packet-out br0 2 output:1,controller 0001020304050010203040502345])
+OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): total_len=14 in_port=1 tun_id=0x0 metadata=0x0 reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0 (via action) data_len=14 (unbuffered)
+priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:1234 proto:0 tos:0 ttl:0 ip(0.0.0.0->0.0.0.0)
+NXT_PACKET_IN (xid=0x0): total_len=14 in_port=2 tun_id=0x0 metadata=0x0 reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0 (via action) data_len=14 (unbuffered)
+priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) mac(00:10:20:30:40:50->00:01:02:03:04:05) type:2345 proto:0 tos:0 ttl:0 ip(0.0.0.0->0.0.0.0)
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([ofproto-dpif - DSCP])
 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
 AT_DATA([flows.txt], [dnl
-- 
1.7.2.5




More information about the dev mailing list