From e7fcb84341f642c9a1d9cc9280b6d172a86fd68f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 17 Nov 2017 11:01:44 -0500 Subject: [PATCH] zebra: V6 does not have route replace semantics The v6 linux kernel netlink code doees not have route replace semantics. So if we are in that situation, do a delete/add to get the correct results. Fixes: #1461 Signed-off-by: Donald Sharp --- zebra/rt_netlink.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index e8333ef0cf..a1ef5ba986 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1605,7 +1605,23 @@ int kernel_route_rib(struct prefix *p, struct prefix *src_p, if (old && !new) return netlink_route_multipath(RTM_DELROUTE, p, src_p, old, 0); - return netlink_route_multipath(RTM_NEWROUTE, p, src_p, new, 1); + if (p->family == AF_INET) + return netlink_route_multipath(RTM_NEWROUTE, p, src_p, new, 1); + + /* + * So v6 route replace semantics are not in the kernel at this + * point as I understand it. + * So let's do a delete than an add. + * In the future once v6 route replace semantics are in + * we can figure out what to do here to allow working + * with old and new kernels. + * + * I'm also intentionally ignoring the failure case + * of the route delete. If that happens yeah we're + * screwed. + */ + netlink_route_multipath(RTM_DELROUTE, p, src_p, old, 0); + return netlink_route_multipath(RTM_NEWROUTE, p, src_p, new, 0); } int kernel_neigh_update(int add, int ifindex, uint32_t addr, char *lla, -- 2.39.5