There can be endge cases where an advertised_route has a tracked_port
field but the local IDL has not yet loaded the corresponding logical
port.
Once that issue resolves we need to trigger a recompute of the route
node so that tracked_ports_local and tracked_ports_remote can be fixed.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2025-May/423309.html
Reported-by: Ales Musil <[email protected]>
Fixes: 7a7f727e2f6d ("ovn-controller: Update handlers for route changes.")
Signed-off-by: Felix Huettner <[email protected]>
---
 controller/ovn-controller.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 89207bb4b..10c7ffa26 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -5260,9 +5260,9 @@ route_sb_advertised_route_data_handler(struct engine_node 
*node, void *data)
      *    datapath locally.
      *
      * Updates to advertised_route can generally be ignored as northd will not
-     * update these entries. We also get update notifications if a referenced
-     * port_binding is updated, but these are handled in the runtime_data
-     * handler. */
+     * update these entries. For exceptions see below.
+     * We also get update notifications if a referenced port_binding is
+     * updated, but these are handled in the runtime_data handler. */
     const struct sbrec_advertised_route *sbrec_route;
     SBREC_ADVERTISED_ROUTE_TABLE_FOR_EACH_TRACKED (sbrec_route,
                                                    advertised_route_table) {
@@ -5279,6 +5279,20 @@ route_sb_advertised_route_data_handler(struct 
engine_node *node, void *data)
              * request recompute. */
             return EN_UNHANDLED;
         }
+
+        if (sbrec_route->tracked_port) {
+            const char *name = sbrec_route->tracked_port->logical_port;
+            if (!(sset_contains(&re_data->tracked_ports_local, name) ||
+                 sset_contains(&re_data->tracked_ports_remote, name))) {
+                /* Advertised_Routes are generally not changed by northd.
+                 * However if we did not monitor for the Port_Binding
+                 * referenced by tracked_port previously then it would have
+                 * been NULL. If we notice that we have now loaded the
+                 * Port_Binding we need to recompute to correctly update
+                 * the route priority. */
+                return EN_UNHANDLED;
+            }
+        }
     }
     return EN_HANDLED_UNCHANGED;
 }

base-commit: a5b1478282b6afce4169be250d66d23d74f7064d
-- 
2.43.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to