[ovs-dev] [PATCH] ofproto: Send monitor updates if a flow mod changes a rules actions

Simon Horman horms at verge.net.au
Thu Jun 5 09:54:47 UTC 2014


Without this change a monitor update will be sent when a flow mod changes
a rules cookie but not if only the actions are updated. This appears
to be a logic error.

I noticed this while working on implementing OpenFlow1.4 flow monitor
as an OpenFlow1.4 flow mod does not update a rules cookie.

Signed-off-by: Simon Horman <horms at verge.net.au>
---
 ofproto/ofproto.c | 2 +-
 tests/ofproto.at  | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index f34cfde..e3d8509 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -6227,7 +6227,7 @@ ofopgroup_complete(struct ofopgroup *group)
         if (!(op->error
               || ofproto_rule_is_hidden(rule)
               || (op->type == OFOPERATION_MODIFY
-                  && op->actions
+                  && !op->actions
                   && rule->flow_cookie == op->flow_cookie))) {
             enum nx_flow_update_event event_type;
 
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 2f1df2d..6f6160e 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -2126,6 +2126,7 @@ ovs-ofctl add-flow br0 in_port=0,dl_vlan=0,actions=output:20
 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=0,actions=output:21
 ovs-ofctl add-flow br0 in_port=0,dl_vlan_pcp=1,actions=output:22
 ovs-ofctl add-flow br0 in_port=0,actions=output:23
+ovs-ofctl mod-flows br0 dl_vlan=123,actions=output:3
 ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3
 ovs-ofctl del-flows br0 dl_vlan=123
 ovs-ofctl del-flows br0
@@ -2189,6 +2190,10 @@ NXST_FLOW_MONITOR reply (xid=0x0):
 NXST_FLOW_MONITOR reply (xid=0x0):
  event=ADDED table=0 cookie=0 in_port=0 actions=output:23
 NXST_FLOW_MONITOR reply (xid=0x0):
+ event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:3
+ event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
+ event=MODIFIED table=0 cookie=0 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
+NXST_FLOW_MONITOR reply (xid=0x0):
  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123 actions=output:3
  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3
  event=MODIFIED table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3
-- 
2.0.0.rc2




More information about the dev mailing list