When there is invalid table_id being set for vrf the ovn-controller
would be woken up immediately to retry. However, this is not
a recoverable error that could be fixed by retry. Make sure we
don't loop and retry again once the table_id has changed.

Fixes: faf4df563f1d ("controller: Announce routes via route-exchange.")
Reported-at: https://issues.redhat.com/browse/FDP-1879
Signed-off-by: Ales Musil <[email protected]>
---
v2: Unify the condition with duplicate table id.
    Add include to more appropriate place.
---
 controller/route-exchange-netlink.c | 7 -------
 controller/route-exchange-netlink.h | 8 ++++++++
 controller/route-exchange.c         | 8 +++++---
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/controller/route-exchange-netlink.c 
b/controller/route-exchange-netlink.c
index 91f059492..bc1488018 100644
--- a/controller/route-exchange-netlink.c
+++ b/controller/route-exchange-netlink.c
@@ -19,7 +19,6 @@
 
 #include <errno.h>
 #include <inttypes.h>
-#include <linux/rtnetlink.h>
 #include <net/if.h>
 #include <netinet/in.h>
 
@@ -38,12 +37,6 @@
 VLOG_DEFINE_THIS_MODULE(route_exchange_netlink);
 
 #define NETNL_REQ_BUFFER_SIZE 128
-#define TABLE_ID_VALID(table_id) (table_id != RT_TABLE_UNSPEC &&              \
-                                  table_id != RT_TABLE_COMPAT &&              \
-                                  table_id != RT_TABLE_DEFAULT &&             \
-                                  table_id != RT_TABLE_MAIN &&                \
-                                  table_id != RT_TABLE_LOCAL &&               \
-                                  table_id != RT_TABLE_MAX)
 
 int
 re_nl_create_vrf(const char *ifname, uint32_t table_id)
diff --git a/controller/route-exchange-netlink.h 
b/controller/route-exchange-netlink.h
index c9fce692b..1741f761d 100644
--- a/controller/route-exchange-netlink.h
+++ b/controller/route-exchange-netlink.h
@@ -19,6 +19,7 @@
 #define ROUTE_EXCHANGE_NETLINK_H 1
 
 #include <stdint.h>
+#include <linux/rtnetlink.h>
 #include <netinet/in.h>
 #include <net/if.h>
 
@@ -28,6 +29,13 @@
 #define RTPROT_OVN 84
 #endif
 
+#define TABLE_ID_VALID(table_id) (table_id != RT_TABLE_UNSPEC &&              \
+                                  table_id != RT_TABLE_COMPAT &&              \
+                                  table_id != RT_TABLE_DEFAULT &&             \
+                                  table_id != RT_TABLE_MAIN &&                \
+                                  table_id != RT_TABLE_LOCAL &&               \
+                                  table_id != RT_TABLE_MAX)
+
 struct in6_addr;
 struct hmap;
 struct vector;
diff --git a/controller/route-exchange.c b/controller/route-exchange.c
index 829d1b73f..d8deae1da 100644
--- a/controller/route-exchange.c
+++ b/controller/route-exchange.c
@@ -245,10 +245,12 @@ route_exchange_run(const struct route_exchange_ctx_in 
*r_ctx_in,
     HMAP_FOR_EACH (ad, node, r_ctx_in->announce_routes) {
         uint32_t table_id = route_get_table_id(ad->db);
 
-        if (!ovn_add_tnlid(&table_ids, table_id)) {
+        bool valid = TABLE_ID_VALID(table_id);
+        if (!valid || !ovn_add_tnlid(&table_ids, table_id)) {
             VLOG_WARN_RL(&rl, "Unable to sync routes for datapath "UUID_FMT": "
-                         "duplicate table id: %"PRIu32,
-                         UUID_ARGS(&ad->db->header_.uuid), table_id);
+                         "%s table id: %"PRIu32,
+                         UUID_ARGS(&ad->db->header_.uuid),
+                         !valid ? "invalid" : "duplicate", table_id);
             continue;
         }
 
-- 
2.51.0

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

Reply via email to