diff options
author | Vyacheslav Trushkin <me@dogonthesun.net> | 2011-12-11 15:48:47 +0100 |
---|---|---|
committer | Denis Ovsienko <infrastation@yandex.ru> | 2012-01-02 15:37:24 +0100 |
commit | 2ea1ab1c30c765cd4703794fcfaf044454fb533c (patch) | |
tree | 650e97a5a9e8cc1fb8666ff6ce87647df3e0e604 /zebra/zebra_rib.c | |
parent | lib: fix type-punning in ip_masklen() (diff) | |
download | frr-2ea1ab1c30c765cd4703794fcfaf044454fb533c.tar.xz frr-2ea1ab1c30c765cd4703794fcfaf044454fb533c.zip |
zebra: ZEBRA_HELLO and mopping up routes (BZ#448)
ZEBRA_HELLO message is used by routing daemons to inform zebra
what type of routes daemon will be announcing to zebra. Also
zebra uses route_type_oaths array to track which daemon announces
which protocol. Zebra mops up routes if daemon didn't for some
reason.
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r-- | zebra/zebra_rib.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 8228350f0..726338957 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2881,7 +2881,41 @@ rib_sweep_route (void) rib_sweep_table (vrf_table (AFI_IP, SAFI_UNICAST, 0)); rib_sweep_table (vrf_table (AFI_IP6, SAFI_UNICAST, 0)); } - + +/* Remove specific by protocol routes from 'table'. */ +static unsigned long +rib_score_proto_table (u_char proto, struct route_table *table) +{ + struct route_node *rn; + struct rib *rib; + struct rib *next; + unsigned long n = 0; + + if (table) + for (rn = route_top (table); rn; rn = route_next (rn)) + for (rib = rn->info; rib; rib = next) + { + next = rib->next; + if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED)) + continue; + if (rib->type == proto) + { + rib_delnode (rn, rib); + n++; + } + } + + return n; +} + +/* Remove specific by protocol routes. */ +unsigned long +rib_score_proto (u_char proto) +{ + return rib_score_proto_table (proto, vrf_table (AFI_IP, SAFI_UNICAST, 0)) + +rib_score_proto_table (proto, vrf_table (AFI_IP6, SAFI_UNICAST, 0)); +} + /* Close RIB and clean up kernel routes. */ static void rib_close_table (struct route_table *table) |