[ovs-dev] [PATCH] ovn-controller: Fix table 33 flows for containers.

Gurucharan Shetty shettyg at nicira.com
Mon Sep 28 13:54:57 UTC 2015


When containers are inside a VM, the broadcast flow
generated in table 33 was faulty. This was because
'lport_to_ofport' did not include logical ports
associated with containers.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 ovn/controller/physical.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index bdb02da..c9bc9de 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -221,9 +221,21 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve,
      * of datapaths with at least one local port binding. */
     struct hmap local_datapaths = HMAP_INITIALIZER(&local_datapaths);
 
+    const struct sbrec_port_binding *binding;
+    /* Populate 'lport_to_ofport' with containers behind local vif. */
+    SBREC_PORT_BINDING_FOR_EACH (binding, ctx->ovnsb_idl) {
+        if (binding->parent_port) {
+            ofp_port_t ofport;
+            ofport = u16_to_ofp(simap_get(&lport_to_ofport,
+                                          binding->parent_port));
+            if (ofport) {
+                simap_put(&lport_to_ofport, binding->logical_port, ofport);
+            }
+        }
+    }
+
     /* Set up flows in table 0 for physical-to-logical translation and in table
      * 64 for logical-to-physical translation. */
-    const struct sbrec_port_binding *binding;
     SBREC_PORT_BINDING_FOR_EACH (binding, ctx->ovnsb_idl) {
         /* Find the OpenFlow port for the logical port, as 'ofport'.  This is
          * one of:
@@ -252,15 +264,16 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve,
                 continue;
             }
             ofport = u16_to_ofp(simap_get(&localnet_to_ofport, network));
-        } else if (binding->parent_port) {
-            ofport = u16_to_ofp(simap_get(&lport_to_ofport,
-                                          binding->parent_port));
-            if (ofport && binding->tag) {
-                tag = *binding->tag;
-            }
         } else {
             ofport = u16_to_ofp(simap_get(&lport_to_ofport,
                                           binding->logical_port));
+            if (ofport && binding->parent_port) {
+                if (binding->tag) {
+                    tag = *binding->tag;
+                } else {
+                    continue;
+                }
+            }
         }
 
         const struct chassis_tunnel *tun = NULL;
-- 
1.9.1




More information about the dev mailing list