From 949ae9ba1531be3629da0b5be47ff4dae763baa0 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Fri, 16 Dec 2016 10:48:37 -0200 Subject: zebra: fix FIB route updates on *BSD On *BSD, we update a route in the FIB by removing the old one and then installing the new version. With that said, on kernel_route_rib() we need to provide a pointer to both the old version and the new version of the route. We were, however, passing a pointer to the new version to both the 'old' and 'new' parameters. This is not a problem on Linux, which uses NLM_F_REPLACE to update routes, but it breaks route updates on *BSD because the 'old' parameter points to a route that is not installed in the kernel. The kernel_route_rib() function then fails to uninstall the supposedly 'old' route and can fail to install the new version as well if the kernel doesn't support ECMP (e.g. FreeBSD with default configuration). Signed-off-by: Renato Westphal --- zebra/zebra_static.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'zebra/zebra_static.c') diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index a7a68bd0de..5894a8955b 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -322,7 +322,7 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p, struct static_ { /* Update route in kernel if it's in fib */ if (CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - rib_install_kernel (rn, rib, 1); + rib_install_kernel (rn, rib, rib); /* Update redistribution if it's selected */ if (CHECK_FLAG(rib->flags, ZEBRA_FLAG_SELECTED)) redistribute_update (&rn->p, rib, NULL); -- cgit v1.2.3 From 45cc0c76a71a288b64603a60148962f689c042a0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 29 Dec 2016 07:01:05 +0000 Subject: zebra: check route flags when deciding whether to update existing route Signed-off-by: Quentin Young --- zebra/zebra_static.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'zebra/zebra_static.c') diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index e6ae9c71d4..200a55a7ec 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -401,7 +401,8 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p, && (! ifindex || ifindex == si->ifindex)) { if ((distance == si->distance) && (tag == si->tag) && - !memcmp (&si->snh_label, snh_label, sizeof (struct static_nh_label))) + !memcmp (&si->snh_label, snh_label, sizeof (struct static_nh_label)) && + si->flags == flags) { route_unlock_node (rn); return 0; -- cgit v1.2.3