From: Donald Sharp Date: Fri, 17 Nov 2017 16:01:44 +0000 (-0500) Subject: zebra: V6 does not have route replace semantics X-Git-Tag: frr-4.0-dev~135^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e7fcb84341f642c9a1d9cc9280b6d172a86fd68f;p=matthieu%2Ffrr.git 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 --- 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,