[ovs-dev] [PATCH] ofproto: Fix detection of in-use VLANs based on the flow table.

Ben Pfaff blp at nicira.com
Wed Jan 4 18:18:00 UTC 2012


I swear I tested this, but the code was obviously wrong.

I haven't tested the new version yet, but I will before I commit it.

Signed-off-by: Ben Pfaff <blp at nicira.com>
Reported-by: Brendan Kelley <bkelley at nicira.com>
Bug #8729.
---
 AUTHORS           |    1 +
 ofproto/ofproto.c |    8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index ac34b20..821f780 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -64,6 +64,7 @@ Alexey I. Froloff       raorn at altlinux.org
 Bob Ball                bob.ball at citrix.com
 Brad Hall               brad at nicira.com
 Brandon Heller          brandonh at stanford.edu
+Brendan Kelley          bkelley at nicira.com
 Bryan Fulton            bryan at nicira.com
 Bryan Osoro             bosoro at nicira.com
 Cedric Hobbs            cedric at nicira.com
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index b6f9207..0027a8e 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2009, 2010, 2011, 2012 Nicira Networks.
  * Copyright (c) 2010 Jean Tourrilhes - HP-Labs.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3191,7 +3191,8 @@ ofoperation_complete(struct ofoperation *op, int error)
             if (op->victim) {
                 ofproto_rule_destroy__(op->victim);
             }
-            if (!(rule->cr.wc.vlan_tci_mask & htons(VLAN_VID_MASK))
+            if ((rule->cr.wc.vlan_tci_mask & htons(VLAN_VID_MASK))
+                == htons(VLAN_VID_MASK)
                 && ofproto->vlan_bitmap) {
                 uint16_t vid = vlan_tci_to_vid(rule->cr.flow.vlan_tci);
 
@@ -3336,7 +3337,8 @@ ofproto_get_vlan_usage(struct ofproto *ofproto, unsigned long int *vlan_bitmap)
         const struct cls_table *table;
 
         HMAP_FOR_EACH (table, hmap_node, &cls->tables) {
-            if (!(table->wc.vlan_tci_mask & htons(VLAN_VID_MASK))) {
+            if ((table->wc.vlan_tci_mask & htons(VLAN_VID_MASK))
+                == htons(VLAN_VID_MASK)) {
                 const struct cls_rule *rule;
 
                 HMAP_FOR_EACH (rule, hmap_node, &table->rules) {
-- 
1.7.2.5




More information about the dev mailing list