---
 ovn/controller/encaps.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ovn/controller/encaps.c b/ovn/controller/encaps.c
index f187a8f..5da7fbe 100644
--- a/ovn/controller/encaps.c
+++ b/ovn/controller/encaps.c
@@ -136,14 +136,14 @@ exit:
 }
 
 static struct sbrec_encap *
-preferred_encap(const struct sbrec_chassis *chassis_rec)
+preferred_encap(const struct sbrec_chassis *chassis_rec, uint32_t 
all_encap_type)
 {
     struct sbrec_encap *best_encap = NULL;
     uint32_t best_type = 0;
 
     for (int i = 0; i < chassis_rec->n_encaps; i++) {
         uint32_t tun_type = get_tunnel_type(chassis_rec->encaps[i]->type);
-        if (tun_type > best_type) {
+        if (tun_type > best_type && (tun_type & all_encap_type)) {
             best_type = tun_type;
             best_encap = chassis_rec->encaps[i];
         }
@@ -197,11 +197,18 @@ encaps_run(struct controller_ctx *ctx, const struct 
ovsrec_bridge *br_int,
             }
         }
     }
+    
+    const struct sbrec_chassis *lchassis_rec
+        = get_chassis(ctx->ovnsb_idl, chassis_id);
+    uint32_t all_encap_type = 0;
+    for (int i = 0; i < lchassis_rec->n_encaps; i++) {
+        all_encap_type |= get_tunnel_type(lchassis_rec->encaps[i]->type);
+    }
 
     SBREC_CHASSIS_FOR_EACH(chassis_rec, ctx->ovnsb_idl) {
         if (strcmp(chassis_rec->name, chassis_id)) {
             /* Create tunnels to the other chassis. */
-            const struct sbrec_encap *encap = preferred_encap(chassis_rec);
+            const struct sbrec_encap *encap = 
preferred_encap(chassis_rec,all_encap_type);
             if (!encap) {
                 VLOG_INFO("No supported encaps for '%s'", chassis_rec->name);
                 continue;
-- 
2.8.1


_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to