From fe5f21af9f7f142da9bfaec56487a2426df1df98 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 29 Jul 2019 11:10:25 -0400 Subject: [PATCH] zebra: Fix route replace v4 semantics with new system route When a new system route comes in and we have a pre-existing non-system route we are not deleting the current system route from the linux kernel. Modify the code such that when a route replace is sent to the kernel with a new route as a system route and the old route as a non-system route do a delete of the old route so it is no longer in the kernel. Signed-off-by: Donald Sharp --- zebra/rt_netlink.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index b1d0c1e3a6..95ac68fb90 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1833,6 +1833,19 @@ enum zebra_dplane_result kernel_route_update(struct zebra_dplane_ctx *ctx) if (p->family == AF_INET || v6_rr_semantics) { /* Single 'replace' operation */ cmd = RTM_NEWROUTE; + + /* + * With route replace semantics in place + * for v4 routes and the new route is a system + * route we do not install anything. + * The problem here is that the new system + * route should cause us to withdraw from + * the kernel the old non-system route + */ + if (RSYSTEM_ROUTE(dplane_ctx_get_type(ctx)) && + !RSYSTEM_ROUTE(dplane_ctx_get_old_type(ctx))) + (void)netlink_route_multipath(RTM_DELROUTE, + ctx); } else { /* * So v6 route replace semantics are not in