icsbrec_port_binding set address to empty string, however
the in NB, the router-port exists. So, all the processes of
sync learned route executes.
Collect lr routes doesn't fill ic route info because
it doesn't extract lsp address. Sync learned routes doesn't find
the route and always add the route, generating a loop.
To fix it, sync learned route doesn't execute when address is empty
or logical router is disabled.

Signed-off-by: Lucas Vargas Dias <lucas.vd...@luizalabs.com>
---
 ic/ovn-ic.c     | 15 +++++++++++++++
 tests/ovn-ic.at | 11 +++++++++++
 2 files changed, 26 insertions(+)

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index fa4a6b118..5dad972c4 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -1026,6 +1026,12 @@ parse_route(const char *s_prefix, const char *s_nexthop,
     return !in6_is_lla(nexthop);
 }
 
+static bool
+lr_is_enabled(const struct nbrec_logical_router *lr)
+{
+    return !lr->n_enabled || *lr->enabled;
+}
+
 /* Return false if can't be added due to bad format. */
 static bool
 add_to_routes_learned(struct hmap *routes_learned,
@@ -1519,6 +1525,10 @@ route_need_learn(const struct nbrec_logical_router *lr,
         return false;
     }
 
+    if (!lr_is_enabled(lr)) {
+        return false;
+    }
+
     if (prefix_is_link_local(prefix, plen)) {
         return false;
     }
@@ -1685,6 +1695,9 @@ sync_learned_routes(struct ic_context *ctx,
     const struct icsbrec_port_binding *isb_pb;
     const struct nbrec_logical_router_port *lrp;
     VECTOR_FOR_EACH (&ic_lr->isb_pbs, isb_pb) {
+        if (!strcmp(isb_pb->address, "")) {
+            continue;
+        }
         lrp_name = get_lrp_name_by_ts_port_name(ctx, isb_pb->logical_port);
         lrp = get_lrp_by_lrp_name(ctx, lrp_name);
         if (lrp) {
@@ -2943,6 +2956,8 @@ main(int argc, char *argv[])
                          &nbrec_logical_router_col_options);
     ovsdb_idl_add_column(ovnnb_idl_loop.idl,
                          &nbrec_logical_router_col_external_ids);
+    ovsdb_idl_add_column(ovnnb_idl_loop.idl,
+                         &nbrec_logical_router_col_enabled);
     ovsdb_idl_add_column(ovnnb_idl_loop.idl,
                          &nbrec_logical_router_col_load_balancer);
     ovsdb_idl_add_column(ovnnb_idl_loop.idl,
diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
index 74ea3bad2..88e5e9028 100644
--- a/tests/ovn-ic.at
+++ b/tests/ovn-ic.at
@@ -3526,6 +3526,17 @@ OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list 
lr11 | grep 192.168 |
 192.168.0.0/24 169.254.101.22
 ])
 
+check ovn_as az1 ovn-nbctl set logical_router lr11 enable=false
+OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
+             grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
+])
+
+check ovn_as az1 ovn-nbctl set logical_router lr11 enable=true
+OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
+             grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
+192.168.0.0/24 169.254.101.22
+])
+
 OVN_CLEANUP_IC([az1], [az2])
 
 AT_CLEANUP
-- 
2.34.1


-- 




_'Esta mensagem é direcionada apenas para os endereços constantes no 
cabeçalho inicial. Se você não está listado nos endereços constantes no 
cabeçalho, pedimos-lhe que desconsidere completamente o conteúdo dessa 
mensagem e cuja cópia, encaminhamento e/ou execução das ações citadas estão 
imediatamente anuladas e proibidas'._


* **'Apesar do Magazine Luiza tomar 
todas as precauções razoáveis para assegurar que nenhum vírus esteja 
presente nesse e-mail, a empresa não poderá aceitar a responsabilidade por 
quaisquer perdas ou danos causados por esse e-mail ou por seus anexos'.*



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

Reply via email to