Old kernels do not support netlink dump filtering. Moreover, the OVS
route_table_dump_one_table() function doesn't pass the "filtered"
argument to the handle_route_msg() callback. In order to fix the
problem, always check the table_id is the expected one in
handle_route_msg callback.

Reported-at: https://issues.redhat.com/browse/FDP-1613
Signed-off-by: Lorenzo Bianconi <lorenzo.bianc...@redhat.com>
---
 controller/route-exchange-netlink.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/controller/route-exchange-netlink.c 
b/controller/route-exchange-netlink.c
index d786e44d6..cec4b1ec3 100644
--- a/controller/route-exchange-netlink.c
+++ b/controller/route-exchange-netlink.c
@@ -201,6 +201,7 @@ struct route_msg_handle_data {
     struct hmapx *routes_to_advertise;
     struct vector *learned_routes;
     const struct hmap *routes;
+    uint32_t table_id; /* requested table id. */
     int ret;
 };
 
@@ -212,6 +213,13 @@ handle_route_msg(const struct route_table_msg *msg, void 
*data)
     struct advertise_route_entry *ar;
     int err;
 
+    if (handle_data->table_id != rd->rta_table_id) {
+        /* We do not have the NLM_F_DUMP_FILTERED info here, so check if the
+         * reported table_id matches the requested one.
+         */
+        return;
+    }
+
     /* This route is not from us, so we learn it. */
     if (rd->rtm_protocol != RTPROT_OVN) {
         if (!handle_data->learned_routes) {
@@ -293,6 +301,7 @@ re_nl_sync_routes(uint32_t table_id, const struct hmap 
*routes,
         .routes_to_advertise = &routes_to_advertise,
         .learned_routes = learned_routes,
         .db = db,
+        .table_id = table_id,
     };
     route_table_dump_one_table(table_id, handle_route_msg, &data);
     ret = data.ret;
@@ -333,6 +342,7 @@ re_nl_cleanup_routes(uint32_t table_id)
     struct route_msg_handle_data data = {
         .routes_to_advertise = NULL,
         .learned_routes = NULL,
+        .table_id = table_id,
     };
     route_table_dump_one_table(table_id, handle_route_msg, &data);
 
-- 
2.50.1

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

Reply via email to