blob: 35f4637d8e8434d28b9b6086e184d3be32bce300 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001sync zebra routing table with the kernel one when interface is down
2
3Add router to kernel main router table with "ip", then you can see
4a router item in kernel main router table. Also can see this router
5item in zebra router table. If down the interface, this router item
6will be deleted from kernel main router table, but it will not be
7deleted from zebra router table, just set as inactive.
8
9This patch is adopted from [1].
10[1] http://www.gossamer-threads.com/lists/quagga/dev/22609
11
12Upstream-Status: Pending
13
14Signed-of-by: Aws Ismail <aws.ismail@windriver.com>
15Signed-of-by: Roy.Li <rongqing.li@windriver.com>
16
17---
18 zebra/zebra_rib.c | 7 +++++++
19 1 files changed, 7 insertions(+), 0 deletions(-)
20
21diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
22index 154e8d5..63434d0 100644
23--- a/zebra/zebra_rib.c
24+++ b/zebra/zebra_rib.c
25@@ -765,6 +765,9 @@ rib_match_ipv6 (struct in6_addr *addr)
26 #define RIB_SYSTEM_ROUTE(R) \
27 ((R)->type == ZEBRA_ROUTE_KERNEL || (R)->type == ZEBRA_ROUTE_CONNECT)
28
29+#define RIB_KERNEL_ROUTE(R) \
30+ ((R)->type == ZEBRA_ROUTE_KERNEL)
31+
32 /* This function verifies reachability of one given nexthop, which can be
33 * numbered or unnumbered, IPv4 or IPv6. The result is unconditionally stored
34 * in nexthop->flags field. If the 4th parameter, 'set', is non-zero,
35@@ -1135,6 +1138,10 @@ rib_process (struct route_node *rn)
36 redistribute_delete (&rn->p, fib);
37 if (! RIB_SYSTEM_ROUTE (fib))
38 rib_uninstall_kernel (rn, fib);
39+#ifdef GNU_LINUX
40+ else if(RIB_KERNEL_ROUTE (fib) && !if_is_up(if_lookup_by_index(fib->nexthop->ifindex)))
41+ del=fib;
42+#endif
43 UNSET_FLAG (fib->flags, ZEBRA_FLAG_SELECTED);
44
45 /* Set real nexthop. */
46--
471.7.4.1
48