summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Westphal <renato@openbsd.org>2017-12-19 17:09:03 +0100
committerGitHub <noreply@github.com>2017-12-19 17:09:03 +0100
commitfb6f7c2c2522305ec17a088616a52c2c355c8d26 (patch)
tree20d56aaff071a3c21720a8f4e66315901d07c232
parentMerge pull request #1533 from donaldsharp/REALMS (diff)
parent*: Remove cvs control points (diff)
downloadfrr-fb6f7c2c2522305ec17a088616a52c2c355c8d26.tar.xz
frr-fb6f7c2c2522305ec17a088616a52c2c355c8d26.zip
Merge pull request #1515 from donaldsharp/selected_to_front1
Store selected_fib as a pointer off of rib_dest_t
-rwxr-xr-xconfigure.ac2
-rw-r--r--isisd/dict.h2
-rw-r--r--lib/md5.c4
-rw-r--r--lib/md5.h4
-rw-r--r--lib/zassert.h2
-rw-r--r--ospfd/OSPF-ALIGNMENT.txt2
-rw-r--r--pkgsrc/README.txt2
-rw-r--r--ripd/ripd.conf.sample2
-rw-r--r--ripngd/ripngd.conf.sample2
-rw-r--r--tests/helpers/c/main.c2
-rw-r--r--tests/lib/test_heavy.c2
-rw-r--r--tests/lib/test_heavy_thread.c2
-rw-r--r--tests/lib/test_privs.c2
-rw-r--r--zebra/ipforward_sysctl.c6
-rw-r--r--zebra/rib.h5
-rw-r--r--zebra/zebra.conf.sample2
-rw-r--r--zebra/zebra_fpm.c14
-rw-r--r--zebra/zebra_rib.c137
-rw-r--r--zebra/zebra_static.c8
-rw-r--r--zebra/zebra_vty.c6
20 files changed, 81 insertions, 127 deletions
diff --git a/configure.ac b/configure.ac
index a2606eff8..a3b38559e 100755
--- a/configure.ac
+++ b/configure.ac
@@ -881,6 +881,7 @@ case "$host_os" in
AC_DEFINE(OPEN_BSD,,OpenBSD)
AC_DEFINE(KAME,1,KAME IPv6)
+ AC_DEFINE(BSD_V6_SYSCTL,1,BSD v6 sysctl to turn on and off forwarding)
if test "x${enable_pimd}" != "xno"; then
case "$host_os" in
@@ -897,6 +898,7 @@ case "$host_os" in
AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
AC_DEFINE(KAME,1,KAME IPv6)
+ AC_DEFINE(BSD_V6_SYSCTL,1,BSD v6 sysctl to turn on and off forwarding)
;;
esac
AM_CONDITIONAL(SOLARIS, test "${SOLARIS}" = "solaris")
diff --git a/isisd/dict.h b/isisd/dict.h
index a5ee92231..32683c57d 100644
--- a/isisd/dict.h
+++ b/isisd/dict.h
@@ -14,8 +14,6 @@
* into proprietary software; there is no requirement for such software to
* contain a copyright notice related to this source.
*
- * $Id: dict.h,v 1.3 2005/09/25 12:04:25 hasso Exp $
- * $Name: $
*/
#ifndef DICT_H
diff --git a/lib/md5.c b/lib/md5.c
index cce67d7ec..8989a93c5 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,7 +1,3 @@
-/* $USAGI: md5.c,v 1.2 2000/11/02 11:59:24 yoshfuji Exp $ */
-/* $KAME: md5.c,v 1.2 2000/05/27 07:07:48 jinmei Exp $ */
-/* $Id: md5.c,v 1.6 2006/01/17 23:39:04 vincent Exp $ */
-
/*
* Copyright (C) 2004 6WIND
* <Vincent.Jardin@6WIND.com>
diff --git a/lib/md5.h b/lib/md5.h
index adc92d670..59291c7df 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -1,7 +1,3 @@
-/* $USAGI: md5.h,v 1.2 2000/11/02 11:59:25 yoshfuji Exp $ */
-/* $KAME: md5.h,v 1.4 2000/03/27 04:36:22 sumikawa Exp $ */
-/* $Id: md5.h,v 1.3 2006/01/17 17:40:45 paul Exp $ */
-
/*
* Copyright (C) 2004 6WIND
* <Vincent.Jardin@6WIND.com>
diff --git a/lib/zassert.h b/lib/zassert.h
index 5c06d933e..d45e1be5f 100644
--- a/lib/zassert.h
+++ b/lib/zassert.h
@@ -1,6 +1,4 @@
/*
- * $Id: zassert.h,v 1.2 2004/12/03 18:01:04 ajs Exp $
- *
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
diff --git a/ospfd/OSPF-ALIGNMENT.txt b/ospfd/OSPF-ALIGNMENT.txt
index dac6182fd..905bd228b 100644
--- a/ospfd/OSPF-ALIGNMENT.txt
+++ b/ospfd/OSPF-ALIGNMENT.txt
@@ -1,5 +1,3 @@
-$Id: OSPF-ALIGNMENT.txt,v 1.1 2004/11/17 17:59:52 gdt Exp $
-
Greg Troxel <gdt@ir.bbn.com>
2004-11-17
diff --git a/pkgsrc/README.txt b/pkgsrc/README.txt
index 13ec449a1..b70bb3fc1 100644
--- a/pkgsrc/README.txt
+++ b/pkgsrc/README.txt
@@ -1,5 +1,3 @@
-$Id: README.txt,v 1.1 2004/08/27 15:57:35 gdt Exp $
-
This directory contains files for use with the pkgsrc framework
(http://www.pkgsrc.org) used with NetBSD and other operating systems.
Eventually it will be hooked into automake such that they can be
diff --git a/ripd/ripd.conf.sample b/ripd/ripd.conf.sample
index 2902ff9cc..e11bf0bb2 100644
--- a/ripd/ripd.conf.sample
+++ b/ripd/ripd.conf.sample
@@ -2,8 +2,6 @@
!
! RIPd sample configuration file
!
-! $Id: ripd.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $
-!
hostname ripd
password zebra
!
diff --git a/ripngd/ripngd.conf.sample b/ripngd/ripngd.conf.sample
index ad673e57e..28f08c399 100644
--- a/ripngd/ripngd.conf.sample
+++ b/ripngd/ripngd.conf.sample
@@ -2,8 +2,6 @@
!
! RIPngd sample configuration file
!
-! $Id: ripngd.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $
-!
hostname ripngd
password zebra
!
diff --git a/tests/helpers/c/main.c b/tests/helpers/c/main.c
index 9bf56dde1..fed1d5a53 100644
--- a/tests/helpers/c/main.c
+++ b/tests/helpers/c/main.c
@@ -1,6 +1,4 @@
/*
- * $Id: main.c,v 1.1 2005/04/25 16:42:24 paul Exp $
- *
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
diff --git a/tests/lib/test_heavy.c b/tests/lib/test_heavy.c
index 604a5733c..e2a0a2d49 100644
--- a/tests/lib/test_heavy.c
+++ b/tests/lib/test_heavy.c
@@ -1,6 +1,4 @@
/*
- * $Id: heavy.c,v 1.3 2005/04/25 16:42:24 paul Exp $
- *
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
diff --git a/tests/lib/test_heavy_thread.c b/tests/lib/test_heavy_thread.c
index 9a7578006..075bcb6da 100644
--- a/tests/lib/test_heavy_thread.c
+++ b/tests/lib/test_heavy_thread.c
@@ -1,6 +1,4 @@
/*
- * $Id: heavy-thread.c,v 1.2 2005/04/25 16:42:24 paul Exp $
- *
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
diff --git a/tests/lib/test_privs.c b/tests/lib/test_privs.c
index 1984f28e6..421c34543 100644
--- a/tests/lib/test_privs.c
+++ b/tests/lib/test_privs.c
@@ -1,6 +1,4 @@
/*
- * $Id: test-privs.c,v 1.1 2005/10/11 03:48:28 paul Exp $
- *
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c
index 36212a013..cdf426b9b 100644
--- a/zebra/ipforward_sysctl.c
+++ b/zebra/ipforward_sysctl.c
@@ -87,11 +87,11 @@ int ipforward_off(void)
/* IPv6 forwarding control MIB. */
int mib_ipv6[MIB_SIZ] = {CTL_NET, PF_INET6,
-#if defined(KAME)
+#if defined(BSD_V6_SYSCTL)
IPPROTO_IPV6, IPV6CTL_FORWARDING
-#else /* NOT KAME */
+#else /* NOT BSD_V6_SYSCTL */
IPPROTO_IP, IP6CTL_FORWARDING
-#endif /* KAME */
+#endif /* BSD_V6_SYSCTL */
};
int ipforward_ipv6(void)
diff --git a/zebra/rib.h b/zebra/rib.h
index 7e166f7e1..804372f18 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -85,8 +85,7 @@ struct route_entry {
/* to simplify NHT logic when NHs change, instead of doing a NH by NH cmp */
#define ROUTE_ENTRY_NEXTHOPS_CHANGED 0x2
#define ROUTE_ENTRY_CHANGED 0x4
-#define ROUTE_ENTRY_SELECTED_FIB 0x8
-#define ROUTE_ENTRY_LABELS_CHANGED 0x10
+#define ROUTE_ENTRY_LABELS_CHANGED 0x8
/* Nexthop information. */
u_char nexthop_num;
@@ -122,6 +121,8 @@ typedef struct rib_dest_t_ {
*/
struct route_entry *routes;
+ struct route_entry *selected_fib;
+
/*
* Flags, see below.
*/
diff --git a/zebra/zebra.conf.sample b/zebra/zebra.conf.sample
index a5d0732f6..03042eb08 100644
--- a/zebra/zebra.conf.sample
+++ b/zebra/zebra.conf.sample
@@ -2,8 +2,6 @@
!
! zebra sample configuration file
!
-! $Id: zebra.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $
-!
hostname Router
password zebra
enable password zebra
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 7448292d9..0d0a2cb3b 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -842,19 +842,7 @@ static inline int zfpm_encode_route(rib_dest_t *dest, struct route_entry *re,
*/
struct route_entry *zfpm_route_for_update(rib_dest_t *dest)
{
- struct route_entry *re;
-
- RE_DEST_FOREACH_ROUTE (dest, re) {
- if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
- continue;
-
- return re;
- }
-
- /*
- * We have no route for this destination.
- */
- return NULL;
+ return dest->selected_fib;
}
/*
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 6406386b1..3eaf5597b 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -383,10 +383,11 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
struct prefix p;
struct route_table *table;
struct route_node *rn;
- struct route_entry *match;
+ struct route_entry *match = NULL;
int resolved;
struct nexthop *newhop;
struct interface *ifp;
+ rib_dest_t *dest;
if ((nexthop->type == NEXTHOP_TYPE_IPV4)
|| nexthop->type == NEXTHOP_TYPE_IPV6)
@@ -466,17 +467,12 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
&& !nh_resolve_via_default(p.family))
return 0;
- RNODE_FOREACH_RE (rn, match) {
- if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
- continue;
-
- /* if the next hop is imported from another table, skip
- * it */
- if (match->type == ZEBRA_ROUTE_TABLE)
- continue;
- if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
- break;
- }
+ dest = rib_dest_from_rnode(rn);
+ if (dest && dest->selected_fib &&
+ !CHECK_FLAG(dest->selected_fib->status,
+ ROUTE_ENTRY_REMOVED) &&
+ dest->selected_fib->type != ZEBRA_ROUTE_TABLE)
+ match = dest->selected_fib;
/* If there is no selected route or matched route is EGP, go up
tree. */
@@ -553,7 +549,7 @@ struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id,
struct prefix p;
struct route_table *table;
struct route_node *rn;
- struct route_entry *match;
+ struct route_entry *match = NULL;
struct nexthop *newhop;
/* Lookup table. */
@@ -574,15 +570,14 @@ struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id,
rn = route_node_match(table, (struct prefix *)&p);
while (rn) {
+ rib_dest_t *dest;
+
route_unlock_node(rn);
- /* Pick up selected route. */
- RNODE_FOREACH_RE (rn, match) {
- if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
- continue;
- if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
- break;
- }
+ dest = rib_dest_from_rnode(rn);
+ if (dest && dest->selected_fib &&
+ !CHECK_FLAG(dest->selected_fib->status, ROUTE_ENTRY_REMOVED))
+ match = dest->selected_fib;
/* If there is no selected route or matched route is EGP, go up
tree. */
@@ -689,8 +684,9 @@ struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, vrf_id_t vrf_id)
{
struct route_table *table;
struct route_node *rn;
- struct route_entry *match;
+ struct route_entry *match = NULL;
struct nexthop *nexthop;
+ rib_dest_t *dest;
/* Lookup table. */
table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id);
@@ -705,13 +701,11 @@ struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* Unlock node. */
route_unlock_node(rn);
+ dest = rib_dest_from_rnode(rn);
- RNODE_FOREACH_RE (rn, match) {
- if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
- continue;
- if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
- break;
- }
+ if (dest && dest->selected_fib &&
+ !CHECK_FLAG(dest->selected_fib->status, ROUTE_ENTRY_REMOVED))
+ match = dest->selected_fib;
if (!match)
return NULL;
@@ -743,9 +737,10 @@ int rib_lookup_ipv4_route(struct prefix_ipv4 *p, union sockunion *qgate,
{
struct route_table *table;
struct route_node *rn;
- struct route_entry *match;
+ struct route_entry *match = NULL;
struct nexthop *nexthop;
int nexthops_active;
+ rib_dest_t *dest;
/* Lookup table. */
table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id);
@@ -761,15 +756,13 @@ int rib_lookup_ipv4_route(struct prefix_ipv4 *p, union sockunion *qgate,
/* Unlock node. */
route_unlock_node(rn);
+ dest = rib_dest_from_rnode(rn);
/* Find out if a "selected" RR for the discovered RIB entry exists ever.
*/
- RNODE_FOREACH_RE (rn, match) {
- if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
- continue;
- if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
- break;
- }
+ if (dest && dest->selected_fib &&
+ !CHECK_FLAG(dest->selected_fib->status, ROUTE_ENTRY_REMOVED))
+ match = dest->selected_fib;
/* None such found :( */
if (!match)
@@ -1115,8 +1108,9 @@ void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
static void rib_uninstall(struct route_node *rn, struct route_entry *re)
{
rib_table_info_t *info = srcdest_rnode_table_info(rn);
+ rib_dest_t *dest = rib_dest_from_rnode(rn);
- if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB)) {
+ if (dest && dest->selected_fib == re) {
if (info->safi == SAFI_UNICAST)
hook_call(rib_update, rn, "rib_uninstall");
@@ -1127,7 +1121,7 @@ static void rib_uninstall(struct route_node *rn, struct route_entry *re)
if (zebra_rib_labeled_unicast(re))
zebra_mpls_lsp_uninstall(info->zvrf, rn, re);
- UNSET_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB);
+ dest->selected_fib = NULL;
}
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)) {
@@ -1201,6 +1195,8 @@ int rib_gc_dest(struct route_node *rn)
static void rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
struct route_entry *new)
{
+ rib_dest_t *dest = rib_dest_from_rnode(rn);
+
hook_call(rib_update, rn, "new route selected");
/* Update real nexthop. This may actually determine if nexthop is active
@@ -1210,7 +1206,7 @@ static void rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
return;
}
- SET_FLAG(new->status, ROUTE_ENTRY_SELECTED_FIB);
+ dest->selected_fib = new;
if (IS_ZEBRA_DEBUG_RIB) {
char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf));
@@ -1231,6 +1227,7 @@ static void rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
static void rib_process_del_fib(struct zebra_vrf *zvrf, struct route_node *rn,
struct route_entry *old)
{
+ rib_dest_t *dest = rib_dest_from_rnode(rn);
hook_call(rib_update, rn, "removing existing route");
/* Uninstall from kernel. */
@@ -1248,7 +1245,7 @@ static void rib_process_del_fib(struct zebra_vrf *zvrf, struct route_node *rn,
if (!RIB_SYSTEM_ROUTE(old))
rib_uninstall_kernel(rn, old);
- UNSET_FLAG(old->status, ROUTE_ENTRY_SELECTED_FIB);
+ dest->selected_fib = NULL;
/* Update nexthop for route, reset changed flag. */
nexthop_active_update(rn, old, 1);
@@ -1263,6 +1260,7 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
struct nexthop *nexthop = NULL;
int nh_active = 0;
int installed = 1;
+ rib_dest_t *dest = rib_dest_from_rnode(rn);
/*
* We have to install or update if a new route has been selected or
@@ -1329,7 +1327,7 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
/* Update for redistribution. */
if (installed)
- SET_FLAG(new->status, ROUTE_ENTRY_SELECTED_FIB);
+ dest->selected_fib = new;
}
/*
@@ -1364,7 +1362,7 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
if (!RIB_SYSTEM_ROUTE(old))
rib_uninstall_kernel(rn, old);
- UNSET_FLAG(new->status, ROUTE_ENTRY_SELECTED_FIB);
+ dest->selected_fib = NULL;
}
} else {
/*
@@ -1392,8 +1390,6 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf,
/* Update prior route. */
if (new != old) {
- UNSET_FLAG(old->status, ROUTE_ENTRY_SELECTED_FIB);
-
/* Set real nexthop. */
nexthop_active_update(rn, old, 1);
UNSET_FLAG(old->status, ROUTE_ENTRY_CHANGED);
@@ -1475,6 +1471,8 @@ static void rib_process(struct route_node *rn)
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug("%u:%s: Processing rn %p", vrf_id, buf, rn);
+ old_fib = dest->selected_fib;
+
RNODE_FOREACH_RE_SAFE (rn, re, next) {
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug(
@@ -1490,11 +1488,6 @@ static void rib_process(struct route_node *rn)
assert(old_selected == NULL);
old_selected = re;
}
- /* Currently in fib */
- if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB)) {
- assert(old_fib == NULL);
- old_fib = re;
- }
/* Skip deleted entries from selection */
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
@@ -2183,8 +2176,8 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
{
struct route_table *table;
struct route_node *rn;
- struct route_entry *re;
unsigned changed = 0;
+ rib_dest_t *dest;
if (NULL == (table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id))) {
zlog_err("%s: zebra_vrf_table() returned NULL", __func__);
@@ -2198,6 +2191,7 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* Unlock node. */
route_unlock_node(rn);
+ dest = rib_dest_from_rnode(rn);
/* Check all RE entries. In case any changes have to be done, requeue
* the RN into RIBQ head. If the routing message about the new connected
* route (generated by the IP address we are going to assign very soon)
@@ -2206,20 +2200,17 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
* revalidation
* of the rest of the RE.
*/
- RNODE_FOREACH_RE (rn, re) {
- if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB)
- && !RIB_SYSTEM_ROUTE(re)) {
- changed = 1;
- if (IS_ZEBRA_DEBUG_RIB) {
- char buf[PREFIX_STRLEN];
- zlog_debug(
- "%u:%s: freeing way for connected prefix",
- re->vrf_id,
- prefix2str(&rn->p, buf, sizeof(buf)));
- route_entry_dump(&rn->p, NULL, re);
- }
- rib_uninstall(rn, re);
+ if (dest->selected_fib && !RIB_SYSTEM_ROUTE(dest->selected_fib)) {
+ changed = 1;
+ if (IS_ZEBRA_DEBUG_RIB) {
+ char buf[PREFIX_STRLEN];
+
+ zlog_debug("%u:%s: freeing way for connected prefix",
+ dest->selected_fib->vrf_id,
+ prefix2str(&rn->p, buf, sizeof(buf)));
+ route_entry_dump(&rn->p, NULL, dest->selected_fib);
}
+ rib_uninstall(rn, dest->selected_fib);
}
if (changed)
rib_queue_add(rn);
@@ -2325,6 +2316,7 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
struct route_entry *same = NULL;
struct nexthop *rtnh;
char buf2[INET6_ADDRSTRLEN];
+ rib_dest_t *dest;
assert(!src_p || afi == AFI_IP6);
@@ -2357,14 +2349,14 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
return;
}
+ dest = rib_dest_from_rnode(rn);
+ fib = dest->selected_fib;
+
/* Lookup same type route. */
RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
- fib = re;
-
if (re->type != type)
continue;
if (re->instance != instance)
@@ -2427,8 +2419,7 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
UNSET_FLAG(rtnh->flags,
NEXTHOP_FLAG_FIB);
- UNSET_FLAG(fib->status,
- ROUTE_ENTRY_SELECTED_FIB);
+ dest->selected_fib = NULL;
} else {
/* This means someone else, other than Zebra,
* has deleted
@@ -2741,24 +2732,24 @@ void rib_close_table(struct route_table *table)
{
struct route_node *rn;
rib_table_info_t *info;
- struct route_entry *re;
+ rib_dest_t *dest;
if (!table)
return;
info = table->info;
- for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE (rn, re) {
- if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
- continue;
+ for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) {
+ dest = rib_dest_from_rnode(rn);
+ if (dest && dest->selected_fib) {
if (info->safi == SAFI_UNICAST)
hook_call(rib_update, rn, NULL);
- if (!RIB_SYSTEM_ROUTE(re))
- rib_uninstall_kernel(rn, re);
+ if (!RIB_SYSTEM_ROUTE(dest->selected_fib))
+ rib_uninstall_kernel(rn, dest->selected_fib);
}
+ }
}
/* Routing information base initialize. */
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index 5927ba9d7..751ea08a3 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -331,11 +331,12 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p,
}
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB)) {
+ rib_dest_t *dest = rib_dest_from_rnode(rn);
+
/* If there are other active nexthops, do an update. */
if (re->nexthop_active_num > 1) {
/* Update route in kernel if it's in fib */
- if (CHECK_FLAG(re->status,
- ROUTE_ENTRY_SELECTED_FIB))
+ if (dest->selected_fib)
rib_install_kernel(rn, re, re);
/* Update redistribution if it's selected */
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
@@ -350,8 +351,7 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p,
p, (struct prefix *)src_p, re);
/* Remove from kernel if fib route becomes
* inactive */
- if (CHECK_FLAG(re->status,
- ROUTE_ENTRY_SELECTED_FIB))
+ if (dest->selected_fib)
rib_uninstall_kernel(rn, re);
}
}
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 9dab3f946..ccd0c703d 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -968,6 +968,7 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
u_short ospf_instance_id)
{
struct route_table *table;
+ rib_dest_t *dest;
struct route_node *rn;
struct route_entry *re;
int first = 1;
@@ -1005,10 +1006,11 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
/* Show all routes. */
for (rn = route_top(table); rn; rn = route_next(rn)) {
+ dest = rib_dest_from_rnode(rn);
+
RNODE_FOREACH_RE (rn, re) {
if (use_fib
- && !CHECK_FLAG(re->status,
- ROUTE_ENTRY_SELECTED_FIB))
+ && re != dest->selected_fib)
continue;
if (tag && re->tag != tag)