In case we want to replace route with the same destination but just different nexthop we need to remove the stale ones first otherwise the first loop would return that the route already exists and it would be created the second loop.
Signed-off-by: Ales Musil <[email protected]> --- controller/route-exchange-netlink.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/controller/route-exchange-netlink.c b/controller/route-exchange-netlink.c index ed9224a1c..272beae1b 100644 --- a/controller/route-exchange-netlink.c +++ b/controller/route-exchange-netlink.c @@ -300,7 +300,6 @@ re_nl_sync_routes(uint32_t table_id, const struct hmap *routes, struct hmapx routes_to_advertise = HMAPX_INITIALIZER(&routes_to_advertise); struct vector stale_routes = VECTOR_EMPTY_INITIALIZER(struct route_data); struct advertise_route_entry *ar; - int ret = 0; HMAP_FOR_EACH (ar, node, routes) { hmapx_add(&routes_to_advertise, ar); @@ -319,6 +318,8 @@ re_nl_sync_routes(uint32_t table_id, const struct hmap *routes, }; route_table_dump_one_table(table_id, handle_route_msg, &data); + int ret = re_nl_delete_stale_routes(&stale_routes); + /* Add any remaining routes in the routes_to_advertise hmapx to the * system routing table. */ struct hmapx_node *hn; @@ -342,11 +343,6 @@ re_nl_sync_routes(uint32_t table_id, const struct hmap *routes, } } - int err = re_nl_delete_stale_routes(&stale_routes); - if (!ret) { - ret = err; - } - hmapx_destroy(&routes_to_advertise); vector_destroy(&stale_routes); -- 2.51.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
