[ovs-dev] [PATCH] vswitchd: Also consider access port VLANs as "in use" for VLAN splinters.

Ben Pfaff blp at nicira.com
Tue Dec 27 21:01:55 UTC 2011


It's natural to add an access port to a bridge and expect that trunk ports
will then immediately start to work properly with that VLAN without
additional configuration.  This change makes that happen.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 vswitchd/bridge.c    |   16 +++++++++-------
 vswitchd/vswitch.xml |    5 +++++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 265410f..d42bae8 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -3412,8 +3412,9 @@ collect_splinter_vlans(const struct ovsrec_open_vswitch *ovs_cfg)
      * in the process of reconstructing all of them. */
     free_registered_blocks();
 
-    splinter_vlans = NULL;
+    splinter_vlans = bitmap_allocate(4096);
     sset_init(&splinter_ifaces);
+    vlan_splinters_enabled_anywhere = false;
     for (i = 0; i < ovs_cfg->n_bridges; i++) {
         struct ovsrec_bridge *br_cfg = ovs_cfg->bridges[i];
         size_t j;
@@ -3425,22 +3426,23 @@ collect_splinter_vlans(const struct ovsrec_open_vswitch *ovs_cfg)
             for (k = 0; k < port_cfg->n_interfaces; k++) {
                 struct ovsrec_interface *iface_cfg = port_cfg->interfaces[k];
 
+                vlan_splinters_enabled_anywhere = true;
                 if (vlan_splinters_is_enabled(iface_cfg)) {
                     sset_add(&splinter_ifaces, iface_cfg->name);
-
-                    if (!splinter_vlans) {
-                        splinter_vlans = bitmap_allocate(4096);
-                    }
                     vlan_bitmap_from_array__(port_cfg->trunks,
                                              port_cfg->n_trunks,
                                              splinter_vlans);
                 }
             }
+
+            if (port_cfg->tag && *port_cfg->tag > 0 && *port_cfg->tag < 4095) {
+                bitmap_set1(splinter_vlans, *port_cfg->tag);
+            }
         }
     }
 
-    vlan_splinters_enabled_anywhere = splinter_vlans != NULL;
-    if (!splinter_vlans) {
+    if (!vlan_splinters_enabled_anywhere) {
+        free(splinter_vlans);
         sset_destroy(&splinter_ifaces);
         return NULL;
     }
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 2f9a534..7d02e50 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1808,6 +1808,11 @@
 
       <ul>
         <li>
+          The VLAN is the <ref table="Port" column="tag"/> value in any <ref
+          table="Port"/> record.
+        </li>
+
+        <li>
           The VLAN is listed within the <ref table="Port" column="trunks"/>
           column of the <ref table="Port"/> record of an interface on which
           VLAN splinters are enabled.
-- 
1.7.2.5




More information about the dev mailing list