summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-10-11 19:04:05 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-10-17 23:01:10 +0200
commit212df1de28ae2a21145389c01cc3a1952f95c1a8 (patch)
tree828026473e6a93a23f3bf4bcea59cc3344d1e520 /zebra/zebra_rib.c
parentb9ea4083854503850a18950206e7285f5266d5ea (diff)
zebra: remove kernel routes that are suppressed
on some cases, kernel routes are not selected, because the kernel suppressed it without informing the netlink layer that the route has been suppressed ( for instance, when an interface goes down, the route never goes back when interface goes up again). This commit intends to suppress that entry from zebra. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 4c35b1003f..f47081d302 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -867,6 +867,9 @@ int rib_lookup_ipv4_route(struct prefix_ipv4 *p, union sockunion *qgate,
#define RIB_SYSTEM_ROUTE(R) \
((R)->type == ZEBRA_ROUTE_KERNEL || (R)->type == ZEBRA_ROUTE_CONNECT)
+#define RIB_KERNEL_ROUTE(R) \
+ ((R)->type == ZEBRA_ROUTE_KERNEL)
+
/* This function verifies reachability of one given nexthop, which can be
* numbered or unnumbered, IPv4 or IPv6. The result is unconditionally stored
* in nexthop->flags field. If the 4th parameter, 'set', is non-zero,
@@ -1397,8 +1400,11 @@ static void rib_process_del_fib(struct zebra_vrf *zvrf, struct route_node *rn,
}
/* Update nexthop for route, reset changed flag. */
- nexthop_active_update(rn, old, 1);
- UNSET_FLAG(old->status, ROUTE_ENTRY_CHANGED);
+ if (!nexthop_active_update(rn, old, 1) &&
+ (RIB_KERNEL_ROUTE(old)))
+ SET_FLAG(old->status, ROUTE_ENTRY_REMOVED);
+ else
+ UNSET_FLAG(old->status, ROUTE_ENTRY_CHANGED);
}
static void rib_process_update_fib(struct zebra_vrf *zvrf,