[ovs-dev] [PATCH 1/4] Summary: From: Jarno Rajahalme <jrajahalme at nicira.com>

Jarno Rajahalme jrajahalme at nicira.com
Thu Oct 15 21:28:01 UTC 2015


ovs-ofctl: Fix replace-flows.

The replace-flows test cases tested for incorrect
behavior due to the missing initialization of the out_group member of
struct ofputil_flow_stats_request.  This patch fixes this by properly
initializing out_group to OFPG_ANY.

Note that replace-flows still does not support multiple tables, but
that will be fixed in a later patch in the series.

Reported-by: Takashi Yamamoto <yamamoto at midokura.com>
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
 tests/ovs-ofctl.at    | 34 +++++++++++++++++++++++++---------
 utilities/ovs-ofctl.c |  2 ++
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 33e67ed..6f03adb 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -2851,12 +2851,12 @@ dnl Add flows to br0 with importance via OF1.4+. For more details refer "ovs-ofc
 for i in 1 2 3 4 5 6 7 8; do echo "dl_vlan=$i,importance=$i,actions=drop"; done > add-flows.txt
 AT_CHECK([ovs-ofctl -O OpenFlow14 add-flows br0 add-flows.txt])
 
-dnl Replace some flows in the bridge.
-for i in 1 3 5 7; do echo "dl_vlan=$i,importance=`expr $i + 10`,actions=drop"; done > replace-flows.txt
+dnl Replace the flows in the bridge.
+for i in 1 3 5 7; do echo " importance=`expr $i + 10`, dl_vlan=$i actions=drop"; done > replace-flows.txt
 AT_CHECK([ovs-ofctl -O OpenFlow14 replace-flows br0 replace-flows.txt])
 
 dnl Dump them and compare the dump flows output against the expected output.
-for i in 1 2 3 4 5 6 7 8; do if [[ `expr $i % 2` -eq 1 ]]; then importance=`expr $i + 10`; else importance=$i; fi; echo " importance=$importance, dl_vlan=$i actions=drop"; done | sort > expout
+cat replace-flows.txt > expout
 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/OFPST_FLOW/d' | sort],
   [0], [expout])
 
@@ -2873,11 +2873,11 @@ for i in 1 2 3 4 5 6 7 8; do echo "dl_vlan=$i,importance=$i,actions=drop"; done
 AT_CHECK([ovs-ofctl --bundle add-flows br0 add-flows.txt])
 
 dnl Replace some flows in the bridge.
-for i in 1 3 5 7; do echo "dl_vlan=$i,importance=`expr $i + 10`,actions=drop"; done > replace-flows.txt
+for i in 1 3 5 7; do echo " importance=`expr $i + 10`, dl_vlan=$i actions=drop"; done > replace-flows.txt
 AT_CHECK([ovs-ofctl --bundle replace-flows br0 replace-flows.txt])
 
 dnl Dump them and compare the dump flows output against the expected output.
-for i in 1 2 3 4 5 6 7 8; do if [[ `expr $i % 2` -eq 1 ]]; then importance=`expr $i + 10`; else importance=$i; fi; echo " importance=$importance, dl_vlan=$i actions=drop"; done | sort > expout
+cat replace-flows.txt > expout
 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/OFPST_FLOW/d' | sort],
   [0], [expout])
 
@@ -2930,12 +2930,32 @@ vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05)
 vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
 vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
+ importance=1, dl_vlan=1 actions=drop
+ importance=2, dl_vlan=2 actions=drop
+ importance=3, dl_vlan=3 actions=drop
+ importance=4, dl_vlan=4 actions=drop
+ importance=5, dl_vlan=5 actions=drop
+ importance=6, dl_vlan=6 actions=drop
+ importance=7, dl_vlan=7 actions=drop
+ importance=8, dl_vlan=8 actions=drop
 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
  bundle_id=0 type=OPEN_REPLY flags=0
 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
  bundle_id=0 flags=atomic ordered
+OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 dl_vlan=2 actions=drop
+vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
+ bundle_id=0 flags=atomic ordered
+OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 dl_vlan=4 actions=drop
+vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
+ bundle_id=0 flags=atomic ordered
+OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 dl_vlan=6 actions=drop
+vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
+ bundle_id=0 flags=atomic ordered
+OFPT_FLOW_MOD (OF1.4): DEL_STRICT table:255 dl_vlan=8 actions=drop
+vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
+ bundle_id=0 flags=atomic ordered
 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=1 importance:11 actions=drop
 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
  bundle_id=0 flags=atomic ordered
@@ -2957,10 +2977,6 @@ vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
 vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
 vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
- importance=2, dl_vlan=2 actions=drop
- importance=4, dl_vlan=4 actions=drop
- importance=6, dl_vlan=6 actions=drop
- importance=8, dl_vlan=8 actions=drop
  importance=11, dl_vlan=1 actions=drop
  importance=13, dl_vlan=3 actions=drop
  importance=15, dl_vlan=5 actions=drop
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 0c315c1..fbc9da4 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -2725,6 +2725,7 @@ read_flows_from_switch(struct vconn *vconn,
     fsr.aggregate = false;
     match_init_catchall(&fsr.match);
     fsr.out_port = OFPP_ANY;
+    fsr.out_group = OFPG_ANY;
     fsr.table_id = 0xff;
     fsr.cookie = fsr.cookie_mask = htonll(0);
     request = ofputil_encode_flow_stats_request(&fsr, protocol);
@@ -2773,6 +2774,7 @@ fte_make_flow_mod(const struct fte *fte, int index, uint16_t command,
     fm.importance = version->importance;
     fm.buffer_id = UINT32_MAX;
     fm.out_port = OFPP_ANY;
+    fm.out_group = OFPG_ANY;
     fm.flags = version->flags;
     if (command == OFPFC_ADD || command == OFPFC_MODIFY ||
         command == OFPFC_MODIFY_STRICT) {
-- 
2.1.4




More information about the dev mailing list