This avoids packet duplication when native tunneling is used.
The right solution is to adjust the native tunneling code so that
it discards packets not directed to the current host.  I expect
to see a patch for that correct solution soon, see:
http://openvswitch.org/pipermail/dev/2015-September/059528.html
---
 ovn/controller/encaps.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/ovn/controller/encaps.c b/ovn/controller/encaps.c
index 070b741..74b0e87 100644
--- a/ovn/controller/encaps.c
+++ b/ovn/controller/encaps.c
@@ -113,7 +113,7 @@ tunnel_create_name(struct tunnel_ctx *tc, const char 
*chassis_id)
 
 static void
 tunnel_add(struct tunnel_ctx *tc, const char *new_chassis_id,
-           const struct sbrec_encap *encap)
+           const struct sbrec_encap *encap, const char *encap_ip)
 {
     struct port_hash_node *hash_node;
 
@@ -167,6 +167,7 @@ tunnel_add(struct tunnel_ctx *tc, const char 
*new_chassis_id,
     ovsrec_interface_set_name(iface, port_name);
     ovsrec_interface_set_type(iface, encap->type);
     smap_add(&options, "remote_ip", encap->ip);
+    smap_add(&options, "local_ip", encap_ip);
     smap_add(&options, "key", "flow");
     ovsrec_interface_set_options(iface, &options);
     smap_destroy(&options);
@@ -235,6 +236,18 @@ encaps_run(struct controller_ctx *ctx, const struct 
ovsrec_bridge *br_int,
         return;
     }
 
+    const struct ovsrec_open_vswitch *cfg = 
ovsrec_open_vswitch_first(ctx->ovs_idl);
+    if (!cfg) {
+        VLOG_INFO("No Open_vSwitch row defined.");
+        return;
+    }
+
+    const char *encap_ip = smap_get(&cfg->external_ids, "ovn-encap-ip");
+    if (!encap_ip) {
+        VLOG_INFO("Need to specify an encap ip");
+        return;
+    }
+
     const struct sbrec_chassis *chassis_rec;
     const struct ovsrec_bridge *br;
 
@@ -278,7 +291,7 @@ encaps_run(struct controller_ctx *ctx, const struct 
ovsrec_bridge *br_int,
                 VLOG_INFO("No supported encaps for '%s'", chassis_rec->name);
                 continue;
             }
-            tunnel_add(&tc, chassis_rec->name, encap);
+            tunnel_add(&tc, chassis_rec->name, encap, encap_ip);
         }
     }
 
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to