summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-06-01 13:26:25 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-06-01 14:00:05 +0200
commitf0f77c9a590bf538033602a0b2da6084c9ea22e2 (patch)
tree80113c30accb622589bcd67ef25fdda17fba0189 /zebra
parentMerge pull request #634 from dwalton76/bgp-ipv6-nexthop-ll-and-global-takeII (diff)
downloadfrr-f0f77c9a590bf538033602a0b2da6084c9ea22e2.tar.xz
frr-f0f77c9a590bf538033602a0b2da6084c9ea22e2.zip
zebra: Refactor 'struct rib' to be 'struct route_entry'
The 'struct rib' data structure is missnamed. It really is a 'struct route_entry' as part of the 'struct route_node'. We have 1 'struct route_entry' per route src. As such 1 route node can have multiple route entries if multiple protocols attempt to install the same route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/kernel_null.c2
-rw-r--r--zebra/redistribute.c168
-rw-r--r--zebra/redistribute.h8
-rw-r--r--zebra/redistribute_null.c8
-rw-r--r--zebra/rib.h103
-rw-r--r--zebra/rt.h2
-rw-r--r--zebra/rt_netlink.c76
-rw-r--r--zebra/rt_socket.c32
-rw-r--r--zebra/zebra_fpm.c28
-rw-r--r--zebra/zebra_fpm_dt.c30
-rw-r--r--zebra/zebra_fpm_netlink.c24
-rw-r--r--zebra/zebra_fpm_private.h6
-rw-r--r--zebra/zebra_fpm_protobuf.c28
-rw-r--r--zebra/zebra_memory.c2
-rw-r--r--zebra/zebra_memory.h2
-rw-r--r--zebra/zebra_mpls.c62
-rw-r--r--zebra/zebra_mpls.h8
-rw-r--r--zebra/zebra_rib.c800
-rw-r--r--zebra/zebra_rnh.c162
-rw-r--r--zebra/zebra_rnh.h2
-rw-r--r--zebra/zebra_routemap.c16
-rw-r--r--zebra/zebra_routemap.h2
-rw-r--r--zebra/zebra_snmp.c68
-rw-r--r--zebra/zebra_static.c114
-rw-r--r--zebra/zebra_vrf.c6
-rw-r--r--zebra/zebra_vty.c206
-rw-r--r--zebra/zserv.c166
-rw-r--r--zebra/zserv.h2
28 files changed, 1059 insertions, 1074 deletions
diff --git a/zebra/kernel_null.c b/zebra/kernel_null.c
index ad96ce41c..5f1a054bd 100644
--- a/zebra/kernel_null.c
+++ b/zebra/kernel_null.c
@@ -31,7 +31,7 @@
#include "zebra/rib.h"
int kernel_route_rib (struct prefix *a, struct prefix *b,
- struct rib *old, struct rib *new) { return 0; }
+ struct route_entry *old, struct route_entry *new) { return 0; }
int kernel_address_add_ipv4 (struct interface *a, struct connected *b)
{
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index 1493bd9cb..9f63aeb4e 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -79,7 +79,7 @@ zebra_redistribute_default (struct zserv *client, vrf_id_t vrf_id)
struct prefix p;
struct route_table *table;
struct route_node *rn;
- struct rib *newrib;
+ struct route_entry *newre;
for (afi = AFI_IP; afi <= AFI_IP6; afi++)
{
@@ -95,10 +95,10 @@ zebra_redistribute_default (struct zserv *client, vrf_id_t vrf_id)
if (! rn)
continue;
- RNODE_FOREACH_RIB (rn, newrib)
- if (CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED)
- && newrib->distance != DISTANCE_INFINITY)
- zsend_redistribute_route (1, client, &rn->p, NULL, newrib);
+ RNODE_FOREACH_RE (rn, newre)
+ if (CHECK_FLAG (newre->flags, ZEBRA_FLAG_SELECTED)
+ && newre->distance != DISTANCE_INFINITY)
+ zsend_redistribute_route (1, client, &rn->p, NULL, newre);
route_unlock_node (rn);
}
@@ -108,7 +108,7 @@ zebra_redistribute_default (struct zserv *client, vrf_id_t vrf_id)
static void
zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id, int afi)
{
- struct rib *newrib;
+ struct route_entry *newre;
struct route_table *table;
struct route_node *rn;
@@ -117,7 +117,7 @@ zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t v
return;
for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, newrib)
+ RNODE_FOREACH_RE (rn, newre)
{
struct prefix *dst_p, *src_p;
srcdest_rnode_prefixes(rn, &dst_p, &src_p);
@@ -125,21 +125,21 @@ zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t v
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, "
"zebra_check_addr=%d", __func__,
- CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED),
- newrib->type, newrib->distance,
+ CHECK_FLAG (newre->flags, ZEBRA_FLAG_SELECTED),
+ newre->type, newre->distance,
zebra_check_addr (dst_p));
- if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED))
+ if (! CHECK_FLAG (newre->flags, ZEBRA_FLAG_SELECTED))
continue;
if ((type != ZEBRA_ROUTE_ALL &&
- (newrib->type != type || newrib->instance != instance)))
+ (newre->type != type || newre->instance != instance)))
continue;
- if (newrib->distance == DISTANCE_INFINITY)
+ if (newre->distance == DISTANCE_INFINITY)
continue;
if (! zebra_check_addr (dst_p))
continue;
- zsend_redistribute_route (1, client, dst_p, src_p, newrib);
+ zsend_redistribute_route (1, client, dst_p, src_p, newre);
}
}
@@ -147,7 +147,7 @@ zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t v
/* withdraw redistribution if add cannot be done for client */
void
redistribute_update (struct prefix *p, struct prefix *src_p,
- struct rib *rib, struct rib *prev_rib)
+ struct route_entry *re, struct route_entry *prev_re)
{
struct listnode *node, *nnode;
struct zserv *client;
@@ -158,9 +158,9 @@ redistribute_update (struct prefix *p, struct prefix *src_p,
if (IS_ZEBRA_DEBUG_RIB)
{
inet_ntop (p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN);
- zlog_debug ("%u:%s/%d: Redist update rib %p (type %d), old %p (type %d)",
- rib->vrf_id, buf, p->prefixlen, rib, rib->type,
- prev_rib, prev_rib ? prev_rib->type : -1);
+ zlog_debug ("%u:%s/%d: Redist update re %p (type %d), old %p (type %d)",
+ re->vrf_id, buf, p->prefixlen, re, re->type,
+ prev_re, prev_re ? prev_re->type : -1);
}
afi = family2afi(p->family);
@@ -174,33 +174,33 @@ redistribute_update (struct prefix *p, struct prefix *src_p,
{
send_redistribute = 0;
- if (is_default (p) && vrf_bitmap_check (client->redist_default, rib->vrf_id))
+ if (is_default (p) && vrf_bitmap_check (client->redist_default, re->vrf_id))
send_redistribute = 1;
- else if (vrf_bitmap_check (client->redist[afi][ZEBRA_ROUTE_ALL], rib->vrf_id))
+ else if (vrf_bitmap_check (client->redist[afi][ZEBRA_ROUTE_ALL], re->vrf_id))
send_redistribute = 1;
- else if (rib->instance && redist_check_instance (&client->mi_redist[afi][rib->type],
- rib->instance))
+ else if (re->instance && redist_check_instance (&client->mi_redist[afi][re->type],
+ re->instance))
send_redistribute = 1;
- else if (vrf_bitmap_check (client->redist[afi][rib->type], rib->vrf_id))
+ else if (vrf_bitmap_check (client->redist[afi][re->type], re->vrf_id))
send_redistribute = 1;
if (send_redistribute)
{
- zsend_redistribute_route (1, client, p, src_p, rib);
+ zsend_redistribute_route (1, client, p, src_p, re);
}
- else if (prev_rib &&
- ((rib->instance &&
- redist_check_instance(&client->mi_redist[afi][prev_rib->type],
- rib->instance)) ||
- vrf_bitmap_check (client->redist[afi][prev_rib->type], rib->vrf_id)))
+ else if (prev_re &&
+ ((re->instance &&
+ redist_check_instance(&client->mi_redist[afi][prev_re->type],
+ re->instance)) ||
+ vrf_bitmap_check (client->redist[afi][prev_re->type], re->vrf_id)))
{
- zsend_redistribute_route (0, client, p, src_p, prev_rib);
+ zsend_redistribute_route (0, client, p, src_p, prev_re);
}
}
}
void
-redistribute_delete (struct prefix *p, struct prefix *src_p, struct rib *rib)
+redistribute_delete (struct prefix *p, struct prefix *src_p, struct route_entry *re)
{
struct listnode *node, *nnode;
struct zserv *client;
@@ -210,12 +210,12 @@ redistribute_delete (struct prefix *p, struct prefix *src_p, struct rib *rib)
if (IS_ZEBRA_DEBUG_RIB)
{
inet_ntop (p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN);
- zlog_debug ("%u:%s/%d: Redist delete rib %p (type %d)",
- rib->vrf_id, buf, p->prefixlen, rib, rib->type);
+ zlog_debug ("%u:%s/%d: Redist delete re %p (type %d)",
+ re->vrf_id, buf, p->prefixlen, re, re->type);
}
/* Add DISTANCE_INFINITY check. */
- if (rib->distance == DISTANCE_INFINITY)
+ if (re->distance == DISTANCE_INFINITY)
return;
afi = family2afi(p->family);
@@ -228,14 +228,14 @@ redistribute_delete (struct prefix *p, struct prefix *src_p, struct rib *rib)
for (ALL_LIST_ELEMENTS (zebrad.client_list, node, nnode, client))
{
if ((is_default (p) &&
- vrf_bitmap_check (client->redist_default, rib->vrf_id)) ||
- vrf_bitmap_check (client->redist[afi][ZEBRA_ROUTE_ALL], rib->vrf_id) ||
- (rib->instance &&
- redist_check_instance(&client->mi_redist[afi][rib->type],
- rib->instance)) ||
- vrf_bitmap_check (client->redist[afi][rib->type], rib->vrf_id))
+ vrf_bitmap_check (client->redist_default, re->vrf_id)) ||
+ vrf_bitmap_check (client->redist[afi][ZEBRA_ROUTE_ALL], re->vrf_id) ||
+ (re->instance &&
+ redist_check_instance(&client->mi_redist[afi][re->type],
+ re->instance)) ||
+ vrf_bitmap_check (client->redist[afi][re->type], re->vrf_id))
{
- zsend_redistribute_route (0, client, p, src_p, rib);
+ zsend_redistribute_route (0, client, p, src_p, re);
}
}
}
@@ -490,18 +490,18 @@ zebra_interface_vrf_update_add (struct interface *ifp, vrf_id_t old_vrf_id)
}
int
-zebra_add_import_table_entry (struct route_node *rn, struct rib *rib, const char *rmap_name)
+zebra_add_import_table_entry (struct route_node *rn, struct route_entry *re, const char *rmap_name)
{
- struct rib *newrib;
- struct rib *same;
+ struct route_entry *newre;
+ struct route_entry *same;
struct prefix p;
struct nexthop *nhop;
union g_addr *gate;
route_map_result_t ret = RMAP_MATCH;
if (rmap_name)
- ret = zebra_import_table_route_map_check (AFI_IP, rib->type, &rn->p, rib->nexthop, rib->vrf_id,
- rib->tag, rmap_name);
+ ret = zebra_import_table_route_map_check (AFI_IP, re->type, &rn->p, re->nexthop, re->vrf_id,
+ re->tag, rmap_name);
if (ret == RMAP_MATCH)
{
@@ -511,13 +511,13 @@ zebra_add_import_table_entry (struct route_node *rn, struct rib *rib, const char
p.prefixlen = rn->p.prefixlen;
p.u.prefix4 = rn->p.u.prefix4;
- RNODE_FOREACH_RIB (rn, same)
+ RNODE_FOREACH_RE (rn, same)
{
- if (CHECK_FLAG (same->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (same->status, ROUTE_ENTRY_REMOVED))
continue;
- if (same->type == rib->type && same->instance == rib->instance
- && same->table == rib->table
+ if (same->type == re->type && same->instance == re->instance
+ && same->table == re->table
&& same->type != ZEBRA_ROUTE_CONNECT)
break;
}
@@ -526,51 +526,51 @@ zebra_add_import_table_entry (struct route_node *rn, struct rib *rib, const char
zebra_del_import_table_entry (rn, same);
- if (rib->nexthop_num == 1)
+ if (re->nexthop_num == 1)
{
- nhop = rib->nexthop;
+ nhop = re->nexthop;
if (nhop->type == NEXTHOP_TYPE_IFINDEX)
gate = NULL;
else
gate = (union g_addr *)&nhop->gate.ipv4;
- rib_add (AFI_IP, SAFI_UNICAST, rib->vrf_id, ZEBRA_ROUTE_TABLE,
- rib->table, 0, &p, NULL, gate, (union g_addr *)&nhop->src.ipv4,
+ rib_add (AFI_IP, SAFI_UNICAST, re->vrf_id, ZEBRA_ROUTE_TABLE,
+ re->table, 0, &p, NULL, gate, (union g_addr *)&nhop->src.ipv4,
nhop->ifindex, zebrad.rtm_table_default,
- rib->metric, rib->mtu,
- zebra_import_table_distance[AFI_IP][rib->table]);
+ re->metric, re->mtu,
+ zebra_import_table_distance[AFI_IP][re->table]);
}
- else if (rib->nexthop_num > 1)
+ else if (re->nexthop_num > 1)
{
- newrib = XCALLOC (MTYPE_RIB, sizeof (struct rib));
- newrib->type = ZEBRA_ROUTE_TABLE;
- newrib->distance = zebra_import_table_distance[AFI_IP][rib->table];
- newrib->flags = rib->flags;
- newrib->metric = rib->metric;
- newrib->mtu = rib->mtu;
- newrib->table = zebrad.rtm_table_default;
- newrib->nexthop_num = 0;
- newrib->uptime = time(NULL);
- newrib->instance = rib->table;
+ newre = XCALLOC (MTYPE_RE, sizeof (struct route_entry));
+ newre->type = ZEBRA_ROUTE_TABLE;
+ newre->distance = zebra_import_table_distance[AFI_IP][re->table];
+ newre->flags = re->flags;
+ newre->metric = re->metric;
+ newre->mtu = re->mtu;
+ newre->table = zebrad.rtm_table_default;
+ newre->nexthop_num = 0;
+ newre->uptime = time(NULL);
+ newre->instance = re->table;
/* Assuming these routes are never recursive */
- for (nhop = rib->nexthop; nhop; nhop = nhop->next)
- rib_copy_nexthops(newrib, nhop);
+ for (nhop = re->nexthop; nhop; nhop = nhop->next)
+ route_entry_copy_nexthops(newre, nhop);
- rib_add_multipath(AFI_IP, SAFI_UNICAST, &p, NULL, newrib);
+ rib_add_multipath(AFI_IP, SAFI_UNICAST, &p, NULL, newre);
}
}
}
else
{
- zebra_del_import_table_entry (rn, rib);
+ zebra_del_import_table_entry (rn, re);
}
/* DD: Add IPv6 code */
return 0;
}
int
-zebra_del_import_table_entry (struct route_node *rn, struct rib *rib)
+zebra_del_import_table_entry (struct route_node *rn, struct route_entry *re)
{
struct prefix p;
@@ -580,8 +580,8 @@ zebra_del_import_table_entry (struct route_node *rn, struct rib *rib)
p.prefixlen = rn->p.prefixlen;
p.u.prefix4 = rn->p.u.prefix4;
- rib_delete (AFI_IP, SAFI_UNICAST, rib->vrf_id, ZEBRA_ROUTE_TABLE,
- rib->table, rib->flags, &p, NULL, NULL,
+ rib_delete (AFI_IP, SAFI_UNICAST, re->vrf_id, ZEBRA_ROUTE_TABLE,
+ re->table, re->flags, &p, NULL, NULL,
0, zebrad.rtm_table_default);
}
/* DD: Add IPv6 code */
@@ -594,7 +594,7 @@ int
zebra_import_table (afi_t afi, u_int32_t table_id, u_int32_t distance, const char *rmap_name, int add)
{
struct route_table *table;
- struct rib *rib;
+ struct route_entry *re;
struct route_node *rn;
if (!is_zebra_valid_kernel_table(table_id) ||
@@ -647,23 +647,23 @@ zebra_import_table (afi_t afi, u_int32_t table_id, u_int32_t distance, const cha
if (!rn->info)
continue;
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
break;
}
- if (!rib)
+ if (!re)
continue;
if (((afi == AFI_IP) && (rn->p.family == AF_INET)) ||
((afi == AFI_IP6) && (rn->p.family == AF_INET6)))
{
if (add)
- zebra_add_import_table_entry (rn, rib, rmap_name);
+ zebra_add_import_table_entry (rn, re, rmap_name);
else
- zebra_del_import_table_entry (rn, rib);
+ zebra_del_import_table_entry (rn, re);
}
}
return 0;
@@ -713,7 +713,7 @@ zebra_import_table_rm_update ()
afi_t afi;
int i;
struct route_table *table;
- struct rib *rib;
+ struct route_entry *re;
struct route_node *rn;
const char *rmap_name;
@@ -736,19 +736,19 @@ zebra_import_table_rm_update ()
if (!rn->info)
continue;
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
break;
}
- if (!rib)
+ if (!re)
continue;
if (((afi == AFI_IP) && (rn->p.family == AF_INET)) ||
((afi == AFI_IP6) && (rn->p.family == AF_INET6)))
- zebra_add_import_table_entry (rn, rib, rmap_name);
+ zebra_add_import_table_entry (rn, re, rmap_name);
}
}
}
diff --git a/zebra/redistribute.h b/zebra/redistribute.h
index 8a7857498..429ec1bfd 100644
--- a/zebra/redistribute.h
+++ b/zebra/redistribute.h
@@ -36,8 +36,8 @@ extern void zebra_redistribute_default_delete (int, struct zserv *, int,
struct zebra_vrf *zvrf);
extern void redistribute_update (struct prefix *, struct prefix *,
- struct rib *, struct rib *);
-extern void redistribute_delete (struct prefix *, struct prefix *, struct rib *);
+ struct route_entry *, struct route_entry *);
+extern void redistribute_delete (struct prefix *, struct prefix *, struct route_entry *);
extern void zebra_interface_up_update (struct interface *);
extern void zebra_interface_down_update (struct interface *);
@@ -57,9 +57,9 @@ extern int zebra_import_table (afi_t afi, u_int32_t table_id,
u_int32_t distance, const char *rmap_name, int add);
extern int zebra_add_import_table_entry (struct route_node *rn,
- struct rib *rib, const char *rmap_name);
+ struct route_entry *re, const char *rmap_name);
extern int zebra_del_import_table_entry (struct route_node *rn,
- struct rib *rib);
+ struct route_entry *re);
extern int is_zebra_import_table_enabled(afi_t, u_int32_t table_id);
extern int zebra_import_table_config(struct vty *);
diff --git a/zebra/redistribute_null.c b/zebra/redistribute_null.c
index 7f40c2178..3b83a6b6a 100644
--- a/zebra/redistribute_null.c
+++ b/zebra/redistribute_null.c
@@ -39,9 +39,9 @@ void zebra_redistribute_default_delete (int a, struct zserv *b, int c,
{ return; }
void redistribute_update (struct prefix *a, struct prefix *b,
- struct rib *c, struct rib *d)
+ struct route_entry *c, struct route_entry *d)
{ return; }
-void redistribute_delete (struct prefix *a, struct prefix *b, struct rib *c)
+void redistribute_delete (struct prefix *a, struct prefix *b, struct route_entry *c)
{ return; }
void zebra_interface_up_update (struct interface *a)
@@ -75,10 +75,10 @@ int zebra_import_table (afi_t afi, u_int32_t table_id, u_int32_t distance,
const char *rmap_name, int add)
{ return 0; }
-int zebra_add_import_table_entry (struct route_node *rn, struct rib *rib, const char *rmap_name)
+int zebra_add_import_table_entry (struct route_node *rn, struct route_entry *re, const char *rmap_name)
{ return 0; }
-int zebra_del_import_table_entry (struct route_node *rn, struct rib *rib)
+int zebra_del_import_table_entry (struct route_node *rn, struct route_entry *re)
{ return 0; }
int is_zebra_import_table_enabled(afi_t afi, u_int32_t table_id)
diff --git a/zebra/rib.h b/zebra/rib.h
index 7bcbf56bd..3f4fb81f6 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -37,11 +37,11 @@
#define DISTANCE_INFINITY 255
#define ZEBRA_KERNEL_TABLE_MAX 252 /* support for no more than this rt tables */
-struct rib
+struct route_entry
{
/* Link list. */
- struct rib *next;
- struct rib *prev;
+ struct route_entry *next;
+ struct route_entry *prev;
/* Nexthop structure */
struct nexthop *nexthop;
@@ -85,11 +85,11 @@ struct rib
/* RIB internal status */
u_char status;
-#define RIB_ENTRY_REMOVED 0x1
+#define ROUTE_ENTRY_REMOVED 0x1
/* to simplify NHT logic when NHs change, instead of doing a NH by NH cmp */
-#define RIB_ENTRY_NEXTHOPS_CHANGED 0x2
-#define RIB_ENTRY_CHANGED 0x4
-#define RIB_ENTRY_SELECTED_FIB 0x8
+#define ROUTE_ENTRY_NEXTHOPS_CHANGED 0x2
+#define ROUTE_ENTRY_CHANGED 0x4
+#define ROUTE_ENTRY_SELECTED_FIB 0x8
/* Nexthop information. */
u_char nexthop_num;
@@ -125,7 +125,7 @@ typedef struct rib_dest_t_
/*
* Doubly-linked list of routes for this prefix.
*/
- struct rib *routes;
+ struct route_entry *routes;
/*
* Flags, see below.
@@ -161,22 +161,22 @@ typedef struct rib_dest_t_
/*
* Macro to iterate over each route for a destination (prefix).
*/
-#define RIB_DEST_FOREACH_ROUTE(dest, rib) \
- for ((rib) = (dest) ? (dest)->routes : NULL; (rib); (rib) = (rib)->next)
+#define RE_DEST_FOREACH_ROUTE(dest, re) \
+ for ((re) = (dest) ? (dest)->routes : NULL; (re); (re) = (re)->next)
/*
* Same as above, but allows the current node to be unlinked.
*/
-#define RIB_DEST_FOREACH_ROUTE_SAFE(dest, rib, next) \
- for ((rib) = (dest) ? (dest)->routes : NULL; \
- (rib) && ((next) = (rib)->next, 1); \
- (rib) = (next))
+#define RE_DEST_FOREACH_ROUTE_SAFE(dest, re, next) \
+ for ((re) = (dest) ? (dest)->routes : NULL; \
+ (re) && ((next) = (re)->next, 1); \
+ (re) = (next))
-#define RNODE_FOREACH_RIB(rn, rib) \
- RIB_DEST_FOREACH_ROUTE (rib_dest_from_rnode (rn), rib)
+#define RNODE_FOREACH_RE(rn, re) \
+ RE_DEST_FOREACH_ROUTE (rib_dest_from_rnode (rn), re)
-#define RNODE_FOREACH_RIB_SAFE(rn, rib, next) \
- RIB_DEST_FOREACH_ROUTE_SAFE (rib_dest_from_rnode (rn), rib, next)
+#define RNODE_FOREACH_RE_SAFE(rn, re, next) \
+ RE_DEST_FOREACH_ROUTE_SAFE (rib_dest_from_rnode (rn), re, next)
/* The following for loop allows to iterate over the nexthop
* structure of routes.
@@ -283,17 +283,28 @@ typedef enum
RIB_UPDATE_OTHER
} rib_update_event_t;
-extern struct nexthop *rib_nexthop_ifindex_add (struct rib *, ifindex_t);
-extern struct nexthop *rib_nexthop_blackhole_add (struct rib *);
-extern struct nexthop *rib_nexthop_ipv4_add (struct rib *, struct in_addr *,
- struct in_addr *);
-extern struct nexthop *rib_nexthop_ipv4_ifindex_add (struct rib *,
- struct in_addr *,
- struct in_addr *,
- ifindex_t);
-extern void rib_nexthop_add (struct rib *rib, struct nexthop *nexthop);
-extern void rib_copy_nexthops (struct rib *rib, struct nexthop *nh);
-
+extern struct nexthop *route_entry_nexthop_ifindex_add (struct route_entry *, ifindex_t);
+extern struct nexthop *route_entry_nexthop_blackhole_add (struct route_entry *);
+extern struct nexthop *route_entry_nexthop_ipv4_add (struct route_entry *,
+ struct in_addr *,
+ struct in_addr *);
+extern struct nexthop *route_entry_nexthop_ipv4_ifindex_add (struct route_entry *,
+ struct in_addr *,
+ struct in_addr *,
+ ifindex_t);
+extern void route_entry_nexthop_delete (struct route_entry *re, struct nexthop *nexthop);
+extern struct nexthop *route_entry_nexthop_ipv6_add (struct route_entry *,
+ struct in6_addr *);
+extern struct nexthop *route_entry_nexthop_ipv6_ifindex_add (struct route_entry *re,
+ struct in6_addr *ipv6,
+ ifindex_t ifindex);
+extern void route_entry_nexthop_add (struct route_entry *re, struct nexthop *nexthop);
+extern void route_entry_copy_nexthops (struct route_entry *re, struct nexthop *nh);
+
+#define route_entry_dump(prefix, src, re) _route_entry_dump(__func__, prefix, src, re)
+extern void _route_entry_dump (const char *,
+ union prefixconstptr,
+ union prefixconstptr, const struct route_entry *);
/* RPF lookup behaviour */
enum multicast_mode
{
@@ -309,13 +320,9 @@ enum multicast_mode
extern void multicast_mode_ipv4_set (enum multicast_mode mode);
extern enum multicast_mode multicast_mode_ipv4_get (void);
-extern int nexthop_has_fib_child(struct nexthop *);
extern void rib_lookup_and_dump (struct prefix_ipv4 *, vrf_id_t);
extern void rib_lookup_and_pushup (struct prefix_ipv4 *, vrf_id_t);
-#define rib_dump(prefix, src, rib) _rib_dump(__func__, prefix, src, rib)
-extern void _rib_dump (const char *,
- union prefixconstptr,
- union prefixconstptr, const struct rib *);
+
extern int rib_lookup_ipv4_route (struct prefix_ipv4 *, union sockunion *,
vrf_id_t);
#define ZEBRA_RIB_LOOKUP_ERROR -1
@@ -324,20 +331,16 @@ extern int rib_lookup_ipv4_route (struct prefix_ipv4 *, union sockunion *,
#define ZEBRA_RIB_FOUND_CONNECTED 2
#define ZEBRA_RIB_NOTFOUND 3
-extern void rib_nexthop_delete (struct rib *rib, struct nexthop *nexthop);
-extern struct nexthop *rib_nexthop_ipv6_add (struct rib *, struct in6_addr *);
-extern struct nexthop *rib_nexthop_ipv6_ifindex_add (struct rib *rib,
- struct in6_addr *ipv6,
- ifindex_t ifindex);
+
extern int is_zebra_valid_kernel_table(u_int32_t table_id);
extern int is_zebra_main_routing_table(u_int32_t table_id);
extern int zebra_check_addr (struct prefix *p);
-extern void rib_addnode (struct route_node *rn, struct rib *rib, int process);
-extern void rib_delnode (struct route_node *rn, struct rib *rib);
-extern int rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old);
-extern int rib_uninstall_kernel (struct route_node *rn, struct rib *rib);
+extern void rib_addnode (struct route_node *rn, struct route_entry *re, int process);
+extern void rib_delnode (struct route_node *rn, struct route_entry *re);
+extern int rib_install_kernel (struct route_node *rn, struct route_entry *re, struct route_entry *old);
+extern int rib_uninstall_kernel (struct route_node *rn, struct route_entry *re);
/* NOTE:
* All rib_add function will not just add prefix into RIB, but
@@ -349,19 +352,19 @@ extern int rib_add (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
u_int32_t, u_int32_t, u_char);
extern int rib_add_multipath (afi_t afi, safi_t safi, struct prefix *,
- struct prefix_ipv6 *src_p, struct rib *);
+ struct prefix_ipv6 *src_p, struct route_entry *);
extern void rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
u_short instance, int flags, struct prefix *p,
struct prefix_ipv6 *src_p, union g_addr *gate,
ifindex_t ifindex, u_int32_t table_id);
-extern struct rib *rib_match (afi_t afi, safi_t safi, vrf_id_t, union g_addr *,
+extern struct route_entry *rib_match (afi_t afi, safi_t safi, vrf_id_t, union g_addr *,
struct route_node **rn_out);
-extern struct rib *rib_match_ipv4_multicast (vrf_id_t vrf_id, struct in_addr addr,
+extern struct route_entry *rib_match_ipv4_multicast (vrf_id_t vrf_id, struct in_addr addr,
struct route_node **rn_out);
-extern struct rib *rib_lookup_ipv4 (struct prefix_ipv4 *, vrf_id_t);
+extern struct route_entry *rib_lookup_ipv4 (struct prefix_ipv4 *, vrf_id_t);
extern void rib_update (vrf_id_t, rib_update_event_t);
extern void rib_weed_tables (void);
@@ -371,10 +374,10 @@ extern void rib_init (void);
extern unsigned long rib_score_proto (u_char proto, u_short instance);
extern void rib_queue_add (struct route_node *rn);
extern void meta_queue_free (struct meta_queue *mq);
-extern int zebra_rib_labeled_unicast (struct rib *rib);
+extern int zebra_rib_labeled_unicast (struct route_entry *re);
extern struct route_table *rib_table_ipv6;
-extern void rib_unlink (struct route_node *, struct rib *);
+extern void rib_unlink (struct route_node *, struct route_entry *);
extern int rib_gc_dest (struct route_node *rn);
extern struct route_table *rib_tables_iter_next (rib_tables_iter_t *iter);
@@ -408,7 +411,7 @@ rib_dest_from_rnode (struct route_node *rn)
* Returns a pointer to the list of routes corresponding to the given
* route_node.
*/
-static inline struct rib *
+static inline struct route_entry *
rnode_to_ribs (struct route_node *rn)
{
rib_dest_t *dest;
diff --git a/zebra/rt.h b/zebra/rt.h
index 5f2441a9c..a39af87b5 100644
--- a/zebra/rt.h
+++ b/zebra/rt.h
@@ -29,7 +29,7 @@
#include "zebra/zebra_mpls.h"
extern int kernel_route_rib (struct prefix *, struct prefix *,
- struct rib *, struct rib *);
+ struct route_entry *, struct route_entry *);
extern int kernel_address_add_ipv4 (struct interface *, struct connected *);
extern int kernel_address_delete_ipv4 (struct interface *, struct connected *);
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index f22f4acb0..88cdfbcae 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -342,22 +342,22 @@ netlink_route_change_read_unicast (struct sockaddr_nl *snl, struct nlmsghdr *h,
{
/* This is a multipath route */
- struct rib *rib;
+ struct route_entry *re;
struct rtnexthop *rtnh =
(struct rtnexthop *) RTA_DATA (tb[RTA_MULTIPATH]);
len = RTA_PAYLOAD (tb[RTA_MULTIPATH]);
- rib = XCALLOC (MTYPE_RIB, sizeof (struct rib));
- rib->type = ZEBRA_ROUTE_KERNEL;
- rib->distance = 0;
- rib->flags = flags;
- rib->metric = metric;
- rib->mtu = mtu;
- rib->vrf_id = vrf_id;
- rib->table = table;
- rib->nexthop_num = 0;
- rib->uptime = time (NULL);
+ re = XCALLOC (MTYPE_RE, sizeof (struct route_entry));
+ re->type = ZEBRA_ROUTE_KERNEL;
+ re->distance = 0;
+ re->flags = flags;
+ re->metric = metric;
+ re->mtu = mtu;
+ re->vrf_id = vrf_id;
+ re->table = table;
+ re->nexthop_num = 0;
+ re->uptime = time (NULL);
for (;;)
{
@@ -380,31 +380,31 @@ netlink_route_change_read_unicast (struct sockaddr_nl *snl, struct nlmsghdr *h,
if (rtm->rtm_family == AF_INET)
{
if (index)
- rib_nexthop_ipv4_ifindex_add (rib, gate, prefsrc, index);
+ route_entry_nexthop_ipv4_ifindex_add (re, gate, prefsrc, index);
else
- rib_nexthop_ipv4_add (rib, gate, prefsrc);
+ route_entry_nexthop_ipv4_add (re, gate, prefsrc);
}
else if (rtm->rtm_family == AF_INET6)
{
if (index)
- rib_nexthop_ipv6_ifindex_add (rib, gate, index);
+ route_entry_nexthop_ipv6_ifindex_add (re, gate, index);
else
- rib_nexthop_ipv6_add (rib,gate);
+ route_entry_nexthop_ipv6_add (re,gate);
}
}
else
- rib_nexthop_ifindex_add (rib, index);
+ route_entry_nexthop_ifindex_add (re, index);
len -= NLMSG_ALIGN(rtnh->rtnh_len);
rtnh = RTNH_NEXT(rtnh);
}
zserv_nexthop_num_warn(__func__, (const struct prefix *)&p,
- rib->nexthop_num);
- if (rib->nexthop_num == 0)
- XFREE (MTYPE_RIB, rib);
+ re->nexthop_num);
+ if (re->nexthop_num == 0)
+ XFREE (MTYPE_RE, re);
else
- rib_add_multipath (AFI_IP, SAFI_UNICAST, &p, NULL, rib);
+ rib_add_multipath (AFI_IP, SAFI_UNICAST, &p, NULL, re);
}
}
else
@@ -1168,7 +1168,7 @@ netlink_neigh_update (int cmd, int ifindex, uint32_t addr, char *lla, int llalen
/* Update flag indicates whether this is a "replace" or not. */
static int
netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
- struct rib *rib, int update)
+ struct route_entry *re, int update)
{
int bytelen;
struct sockaddr_nl snl;
@@ -1189,7 +1189,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
} req;
struct zebra_ns *zns = zebra_ns_lookup (NS_DEFAULT);
- struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id);
+ struct zebra_vrf *zvrf = vrf_info_lookup (re->vrf_id);
memset (&req, 0, sizeof req - NL_PKT_BUF_SIZE);
@@ -1203,10 +1203,10 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
req.r.rtm_family = family;
req.r.rtm_dst_len = p->prefixlen;
req.r.rtm_src_len = src_p ? src_p->prefixlen : 0;
- req.r.rtm_protocol = get_rt_proto(rib->type);
+ req.r.rtm_protocol = get_rt_proto(re->type);
req.r.rtm_scope = RT_SCOPE_UNIVERSE;
- if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT))
+ if ((re->flags & ZEBRA_FLAG_BLACKHOLE) || (re->flags & ZEBRA_FLAG_REJECT))
discard = 1;
else
discard = 0;
@@ -1215,9 +1215,9 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
{
if (discard)
{
- if (rib->flags & ZEBRA_FLAG_BLACKHOLE)
+ if (re->flags & ZEBRA_FLAG_BLACKHOLE)
req.r.rtm_type = RTN_BLACKHOLE;
- else if (rib->flags & ZEBRA_FLAG_REJECT)
+ else if (re->flags & ZEBRA_FLAG_REJECT)
req.r.rtm_type = RTN_UNREACHABLE;
else
assert (RTN_BLACKHOLE != RTN_UNREACHABLE); /* false */
@@ -1238,21 +1238,21 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
addattr32 (&req.n, sizeof req, RTA_PRIORITY, NL_DEFAULT_ROUTE_METRIC);
/* Table corresponding to this route. */
- if (rib->table < 256)
- req.r.rtm_table = rib->table;
+ if (re->table < 256)
+ req.r.rtm_table = re->table;
else
{
req.r.rtm_table = RT_TABLE_UNSPEC;
- addattr32(&req.n, sizeof req, RTA_TABLE, rib->table);
+ addattr32(&req.n, sizeof req, RTA_TABLE, re->table);
}
- if (rib->mtu || rib->nexthop_mtu)
+ if (re->mtu || re->nexthop_mtu)
{
char buf[NL_PKT_BUF_SIZE];
struct rtattr *rta = (void *) buf;
- u_int32_t mtu = rib->mtu;
- if (!mtu || (rib->nexthop_mtu && rib->nexthop_mtu < mtu))
- mtu = rib->nexthop_mtu;
+ u_int32_t mtu = re->mtu;
+ if (!mtu || (re->nexthop_mtu && re->nexthop_mtu < mtu))
+ mtu = re->nexthop_mtu;
rta->rta_type = RTA_METRICS;
rta->rta_len = RTA_LENGTH(0);
rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTAX_MTU, &mtu, sizeof mtu);
@@ -1263,7 +1263,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
if (discard)
{
if (cmd == RTM_NEWROUTE)
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
/* We shouldn't encounter recursive nexthops on discard routes,
* but it is probably better to handle that case correctly anyway.
@@ -1277,7 +1277,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
/* Count overall nexthops so we can decide whether to use singlepath
* or multipath case. */
nexthop_num = 0;
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
continue;
@@ -1293,7 +1293,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
if (nexthop_num == 1 || multipath_num == 1)
{
nexthop_num = 0;
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
{
@@ -1364,7 +1364,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct prefix *src_p,
rtnh = RTA_DATA (rta);
nexthop_num = 0;
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
if (nexthop_num >= multipath_num)
break;
@@ -1497,7 +1497,7 @@ kernel_get_ipmr_sg_stats (void *in)
int
kernel_route_rib (struct prefix *p, struct prefix *src_p,
- struct rib *old, struct rib *new)
+ struct route_entry *old, struct route_entry *new)
{
if (!old && new)
return netlink_route_multipath (RTM_NEWROUTE, p, src_p, new, 0);
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c
index 3e4833016..ee706a1e8 100644
--- a/zebra/rt_socket.c
+++ b/zebra/rt_socket.c
@@ -71,7 +71,7 @@ sin_masklen (struct in_addr mask)
/* Interface between zebra message and rtm message. */
static int
-kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib)
+kernel_rtm_ipv4 (int cmd, struct prefix *p, struct route_entry *re)
{
struct sockaddr_in *mask = NULL;
@@ -106,7 +106,7 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib)
#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
/* Make gateway. */
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
continue;
@@ -172,16 +172,16 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib)
gate ? (union sockunion *)&sin_gate : NULL,
smplsp,
ifindex,
- rib->flags,
- rib->metric);
+ re->flags,
+ re->metric);
if (IS_ZEBRA_DEBUG_RIB)
{
if (!gate)
{
- zlog_debug ("%s: %s: attention! gate not found for rib %p",
- __func__, prefix_buf, rib);
- rib_dump (p, NULL, rib);
+ zlog_debug ("%s: %s: attention! gate not found for re %p",
+ __func__, prefix_buf, re);
+ route_entry_dump (p, NULL, re);
}
else
inet_ntop (AF_INET, &sin_gate.sin_addr, gate_buf, INET_ADDRSTRLEN);
@@ -230,7 +230,7 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib)
/* If there was no useful nexthop, then complain. */
if (nexthop_num == 0 && IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug ("%s: No useful nexthops were found in RIB entry %p", __func__, rib);
+ zlog_debug ("%s: No useful nexthops were found in RIB entry %p", __func__, re);
return 0; /*XXX*/
}
@@ -262,7 +262,7 @@ sin6_masklen (struct in6_addr mask)
/* Interface between zebra message and rtm message. */
static int
-kernel_rtm_ipv6 (int cmd, struct prefix *p, struct rib *rib)
+kernel_rtm_ipv6 (int cmd, struct prefix *p, struct route_entry *re)
{
struct sockaddr_in6 *mask;
struct sockaddr_in6 sin_dest, sin_mask, sin_gate;
@@ -289,7 +289,7 @@ kernel_rtm_ipv6 (int cmd, struct prefix *p, struct rib *rib)
#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
/* Make gateway. */
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
continue;
@@ -349,8 +349,8 @@ kernel_rtm_ipv6 (int cmd, struct prefix *p, struct rib *rib)
gate ? (union sockunion *)&sin_gate : NULL,
NULL,
ifindex,
- rib->flags,
- rib->metric);
+ re->flags,
+ re->metric);
#if 0
if (error)
@@ -377,21 +377,21 @@ kernel_rtm_ipv6 (int cmd, struct prefix *p, struct rib *rib)
}
static int
-kernel_rtm (int cmd, struct prefix *p, struct rib *rib)
+kernel_rtm (int cmd, struct prefix *p, struct route_entry *re)
{
switch (PREFIX_FAMILY(p))
{
case AF_INET:
- return kernel_rtm_ipv4 (cmd, p, rib);
+ return kernel_rtm_ipv4 (cmd, p, re);
case AF_INET6:
- return kernel_rtm_ipv6 (cmd, p, rib);
+ return kernel_rtm_ipv6 (cmd, p, re);
}
return 0;
}
int
kernel_route_rib (struct prefix *p, struct prefix *src_p,
- struct rib *old, struct rib *new)
+ struct route_entry *old, struct route_entry *new)
{
int route = 0;
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 2a23ff102..37068c1fa 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -866,7 +866,7 @@ zfpm_writes_pending (void)
* value indicates an error.
*/
static inline int
-zfpm_encode_route (rib_dest_t *dest, struct rib *rib, char *in_buf,
+zfpm_encode_route (rib_dest_t *dest, struct route_entry *re, char *in_buf,
size_t in_buf_len, fpm_msg_type_e *msg_type)
{
size_t len;
@@ -881,7 +881,7 @@ zfpm_encode_route (rib_dest_t *dest, struct rib *rib, char *in_buf,
case ZFPM_MSG_FORMAT_PROTOBUF:
#ifdef HAVE_PROTOBUF
- len = zfpm_protobuf_encode_route (dest, rib, (uint8_t *) in_buf,
+ len = zfpm_protobuf_encode_route (dest, re, (uint8_t *) in_buf,
in_buf_len);
*msg_type = FPM_MSG_TYPE_PROTOBUF;
#endif
@@ -890,8 +890,8 @@ zfpm_encode_route (rib_dest_t *dest, struct rib *rib, char *in_buf,
case ZFPM_MSG_FORMAT_NETLINK:
#ifdef HAVE_NETLINK
*msg_type = FPM_MSG_TYPE_NETLINK;
- cmd = rib ? RTM_NEWROUTE : RTM_DELROUTE;
- len = zfpm_netlink_encode_route (cmd, dest, rib, in_buf, in_buf_len);
+ cmd = re ? RTM_NEWROUTE : RTM_DELROUTE;
+ len = zfpm_netlink_encode_route (cmd, dest, re, in_buf, in_buf_len);
assert(fpm_msg_align(len) == len);
*msg_type = FPM_MSG_TYPE_NETLINK;
#endif /* HAVE_NETLINK */
@@ -908,19 +908,19 @@ zfpm_encode_route (rib_dest_t *dest, struct rib *rib, char *in_buf,
/*
* zfpm_route_for_update
*
- * Returns the rib that is to be sent to the FPM for a given dest.
+ * Returns the re that is to be sent to the FPM for a given dest.
*/
-struct rib *
+struct route_entry *
zfpm_route_for_update (rib_dest_t *dest)
{
- struct rib *rib;
+ struct route_entry *re;
- RIB_DEST_FOREACH_ROUTE (dest, rib)
+ RE_DEST_FOREACH_ROUTE (dest, re)
{
- if (!CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
+ if (!CHECK_FLAG (re->status, ROUTE_ENTRY_SELECTED_FIB))
continue;
- return rib;
+ return re;
}
/*
@@ -944,7 +944,7 @@ zfpm_build_updates (void)
size_t msg_len;
size_t data_len;
fpm_msg_hdr_t *hdr;
- struct rib *rib;
+ struct route_entry *re;
int is_add, write_msg;
fpm_msg_type_e msg_type;
@@ -974,8 +974,8 @@ zfpm_build_updates (void)
data = fpm_msg_data (hdr);
- rib = zfpm_route_for_update (dest);
- is_add = rib ? 1 : 0;
+ re = zfpm_route_for_update (dest);
+ is_add = re ? 1 : 0;
write_msg = 1;
@@ -990,7 +990,7 @@ zfpm_build_updates (void)
}
if (write_msg) {
- data_len = zfpm_encode_route (dest, rib, (char *) data, buf_end - data,
+ data_len = zfpm_encode_route (dest, re, (char *) data, buf_end - data,
&msg_type);
assert (data_len);
diff --git a/zebra/zebra_fpm_dt.c b/zebra/zebra_fpm_dt.c
index db28b6f0e..916640928 100644
--- a/zebra/zebra_fpm_dt.c
+++ b/zebra/zebra_fpm_dt.c
@@ -67,13 +67,13 @@ extern int zfpm_dt_benchmark_protobuf_decode (int argc, const char **argv);
* Selects a suitable rib destination for fpm interface tests.
*/
static int
-zfpm_dt_find_route (rib_dest_t **dest_p, struct rib **rib_p)
+zfpm_dt_find_route (rib_dest_t **dest_p, struct route_entry **re_p)
{
struct route_node *rnode;
route_table_iter_t iter;
struct route_table *table;
rib_dest_t *dest;
- struct rib *rib;
+ struct route_entry *re;
int ret;
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
@@ -88,15 +88,15 @@ zfpm_dt_find_route (rib_dest_t **dest_p, struct rib **rib_p)
if (!dest)
continue;
- rib = zfpm_route_for_update(dest);
- if (!rib)
+ re = zfpm_route_for_update(dest);
+ if (!re)
continue;
- if (rib->nexthop_active_num <= 0)
+ if (re->nexthop_active_num <= 0)
continue;
*dest_p = dest;
- *rib_p = rib;
+ *re_p = re;
ret = 1;
goto done;
}
@@ -117,7 +117,7 @@ zfpm_dt_benchmark_netlink_encode (int argc, const char **argv)
{
int times, i, len;
rib_dest_t *dest;
- struct rib *rib;
+ struct route_entry *re;
char buf[4096];
times = 100000;
@@ -125,12 +125,12 @@ zfpm_dt_benchmark_netlink_encode (int argc, const char **argv)
times = atoi(argv[0]);
}
- if (!zfpm_dt_find_route(&dest, &rib)) {
+ if (!zfpm_dt_find_route(&dest, &re)) {
return 1;
}
for (i = 0; i < times; i++) {
- len = zfpm_netlink_encode_route(RTM_NEWROUTE, dest, rib, buf, sizeof(buf));
+ len = zfpm_netlink_encode_route(RTM_NEWROUTE, dest, re, buf, sizeof(buf));
if (len <= 0) {
return 2;
}
@@ -150,7 +150,7 @@ zfpm_dt_benchmark_protobuf_encode (int argc, const char **argv)
{
int times, i, len;
rib_dest_t *dest;
- struct rib *rib;
+ struct route_entry *re;
uint8_t buf[4096];
times = 100000;
@@ -158,12 +158,12 @@ zfpm_dt_benchmark_protobuf_encode (int argc, const char **argv)
times = atoi(argv[0]);
}
- if (!zfpm_dt_find_route(&dest, &rib)) {
+ if (!zfpm_dt_find_route(&dest, &re)) {
return 1;
}
for (i = 0; i < times; i++) {
- len = zfpm_protobuf_encode_route(dest, rib, buf, sizeof(buf));
+ len = zfpm_protobuf_encode_route(dest, re, buf, sizeof(buf));
if (len <= 0) {
return 2;
}
@@ -229,7 +229,7 @@ zfpm_dt_benchmark_protobuf_decode (int argc, const char **argv)
{
int times, i, len;
rib_dest_t *dest;
- struct rib *rib;
+ struct route_entry *re;
uint8_t msg_buf[4096];
QPB_DECLARE_STACK_ALLOCATOR (allocator, 8192);
Fpm__Message *fpm_msg;
@@ -240,13 +240,13 @@ zfpm_dt_benchmark_protobuf_decode (int argc, const char **argv)
if (argc > 0)
times = atoi(argv[0]);
- if (!zfpm_dt_find_route (&dest, &rib))
+ if (!zfpm_dt_find_route (&dest, &re))
return 1;
/*
* Encode the route into the message buffer once only.
*/
- len = zfpm_protobuf_encode_route (dest, rib, msg_buf, sizeof (msg_buf));
+ len = zfpm_protobuf_encode_route (dest, re, msg_buf, sizeof (msg_buf));
if (len <= 0)
return 2;
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c
index 4ca7b5972..c5647debc 100644
--- a/zebra/zebra_fpm_netlink.c
+++ b/zebra/zebra_fpm_netlink.c
@@ -231,7 +231,7 @@ netlink_proto_from_route_type (int type)
*/
static int
netlink_route_info_fill (netlink_route_info_t *ri, int cmd,
- rib_dest_t *dest, struct rib *rib)
+ rib_dest_t *dest, struct route_entry *re)
{
struct nexthop *nexthop, *tnexthop;
int recursing;
@@ -250,18 +250,18 @@ netlink_route_info_fill (netlink_route_info_t *ri, int cmd,
* An RTM_DELROUTE need not be accompanied by any nexthops,
* particularly in our communication with the FPM.
*/
- if (cmd == RTM_DELROUTE && !rib)
+ if (cmd == RTM_DELROUTE && !re)
return 1;
- if (!rib)
+ if (!re)
{
- zfpm_debug ("%s: Expected non-NULL rib pointer", __PRETTY_FUNCTION__);
+ zfpm_debug ("%s: Expected non-NULL re pointer", __PRETTY_FUNCTION__);
return 0;
}
- ri->rtm_protocol = netlink_proto_from_route_type (rib->type);
+ ri->rtm_protocol = netlink_proto_from_route_type (re->type);
- if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT))
+ if ((re->flags & ZEBRA_FLAG_BLACKHOLE) || (re->flags & ZEBRA_FLAG_REJECT))
discard = 1;
else
discard = 0;
@@ -270,9 +270,9 @@ netlink_route_info_fill (netlink_route_info_t *ri, int cmd,
{
if (discard)
{
- if (rib->flags & ZEBRA_FLAG_BLACKHOLE)
+ if (re->flags & ZEBRA_FLAG_BLACKHOLE)
ri->rtm_type = RTN_BLACKHOLE;
- else if (rib->flags & ZEBRA_FLAG_REJECT)
+ else if (re->flags & ZEBRA_FLAG_REJECT)
ri->rtm_type = RTN_UNREACHABLE;
else
assert (0);
@@ -281,12 +281,12 @@ netlink_route_info_fill (netlink_route_info_t *ri, int cmd,
ri->rtm_type = RTN_UNICAST;
}
- ri->metric = &rib->metric;
+ ri->metric = &re->metric;
if (discard)
return 1;
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
if (ri->num_nhs >= multipath_num)
break;
@@ -474,14 +474,14 @@ zfpm_log_route_info (netlink_route_info_t *ri, const char *label)
* value indicates an error.
*/
int
-zfpm_netlink_encode_route (int cmd, rib_dest_t *dest, struct rib *rib,
+zfpm_netlink_encode_route (int cmd, rib_dest_t *dest, struct route_entry *re,
char *in_buf, size_t in_buf_len)
{
netlink_route_info_t ri_space, *ri;
ri = &ri_space;
- if (!netlink_route_info_fill (ri, cmd, dest, rib))
+ if (!netlink_route_info_fill (ri, cmd, dest, re))
return 0;
zfpm_log_route_info (ri, __FUNCTION__);
diff --git a/zebra/zebra_fpm_private.h b/zebra/zebra_fpm_private.h
index 49650541e..441a22a79 100644
--- a/zebra/zebra_fpm_private.h
+++ b/zebra/zebra_fpm_private.h
@@ -49,12 +49,12 @@ static inline void zfpm_debug(const char *format, ...) { return; }
* Externs
*/
extern int
-zfpm_netlink_encode_route (int cmd, rib_dest_t *dest, struct rib *rib,
+zfpm_netlink_encode_route (int cmd, rib_dest_t *dest, struct route_entry *re,
char *in_buf, size_t in_buf_len);
extern int
-zfpm_protobuf_encode_route (rib_dest_t *dest, struct rib *rib,
+zfpm_protobuf_encode_route (rib_dest_t *dest, struct route_entry *re,
uint8_t *in_buf, size_t in_buf_len);
-extern struct rib *zfpm_route_for_update (rib_dest_t *dest);
+extern struct route_entry *zfpm_route_for_update (rib_dest_t *dest);
#endif /* _ZEBRA_FPM_PRIVATE_H */
diff --git a/zebra/zebra_fpm_protobuf.c b/zebra/zebra_fpm_protobuf.c
index 312d4cd3e..375fde921 100644
--- a/zebra/zebra_fpm_protobuf.c
+++ b/zebra/zebra_fpm_protobuf.c
@@ -41,7 +41,7 @@
*/
static Fpm__DeleteRoute *
create_delete_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
- struct rib *rib)
+ struct route_entry *re)
{
Fpm__DeleteRoute *msg;
@@ -141,7 +141,7 @@ add_nexthop (qpb_allocator_t *allocator, Fpm__AddRoute *msg, rib_dest_t *dest,
*/
static Fpm__AddRoute *
create_add_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
- struct rib *rib)
+ struct route_entry *re)
{
Fpm__AddRoute *msg;
int discard;
@@ -167,18 +167,18 @@ create_add_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
*/
msg->sub_address_family = QPB__SUB_ADDRESS_FAMILY__UNICAST;
msg->key = fpm_route_key_create (allocator, rib_dest_prefix(dest));
- qpb_protocol_set (&msg->protocol, rib->type);
+ qpb_protocol_set (&msg->protocol, re->type);
- if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT))
+ if ((re->flags & ZEBRA_FLAG_BLACKHOLE) || (re->flags & ZEBRA_FLAG_REJECT))
discard = 1;
else
discard = 0;
if (discard)
{
- if (rib->flags & ZEBRA_FLAG_BLACKHOLE) {
+ if (re->flags & ZEBRA_FLAG_BLACKHOLE) {
msg->route_type = FPM__ROUTE_TYPE__BLACKHOLE;
- } else if (rib->flags & ZEBRA_FLAG_REJECT) {
+ } else if (re->flags & ZEBRA_FLAG_REJECT) {
msg->route_type = FPM__ROUTE_TYPE__UNREACHABLE;
} else {
assert (0);
@@ -189,13 +189,13 @@ create_add_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
msg->route_type = FPM__ROUTE_TYPE__NORMAL;
}
- msg->metric = rib->metric;
+ msg->metric = re->metric;
/*
* Figure out the set of nexthops to be added to the message.
*/
num_nhs = 0;
- for (ALL_NEXTHOPS_RO (rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO (re->nexthop, nexthop, tnexthop, recursing))
{
if (num_nhs >= multipath_num)
break;
@@ -245,7 +245,7 @@ create_add_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
*/
static Fpm__Message *
create_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
- struct rib *rib)
+ struct route_entry *re)
{
Fpm__Message *msg;
@@ -257,9 +257,9 @@ create_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
fpm__message__init(msg);
- if (!rib) {
+ if (!re) {
msg->type = FPM__MESSAGE__TYPE__DELETE_ROUTE;
- msg->delete_route = create_delete_route_message(allocator, dest, rib);
+ msg->delete_route = create_delete_route_message(allocator, dest, re);
if (!msg->delete_route) {
assert(0);
return NULL;
@@ -268,7 +268,7 @@ create_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
}
msg->type = FPM__MESSAGE__TYPE__ADD_ROUTE;
- msg->add_route = create_add_route_message(allocator, dest, rib);
+ msg->add_route = create_add_route_message(allocator, dest, re);
if (!msg->add_route) {
assert(0);
return NULL;
@@ -287,7 +287,7 @@ create_route_message (qpb_allocator_t *allocator, rib_dest_t *dest,
* value indicates an error.
*/
int
-zfpm_protobuf_encode_route (rib_dest_t *dest, struct rib *rib,
+zfpm_protobuf_encode_route (rib_dest_t *dest, struct route_entry *re,
uint8_t *in_buf, size_t in_buf_len)
{
Fpm__Message *msg;
@@ -296,7 +296,7 @@ zfpm_protobuf_encode_route (rib_dest_t *dest, struct rib *rib,
QPB_INIT_STACK_ALLOCATOR (allocator);
- msg = create_route_message(&allocator, dest, rib);
+ msg = create_route_message(&allocator, dest, re);
if (!msg) {
assert(0);
return 0;
diff --git a/zebra/zebra_memory.c b/zebra/zebra_memory.c
index 51c240ae2..b8e1a130e 100644
--- a/zebra/zebra_memory.c
+++ b/zebra/zebra_memory.c
@@ -28,7 +28,7 @@
DEFINE_MGROUP(ZEBRA, "zebra")
DEFINE_MTYPE(ZEBRA, RTADV_PREFIX, "Router Advertisement Prefix")
DEFINE_MTYPE(ZEBRA, ZEBRA_VRF, "ZEBRA VRF")
-DEFINE_MTYPE(ZEBRA, RIB, "RIB")
+DEFINE_MTYPE(ZEBRA, RE, "Route Entry")
DEFINE_MTYPE(ZEBRA, RIB_QUEUE, "RIB process work queue")
DEFINE_MTYPE(ZEBRA, STATIC_ROUTE, "Static route")
DEFINE_MTYPE(ZEBRA, RIB_DEST, "RIB destination")
diff --git a/zebra/zebra_memory.h b/zebra/zebra_memory.h
index 35d70d81e..e3439d5f6 100644
--- a/zebra/zebra_memory.h
+++ b/zebra/zebra_memory.h
@@ -28,7 +28,7 @@ DECLARE_MGROUP(ZEBRA)
DECLARE_MTYPE(RTADV_PREFIX)
DECLARE_MTYPE(ZEBRA_NS)
DECLARE_MTYPE(ZEBRA_VRF)
-DECLARE_MTYPE(RIB)
+DECLARE_MTYPE(RE)
DECLARE_MTYPE(RIB_QUEUE)
DECLARE_MTYPE(STATIC_ROUTE)
DECLARE_MTYPE(RIB_DEST)
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index b547c6256..db02a025f 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -65,7 +65,7 @@ static u_int32_t
fec_derive_label_from_index (struct zebra_vrf *vrf, zebra_fec_t *fec);
static int
lsp_install (struct zebra_vrf *zvrf, mpls_label_t label,
- struct route_node *rn, struct rib *rib);
+ struct route_node *rn, struct route_entry *re);
static int
lsp_uninstall (struct zebra_vrf *zvrf, mpls_label_t label);
static int
@@ -168,7 +168,7 @@ mpls_processq_init (struct zebra_t *zebra);
*/
static int
lsp_install (struct zebra_vrf *zvrf, mpls_label_t label,
- struct route_node *rn, struct rib *rib)
+ struct route_node *rn, struct route_entry *re)
{
struct hash *lsp_table;
zebra_ile_t tmp_ile;
@@ -184,7 +184,7 @@ lsp_install (struct zebra_vrf *zvrf, mpls_label_t label,
if (!lsp_table)
return -1;
- lsp_type = lsp_type_from_rib_type (rib->type);
+ lsp_type = lsp_type_from_re_type (re->type);
added = changed = 0;
/* Locate or allocate LSP entry. */
@@ -198,7 +198,7 @@ lsp_install (struct zebra_vrf *zvrf, mpls_label_t label,
* the label advertised by the recursive nexthop (plus we don't have the
* logic yet to push multiple labels).
*/
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
{
/* Skip inactive and recursive entries. */
if (!CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
@@ -441,7 +441,7 @@ fec_change_update_lsp (struct zebra_vrf *zvrf, zebra_fec_t *fec, mpls_label_t ol
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
afi_t afi;
/* Uninstall label forwarding entry, if previously installed. */
@@ -464,16 +464,16 @@ fec_change_update_lsp (struct zebra_vrf *zvrf, zebra_fec_t *fec, mpls_label_t ol
if (!rn)
return 0;
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED))
break;
}
- if (!rib || !zebra_rib_labeled_unicast (rib))
+ if (!re || !zebra_rib_labeled_unicast (re))
return 0;
- if (lsp_install (zvrf, fec->label, rn, rib))
+ if (lsp_install (zvrf, fec->label, rn, re))
return -1;
return 0;
@@ -656,7 +656,7 @@ nhlfe_nexthop_active_ipv4 (zebra_nhlfe_t *nhlfe, struct nexthop *nexthop)
struct route_table *table;
struct prefix_ipv4 p;
struct route_node *rn;
- struct rib *match;
+ struct route_entry *match;
struct nexthop *match_nh;
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT);
@@ -676,9 +676,9 @@ nhlfe_nexthop_active_ipv4 (zebra_nhlfe_t *nhlfe, struct nexthop *nexthop)
route_unlock_node (rn);
/* Locate a valid connected route. */
- RNODE_FOREACH_RIB (rn, match)
+ RNODE_FOREACH_RE (rn, match)
{
- if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED) ||
+ if (CHECK_FLAG (match->status, ROUTE_ENTRY_REMOVED) ||
!CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
continue;
@@ -708,7 +708,7 @@ nhlfe_nexthop_active_ipv6 (zebra_nhlfe_t *nhlfe, struct nexthop *nexthop)
struct route_table *table;
struct prefix_ipv6 p;
struct route_node *rn;
- struct rib *match;
+ struct route_entry *match;
table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
if (!table)
@@ -727,10 +727,10 @@ nhlfe_nexthop_active_ipv6 (zebra_nhlfe_t *nhlfe, struct nexthop *nexthop)
route_unlock_node (rn);
/* Locate a valid connected route. */
- RNODE_FOREACH_RIB (rn, match)
+ RNODE_FOREACH_RE (rn, match)
{
if ((match->type == ZEBRA_ROUTE_CONNECT) &&
- !CHECK_FLAG (match->status, RIB_ENTRY_REMOVED) &&
+ !CHECK_FLAG (match->status, ROUTE_ENTRY_REMOVED) &&
CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
break;
}
@@ -1809,7 +1809,7 @@ mpls_label2str (u_int8_t num_labels, mpls_label_t *labels,
* Install dynamic LSP entry.
*/
int
-zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib)
+zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct route_entry *re)
{
struct route_table *table;
zebra_fec_t *fec;
@@ -1829,7 +1829,7 @@ zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct ri
if (fec->label == MPLS_IMP_NULL_LABEL)
return 0;
- if (lsp_install (zvrf, fec->label, rn, rib))
+ if (lsp_install (zvrf, fec->label, rn, re))
return -1;
return 0;
@@ -1839,7 +1839,7 @@ zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct ri
* Uninstall dynamic LSP entry, if any.
*/
int
-zebra_mpls_lsp_uninstall (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib)
+zebra_mpls_lsp_uninstall (struct zebra_vrf *zvrf, struct route_node *rn, struct route_entry *re)
{
struct route_table *table;
zebra_fec_t *fec;
@@ -2296,7 +2296,7 @@ mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
struct nexthop *nexthop;
/* Lookup table. */
@@ -2306,18 +2306,18 @@ mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
/* Lookup existing route */
rn = route_node_get (table, prefix);
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (rib->distance == distance)
+ if (re->distance == distance)
break;
}
- if (rib == NULL)
+ if (re == NULL)
return -1;
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
{
switch (nexthop->type)
{
@@ -2356,8 +2356,8 @@ mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
else
return 0;
- SET_FLAG (rib->status, RIB_ENTRY_CHANGED);
- SET_FLAG (rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
+ SET_FLAG (re->status, ROUTE_ENTRY_CHANGED);
+ SET_FLAG (re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
rib_queue_add (rn);
return 0;
@@ -2534,7 +2534,7 @@ mpls_ldp_ftn_uninstall_all (struct zebra_vrf *zvrf, int afi)
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
struct nexthop *nexthop;
int update;
@@ -2546,13 +2546,13 @@ mpls_ldp_ftn_uninstall_all (struct zebra_vrf *zvrf, int afi)
for (rn = route_top (table); rn; rn = route_next (rn))
{
update = 0;
- RNODE_FOREACH_RIB (rn, rib)
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ RNODE_FOREACH_RE (rn, re)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
if (nexthop->nh_label_type == ZEBRA_LSP_LDP)
{
nexthop_del_labels (nexthop);
- SET_FLAG (rib->status, RIB_ENTRY_CHANGED);
- SET_FLAG (rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
+ SET_FLAG (re->status, ROUTE_ENTRY_CHANGED);
+ SET_FLAG (re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
update = 1;
}
diff --git a/zebra/zebra_mpls.h b/zebra/zebra_mpls.h
index 1f17de67a..047b43213 100644
--- a/zebra/zebra_mpls.h
+++ b/zebra/zebra_mpls.h
@@ -208,13 +208,13 @@ zebra_mpls_write_label_block_config (struct vty *vty, struct zebra_vrf *vrf);
* Install dynamic LSP entry.
*/
int
-zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib);
+zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct route_entry *re);
/*
* Uninstall dynamic LSP entry, if any.
*/
int
-zebra_mpls_lsp_uninstall (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib);
+zebra_mpls_lsp_uninstall (struct zebra_vrf *zvrf, struct route_node *rn, struct route_entry *re);
/*
* Registration from a client for the label binding for a FEC. If a binding
@@ -449,9 +449,9 @@ lsp_distance (enum lsp_types_t type)
* are converted into LSPs.
*/
static inline enum lsp_types_t
-lsp_type_from_rib_type (int rib_type)
+lsp_type_from_re_type (int re_type)
{
- switch (rib_type)
+ switch (re_type)
{
case ZEBRA_ROUTE_STATIC:
return ZEBRA_LSP_STATIC;
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 5f457a6fc..ca15d7ead 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -184,10 +184,10 @@ zebra_check_addr (struct prefix *p)
/* Add nexthop to the end of a rib node's nexthop list */
void
-rib_nexthop_add (struct rib *rib, struct nexthop *nexthop)
+route_entry_nexthop_add (struct route_entry *re, struct nexthop *nexthop)
{
- nexthop_add(&rib->nexthop, nexthop);
- rib->nexthop_num++;
+ nexthop_add(&re->nexthop, nexthop);
+ re->nexthop_num++;
}
@@ -196,7 +196,7 @@ rib_nexthop_add (struct rib *rib, struct nexthop *nexthop)
* copy_nexthop - copy a nexthop to the rib structure.
*/
void
-rib_copy_nexthops (struct rib *rib, struct nexthop *nh)
+route_entry_copy_nexthops (struct route_entry *re, struct nexthop *nh)
{
struct nexthop *nexthop;
@@ -209,28 +209,28 @@ rib_copy_nexthops (struct rib *rib, struct nexthop *nh)
if (nh->nh_label)
nexthop_add_labels (nexthop, nh->nh_label_type, nh->nh_label->num_labels,
&nh->nh_label->label[0]);
- rib_nexthop_add(rib, nexthop);
+ route_entry_nexthop_add(re, nexthop);
if (CHECK_FLAG(nh->flags, NEXTHOP_FLAG_RECURSIVE))
copy_nexthops(&nexthop->resolved, nh->resolved);
}
/* Delete specified nexthop from the list. */
void
-rib_nexthop_delete (struct rib *rib, struct nexthop *nexthop)
+route_entry_nexthop_delete (struct route_entry *re, struct nexthop *nexthop)
{
if (nexthop->next)
nexthop->next->prev = nexthop->prev;
if (nexthop->prev)
nexthop->prev->next = nexthop->next;
else
- rib->nexthop = nexthop->next;
- rib->nexthop_num--;
+ re->nexthop = nexthop->next;
+ re->nexthop_num--;
}
struct nexthop *
-rib_nexthop_ifindex_add (struct rib *rib, ifindex_t ifindex)
+route_entry_nexthop_ifindex_add (struct route_entry *re, ifindex_t ifindex)
{
struct nexthop *nexthop;
@@ -238,13 +238,13 @@ rib_nexthop_ifindex_add (struct rib *rib, ifindex_t ifindex)
nexthop->type = NEXTHOP_TYPE_IFINDEX;
nexthop->ifindex = ifindex;
- rib_nexthop_add (rib, nexthop);
+ route_entry_nexthop_add (re, nexthop);
return nexthop;
}
struct nexthop *
-rib_nexthop_ipv4_add (struct rib *rib, struct in_addr *ipv4, struct in_addr *src)
+route_entry_nexthop_ipv4_add (struct route_entry *re, struct in_addr *ipv4, struct in_addr *src)
{
struct nexthop *nexthop;
@@ -254,13 +254,13 @@ rib_nexthop_ipv4_add (struct rib *rib, struct in_addr *ipv4, struct in_addr *src
if (src)
nexthop->src.ipv4 = *src;
- rib_nexthop_add (rib, nexthop);
+ route_entry_nexthop_add (re, nexthop);
return nexthop;
}
struct nexthop *
-rib_nexthop_ipv4_ifindex_add (struct rib *rib, struct in_addr *ipv4,
+route_entry_nexthop_ipv4_ifindex_add (struct route_entry *re, struct in_addr *ipv4,
struct in_addr *src, ifindex_t ifindex)
{
struct nexthop *nexthop;
@@ -280,13 +280,13 @@ rib_nexthop_ipv4_ifindex_add (struct rib *rib, struct in_addr *ipv4,
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK);
}
- rib_nexthop_add (rib, nexthop);
+ route_entry_nexthop_add (re, nexthop);
return nexthop;
}
struct nexthop *
-rib_nexthop_ipv6_add (struct rib *rib, struct in6_addr *ipv6)
+route_entry_nexthop_ipv6_add (struct route_entry *re, struct in6_addr *ipv6)
{
struct nexthop *nexthop;
@@ -294,13 +294,13 @@ rib_nexthop_ipv6_add (struct rib *rib, struct in6_addr *ipv6)
nexthop->type = NEXTHOP_TYPE_IPV6;
nexthop->gate.ipv6 = *ipv6;
- rib_nexthop_add (rib, nexthop);
+ route_entry_nexthop_add (re, nexthop);
return nexthop;
}
struct nexthop *
-rib_nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6,
+route_entry_nexthop_ipv6_ifindex_add (struct route_entry *re, struct in6_addr *ipv6,
ifindex_t ifindex)
{
struct nexthop *nexthop;
@@ -310,53 +310,35 @@ rib_nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6,
nexthop->gate.ipv6 = *ipv6;
nexthop->ifindex = ifindex;
- rib_nexthop_add (rib, nexthop);
+ route_entry_nexthop_add (re, nexthop);
return nexthop;
}
struct nexthop *
-rib_nexthop_blackhole_add (struct rib *rib)
+route_entry_nexthop_blackhole_add (struct route_entry *re)
{
struct nexthop *nexthop;
nexthop = nexthop_new();
nexthop->type = NEXTHOP_TYPE_BLACKHOLE;
- SET_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE);
+ SET_FLAG (re->flags, ZEBRA_FLAG_BLACKHOLE);
- rib_nexthop_add (rib, nexthop);
+ route_entry_nexthop_add (re, nexthop);
return nexthop;
}
-/* This method checks whether a recursive nexthop has at
- * least one resolved nexthop in the fib.
- */
-int
-nexthop_has_fib_child(struct nexthop *nexthop)
-{
- struct nexthop *nh;
-
- if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
- return 0;
-
- for (nh = nexthop->resolved; nh; nh = nh->next)
- if (CHECK_FLAG (nh->flags, NEXTHOP_FLAG_FIB))
- return 1;
-
- return 0;
-}
-
/* If force flag is not set, do not modify falgs at all for uninstall
the route from FIB. */
static int
-nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
+nexthop_active (afi_t afi, struct route_entry *re, struct nexthop *nexthop, int set,
struct route_node *top)
{
struct prefix p;
struct route_table *table;
struct route_node *rn;
- struct rib *match;
+ struct route_entry *match;
int resolved;
struct nexthop *newhop, *tnewhop;
struct nexthop *resolved_hop;
@@ -369,10 +351,10 @@ nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
if (set)
{
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE);
- zebra_deregister_rnh_static_nexthops(rib->vrf_id, nexthop->resolved, top);
+ zebra_deregister_rnh_static_nexthops(re->vrf_id, nexthop->resolved, top);
nexthops_free(nexthop->resolved);
nexthop->resolved = NULL;
- rib->nexthop_mtu = 0;
+ re->nexthop_mtu = 0;
}
/* Skip nexthops that have been filtered out due to route-map */
@@ -419,7 +401,7 @@ nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
break;
}
/* Lookup table. */
- table = zebra_vrf_table (afi, SAFI_UNICAST, rib->vrf_id);
+ table = zebra_vrf_table (afi, SAFI_UNICAST, re->vrf_id);
if (! table)
return 0;
@@ -438,15 +420,15 @@ nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
!nh_resolve_via_default (p.family))
return 0;
- RNODE_FOREACH_RIB (rn, match)
+ RNODE_FOREACH_RE (rn, match)
{
- if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ 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, RIB_ENTRY_SELECTED_FIB))
+ if (CHECK_FLAG (match->status, ROUTE_ENTRY_SELECTED_FIB))
break;
}
@@ -480,7 +462,7 @@ nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
}
return 1;
}
- else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL))
+ else if (CHECK_FLAG (re->flags, ZEBRA_FLAG_INTERNAL))
{
resolved = 0;
for (newhop = match->nexthop; newhop; newhop = newhop->next)
@@ -490,7 +472,7 @@ nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
if (set)
{
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE);
- SET_FLAG(rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
+ SET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
resolved_hop = nexthop_new();
SET_FLAG (resolved_hop->flags, NEXTHOP_FLAG_ACTIVE);
@@ -552,7 +534,7 @@ nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
}
return resolved;
}
- else if (rib->type == ZEBRA_ROUTE_STATIC)
+ else if (re->type == ZEBRA_ROUTE_STATIC)
{
resolved = 0;
for (ALL_NEXTHOPS_RO(match->nexthop, newhop, tnewhop, recursing))
@@ -622,7 +604,7 @@ nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
resolved = 1;
}
if (resolved && set)
- rib->nexthop_mtu = match->mtu;
+ re->nexthop_mtu = match->mtu;
return resolved;
}
else
@@ -634,14 +616,14 @@ nexthop_active (afi_t afi, struct rib *rib, struct nexthop *nexthop, int set,
return 0;
}
-struct rib *
+struct route_entry *
rib_match (afi_t afi, safi_t safi, vrf_id_t vrf_id,
union g_addr *addr, struct route_node **rn_out)
{
struct prefix p;
struct route_table *table;
struct route_node *rn;
- struct rib *match;
+ struct route_entry *match;
struct nexthop *newhop, *tnewhop;
int recursing;
@@ -670,11 +652,11 @@ rib_match (afi_t afi, safi_t safi, vrf_id_t vrf_id,
route_unlock_node (rn);
/* Pick up selected route. */
- RNODE_FOREACH_RIB (rn, match)
+ RNODE_FOREACH_RE (rn, match)
{
- if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (match->status, ROUTE_ENTRY_REMOVED))
continue;
- if (CHECK_FLAG (match->status, RIB_ENTRY_SELECTED_FIB))
+ if (CHECK_FLAG (match->status, ROUTE_ENTRY_SELECTED_FIB))
break;
}
@@ -711,10 +693,10 @@ rib_match (afi_t afi, safi_t safi, vrf_id_t vrf_id,
return NULL;
}
-struct rib *
+struct route_entry *
rib_match_ipv4_multicast (vrf_id_t vrf_id, struct in_addr addr, struct route_node **rn_out)
{
- struct rib *rib = NULL, *mrib = NULL, *urib = NULL;
+ struct route_entry *re = NULL, *mre = NULL, *ure = NULL;
struct route_node *m_rn = NULL, *u_rn = NULL;
union g_addr gaddr = { .ipv4 = addr };
@@ -726,34 +708,34 @@ rib_match_ipv4_multicast (vrf_id_t vrf_id, struct in_addr addr, struct route_nod
return rib_match (AFI_IP, SAFI_UNICAST, vrf_id, &gaddr, rn_out);
case MCAST_NO_CONFIG:
case MCAST_MIX_MRIB_FIRST:
- rib = mrib = rib_match (AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr, &m_rn);
- if (!mrib)
- rib = urib = rib_match (AFI_IP, SAFI_UNICAST, vrf_id, &gaddr, &u_rn);
+ re = mre = rib_match (AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr, &m_rn);
+ if (!mre)
+ re = ure = rib_match (AFI_IP, SAFI_UNICAST, vrf_id, &gaddr, &u_rn);
break;
case MCAST_MIX_DISTANCE:
- mrib = rib_match (AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr, &m_rn);
- urib = rib_match (AFI_IP, SAFI_UNICAST, vrf_id, &gaddr, &u_rn);
- if (mrib && urib)
- rib = urib->distance < mrib->distance ? urib : mrib;
- else if (mrib)
- rib = mrib;
- else if (urib)
- rib = urib;
+ mre = rib_match (AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr, &m_rn);
+ ure = rib_match (AFI_IP, SAFI_UNICAST, vrf_id, &gaddr, &u_rn);
+ if (mre && ure)
+ re = ure->distance < mre->distance ? ure : mre;
+ else if (mre)
+ re = mre;
+ else if (ure)
+ re = ure;
break;
case MCAST_MIX_PFXLEN:
- mrib = rib_match (AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr, &m_rn);
- urib = rib_match (AFI_IP, SAFI_UNICAST, vrf_id, &gaddr, &u_rn);
- if (mrib && urib)
- rib = u_rn->p.prefixlen > m_rn->p.prefixlen ? urib : mrib;
- else if (mrib)
- rib = mrib;
- else if (urib)
- rib = urib;
+ mre = rib_match (AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr, &m_rn);
+ ure = rib_match (AFI_IP, SAFI_UNICAST, vrf_id, &gaddr, &u_rn);
+ if (mre && ure)
+ re = u_rn->p.prefixlen > m_rn->p.prefixlen ? ure : mre;
+ else if (mre)
+ re = mre;
+ else if (ure)
+ re = ure;
break;
}
if (rn_out)
- *rn_out = (rib == mrib) ? m_rn : u_rn;
+ *rn_out = (re == mre) ? m_rn : u_rn;
if (IS_ZEBRA_DEBUG_RIB)
{
@@ -762,11 +744,11 @@ rib_match_ipv4_multicast (vrf_id_t vrf_id, struct in_addr addr, struct route_nod
zlog_debug("%s: %s: found %s, using %s",
__func__, buf,
- mrib ? (urib ? "MRIB+URIB" : "MRIB") :
- urib ? "URIB" : "nothing",
- rib == urib ? "URIB" : rib == mrib ? "MRIB" : "none");
+ mre ? (ure ? "MRIB+URIB" : "MRIB") :
+ ure ? "URIB" : "nothing",
+ re == ure ? "URIB" : re == mre ? "MRIB" : "none");
}
- return rib;
+ return re;
}
void
@@ -783,12 +765,12 @@ multicast_mode_ipv4_get (void)
return ipv4_multicast_mode;
}
-struct rib *
+struct route_entry *
rib_lookup_ipv4 (struct prefix_ipv4 *p, vrf_id_t vrf_id)
{
struct route_table *table;
struct route_node *rn;
- struct rib *match;
+ struct route_entry *match;
struct nexthop *nexthop, *tnexthop;
int recursing;
@@ -806,11 +788,11 @@ rib_lookup_ipv4 (struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* Unlock node. */
route_unlock_node (rn);
- RNODE_FOREACH_RIB (rn, match)
+ RNODE_FOREACH_RE (rn, match)
{
- if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (match->status, ROUTE_ENTRY_REMOVED))
continue;
- if (CHECK_FLAG (match->status, RIB_ENTRY_SELECTED_FIB))
+ if (CHECK_FLAG (match->status, ROUTE_ENTRY_SELECTED_FIB))
break;
}
@@ -830,7 +812,7 @@ rib_lookup_ipv4 (struct prefix_ipv4 *p, vrf_id_t vrf_id)
/*
* This clone function, unlike its original rib_lookup_ipv4(), checks
* if specified IPv4 route record (prefix/mask -> gate) exists in
- * the whole RIB and has RIB_ENTRY_SELECTED_FIB set.
+ * the whole RIB and has ROUTE_ENTRY_SELECTED_FIB set.
*
* Return values:
* -1: error
@@ -845,7 +827,7 @@ rib_lookup_ipv4_route (struct prefix_ipv4 *p, union sockunion * qgate,
{
struct route_table *table;
struct route_node *rn;
- struct rib *match;
+ struct route_entry *match;
struct nexthop *nexthop, *tnexthop;
int recursing;
int nexthops_active;
@@ -866,11 +848,11 @@ rib_lookup_ipv4_route (struct prefix_ipv4 *p, union sockunion * qgate,
route_unlock_node (rn);
/* Find out if a "selected" RR for the discovered RIB entry exists ever. */
- RNODE_FOREACH_RIB (rn, match)
+ RNODE_FOREACH_RE (rn, match)
{
- if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (match->status, ROUTE_ENTRY_REMOVED))
continue;
- if (CHECK_FLAG (match->status, RIB_ENTRY_SELECTED_FIB))
+ if (CHECK_FLAG (match->status, ROUTE_ENTRY_SELECTED_FIB))
break;
}
@@ -919,7 +901,7 @@ rib_lookup_ipv4_route (struct prefix_ipv4 *p, union sockunion * qgate,
*/
static unsigned
-nexthop_active_check (struct route_node *rn, struct rib *rib,
+nexthop_active_check (struct route_node *rn, struct route_entry *re,
struct nexthop *nexthop, int set)
{
struct interface *ifp;
@@ -938,7 +920,7 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
switch (nexthop->type)
{
case NEXTHOP_TYPE_IFINDEX:
- ifp = if_lookup_by_index (nexthop->ifindex, rib->vrf_id);
+ ifp = if_lookup_by_index (nexthop->ifindex, re->vrf_id);
if (ifp && if_is_operative(ifp))
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
else
@@ -947,14 +929,14 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
family = AFI_IP;
- if (nexthop_active (AFI_IP, rib, nexthop, set, rn))
+ if (nexthop_active (AFI_IP, re, nexthop, set, rn))
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
else
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
break;
case NEXTHOP_TYPE_IPV6:
family = AFI_IP6;
- if (nexthop_active (AFI_IP6, rib, nexthop, set, rn))
+ if (nexthop_active (AFI_IP6, re, nexthop, set, rn))
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
else
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
@@ -965,7 +947,7 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
family = AFI_IP6;
if (IN6_IS_ADDR_LINKLOCAL (&nexthop->gate.ipv6))
{
- ifp = if_lookup_by_index (nexthop->ifindex, rib->vrf_id);
+ ifp = if_lookup_by_index (nexthop->ifindex, re->vrf_id);
if (ifp && if_is_operative(ifp))
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
else
@@ -973,7 +955,7 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
}
else
{
- if (nexthop_active (AFI_IP6, rib, nexthop, set, rn))
+ if (nexthop_active (AFI_IP6, re, nexthop, set, rn))
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
else
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
@@ -990,7 +972,7 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
/* XXX: What exactly do those checks do? Do we support
* e.g. IPv4 routes with IPv6 nexthops or vice versa? */
- if (RIB_SYSTEM_ROUTE(rib) ||
+ if (RIB_SYSTEM_ROUTE(re) ||
(family == AFI_IP && p->family != AF_INET) ||
(family == AFI_IP6 && p->family != AF_INET6))
return CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
@@ -1012,16 +994,16 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
memset(&nexthop->rmap_src.ipv6, 0, sizeof(union g_addr));
/* It'll get set if required inside */
- ret = zebra_route_map_check(family, rib->type, p, nexthop, rib->vrf_id,
- rib->tag);
+ ret = zebra_route_map_check(family, re->type, p, nexthop, re->vrf_id,
+ re->tag);
if (ret == RMAP_DENYMATCH)
{
if (IS_ZEBRA_DEBUG_RIB)
{
srcdest_rnode2str(rn, buf, sizeof(buf));
zlog_debug("%u:%s: Filtering out with NH out %s due to route map",
- rib->vrf_id, buf,
- ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ re->vrf_id, buf,
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
}
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
}
@@ -1029,34 +1011,34 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
}
/* Iterate over all nexthops of the given RIB entry and refresh their
- * ACTIVE flag. rib->nexthop_active_num is updated accordingly. If any
- * nexthop is found to toggle the ACTIVE flag, the whole rib structure
- * is flagged with RIB_ENTRY_CHANGED. The 4th 'set' argument is
+ * ACTIVE flag. re->nexthop_active_num is updated accordingly. If any
+ * nexthop is found to toggle the ACTIVE flag, the whole re structure
+ * is flagged with ROUTE_ENTRY_CHANGED. The 4th 'set' argument is
* transparently passed to nexthop_active_check().
*
* Return value is the new number of active nexthops.
*/
static int
-nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
+nexthop_active_update (struct route_node *rn, struct route_entry *re, int set)
{
struct nexthop *nexthop;
union g_addr prev_src;
unsigned int prev_active, new_active, old_num_nh;
ifindex_t prev_index;
- old_num_nh = rib->nexthop_active_num;
+ old_num_nh = re->nexthop_active_num;
- rib->nexthop_active_num = 0;
- UNSET_FLAG (rib->status, RIB_ENTRY_CHANGED);
+ re->nexthop_active_num = 0;
+ UNSET_FLAG (re->status, ROUTE_ENTRY_CHANGED);
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
{
/* No protocol daemon provides src and so we're skipping tracking it */
prev_src = nexthop->rmap_src;
prev_active = CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
prev_index = nexthop->ifindex;
- if ((new_active = nexthop_active_check (rn, rib, nexthop, set)))
- rib->nexthop_active_num++;
+ if ((new_active = nexthop_active_check (rn, re, nexthop, set)))
+ re->nexthop_active_num++;
/* Don't allow src setting on IPv6 addr for now */
if (prev_active != new_active ||
prev_index != nexthop->ifindex ||
@@ -1067,20 +1049,20 @@ nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
nexthop->type < NEXTHOP_TYPE_BLACKHOLE) &&
!(IPV6_ADDR_SAME (&prev_src.ipv6, &nexthop->rmap_src.ipv6))))
{
- SET_FLAG (rib->status, RIB_ENTRY_CHANGED);
- SET_FLAG (rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
+ SET_FLAG (re->status, ROUTE_ENTRY_CHANGED);
+ SET_FLAG (re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
}
}
- if (old_num_nh != rib->nexthop_active_num)
- SET_FLAG (rib->status, RIB_ENTRY_CHANGED);
+ if (old_num_nh != re->nexthop_active_num)
+ SET_FLAG (re->status, ROUTE_ENTRY_CHANGED);
- if (CHECK_FLAG (rib->status, RIB_ENTRY_CHANGED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_CHANGED))
{
- SET_FLAG (rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
+ SET_FLAG (re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
}
- return rib->nexthop_active_num;
+ return re->nexthop_active_num;
}
/*
@@ -1088,15 +1070,15 @@ nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
* (nexthops) must have a label.
*/
int
-zebra_rib_labeled_unicast (struct rib *rib)
+zebra_rib_labeled_unicast (struct route_entry *re)
{
struct nexthop *nexthop = NULL, *tnexthop;
int recursing;
- if (rib->type != ZEBRA_ROUTE_BGP)
+ if (re->type != ZEBRA_ROUTE_BGP)
return 0;
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
if (!nexthop->nh_label || !nexthop->nh_label->num_labels)
return 0;
@@ -1107,20 +1089,20 @@ zebra_rib_labeled_unicast (struct rib *rib)
* is only used for IPv4.
*/
int
-rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
+rib_install_kernel (struct route_node *rn, struct route_entry *re, struct route_entry *old)
{
int ret = 0;
struct nexthop *nexthop, *tnexthop;
rib_table_info_t *info = srcdest_rnode_table_info(rn);
int recursing;
struct prefix *p, *src_p;
- struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id);
+ struct zebra_vrf *zvrf = vrf_info_lookup (re->vrf_id);
srcdest_rnode_prefixes (rn, &p, &src_p);
if (info->safi != SAFI_UNICAST)
{
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
return ret;
}
@@ -1130,13 +1112,13 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
* the kernel.
*/
hook_call(rib_update, rn, "installing in kernel");
- ret = kernel_route_rib (p, src_p, old, rib);
+ ret = kernel_route_rib (p, src_p, old, re);
zvrf->installs++;
/* If install succeeds, update FIB flag for nexthops. */
if (!ret)
{
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
continue;
@@ -1153,20 +1135,20 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
/* Uninstall the route from kernel. */
int
-rib_uninstall_kernel (struct route_node *rn, struct rib *rib)
+rib_uninstall_kernel (struct route_node *rn, struct route_entry *re)
{
int ret = 0;
struct nexthop *nexthop, *tnexthop;
rib_table_info_t *info = srcdest_rnode_table_info(rn);
int recursing;
struct prefix *p, *src_p;
- struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id);
+ struct zebra_vrf *zvrf = vrf_info_lookup (re->vrf_id);
srcdest_rnode_prefixes (rn, &p, &src_p);
if (info->safi != SAFI_UNICAST)
{
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
return ret;
}
@@ -1176,10 +1158,10 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib)
* the kernel.
*/
hook_call(rib_update, rn, "uninstalling from kernel");
- ret = kernel_route_rib (p, src_p, rib, NULL);
+ ret = kernel_route_rib (p, src_p, re, NULL);
zvrf->removals++;
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
return ret;
@@ -1187,32 +1169,32 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib)
/* Uninstall the route from kernel. */
static void
-rib_uninstall (struct route_node *rn, struct rib *rib)
+rib_uninstall (struct route_node *rn, struct route_entry *re)
{
rib_table_info_t *info = srcdest_rnode_table_info(rn);
- if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_SELECTED_FIB))
{
if (info->safi == SAFI_UNICAST)
hook_call(rib_update, rn, "rib_uninstall");
- if (! RIB_SYSTEM_ROUTE (rib))
- rib_uninstall_kernel (rn, rib);
+ if (! RIB_SYSTEM_ROUTE (re))
+ rib_uninstall_kernel (rn, re);
/* If labeled-unicast route, uninstall transit LSP. */
- if (zebra_rib_labeled_unicast (rib))
- zebra_mpls_lsp_uninstall (info->zvrf, rn, rib);
+ if (zebra_rib_labeled_unicast (re))
+ zebra_mpls_lsp_uninstall (info->zvrf, rn, re);
- UNSET_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB);
+ UNSET_FLAG (re->status, ROUTE_ENTRY_SELECTED_FIB);
}
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED))
{
struct prefix *p, *src_p;
srcdest_rnode_prefixes (rn, &p, &src_p);
- redistribute_delete (p, src_p, rib);
- UNSET_FLAG (rib->flags, ZEBRA_FLAG_SELECTED);
+ redistribute_delete (p, src_p, re);
+ UNSET_FLAG (re->flags, ZEBRA_FLAG_SELECTED);
}
}
@@ -1278,23 +1260,23 @@ rib_gc_dest (struct route_node *rn)
static void
rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
- struct rib *new)
+ struct route_entry *new)
{
hook_call(rib_update, rn, "new route selected");
/* Update real nexthop. This may actually determine if nexthop is active or not. */
if (!nexthop_active_update (rn, new, 1))
{
- UNSET_FLAG(new->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG(new->status, ROUTE_ENTRY_CHANGED);
return;
}
- SET_FLAG (new->status, RIB_ENTRY_SELECTED_FIB);
+ SET_FLAG (new->status, ROUTE_ENTRY_SELECTED_FIB);
if (IS_ZEBRA_DEBUG_RIB)
{
char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf));
- zlog_debug ("%u:%s: Adding route rn %p, rib %p (type %d)",
+ zlog_debug ("%u:%s: Adding route rn %p, re %p (type %d)",
zvrf_id (zvrf), buf, rn, new, new->type);
}
@@ -1313,12 +1295,12 @@ rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
}
}
- UNSET_FLAG(new->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG(new->status, ROUTE_ENTRY_CHANGED);
}
static void
rib_process_del_fib(struct zebra_vrf *zvrf, struct route_node *rn,
- struct rib *old)
+ struct route_entry *old)
{
hook_call(rib_update, rn, "removing existing route");
@@ -1327,7 +1309,7 @@ rib_process_del_fib(struct zebra_vrf *zvrf, struct route_node *rn,
{
char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf));
- zlog_debug ("%u:%s: Deleting route rn %p, rib %p (type %d)",
+ zlog_debug ("%u:%s: Deleting route rn %p, re %p (type %d)",
zvrf_id (zvrf), buf, rn, old, old->type);
}
@@ -1338,16 +1320,16 @@ 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, RIB_ENTRY_SELECTED_FIB);
+ UNSET_FLAG (old->status, ROUTE_ENTRY_SELECTED_FIB);
/* Update nexthop for route, reset changed flag. */
nexthop_active_update (rn, old, 1);
- UNSET_FLAG(old->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG(old->status, ROUTE_ENTRY_CHANGED);
}
static void
rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
- struct rib *old, struct rib *new)
+ struct route_entry *old, struct route_entry *new)
{
struct nexthop *nexthop = NULL, *tnexthop;
int recursing;
@@ -1359,7 +1341,7 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
* something has changed.
*/
if (new != old ||
- CHECK_FLAG (new->status, RIB_ENTRY_CHANGED))
+ CHECK_FLAG (new->status, ROUTE_ENTRY_CHANGED))
{
hook_call(rib_update, rn, "updating existing route");
@@ -1378,11 +1360,11 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf));
if (new != old)
- zlog_debug ("%u:%s: Updating route rn %p, rib %p (type %d) "
+ zlog_debug ("%u:%s: Updating route rn %p, re %p (type %d) "
"old %p (type %d)", zvrf_id (zvrf), buf,
rn, new, new->type, old, old->type);
else
- zlog_debug ("%u:%s: Updating route rn %p, rib %p (type %d)",
+ zlog_debug ("%u:%s: Updating route rn %p, re %p (type %d)",
zvrf_id (zvrf), buf, rn, new, new->type);
}
@@ -1423,7 +1405,7 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
/* Update for redistribution. */
if (installed)
- SET_FLAG (new->status, RIB_ENTRY_SELECTED_FIB);
+ SET_FLAG (new->status, ROUTE_ENTRY_SELECTED_FIB);
}
/*
@@ -1437,12 +1419,12 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf));
if (new != old)
- zlog_debug ("%u:%s: Deleting route rn %p, rib %p (type %d) "
+ zlog_debug ("%u:%s: Deleting route rn %p, re %p (type %d) "
"old %p (type %d) - %s", zvrf_id (zvrf), buf,
rn, new, new->type, old, old->type,
nh_active ? "install failed" : "nexthop inactive");
else
- zlog_debug ("%u:%s: Deleting route rn %p, rib %p (type %d) - %s",
+ zlog_debug ("%u:%s: Deleting route rn %p, re %p (type %d) - %s",
zvrf_id (zvrf), buf, rn, new, new->type,
nh_active ? "install failed" : "nexthop inactive");
}
@@ -1453,7 +1435,7 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
if (!RIB_SYSTEM_ROUTE (old))
rib_uninstall_kernel (rn, old);
- UNSET_FLAG (new->status, RIB_ENTRY_SELECTED_FIB);
+ UNSET_FLAG (new->status, ROUTE_ENTRY_SELECTED_FIB);
}
}
else
@@ -1482,20 +1464,20 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
/* Update prior route. */
if (new != old)
{
- UNSET_FLAG (old->status, RIB_ENTRY_SELECTED_FIB);
+ UNSET_FLAG (old->status, ROUTE_ENTRY_SELECTED_FIB);
/* Set real nexthop. */
nexthop_active_update (rn, old, 1);
- UNSET_FLAG(old->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG(old->status, ROUTE_ENTRY_CHANGED);
}
/* Clear changed flag. */
- UNSET_FLAG(new->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG(new->status, ROUTE_ENTRY_CHANGED);
}
/* Check if 'alternate' RIB entry is better than 'current'. */
-static struct rib *
-rib_choose_best (struct rib *current, struct rib *alternate)
+static struct route_entry *
+rib_choose_best (struct route_entry *current, struct route_entry *alternate)
{
if (current == NULL)
return alternate;
@@ -1539,13 +1521,13 @@ rib_choose_best (struct rib *current, struct rib *alternate)
static void
rib_process (struct route_node *rn)
{
- struct rib *rib;
- struct rib *next;
- struct rib *old_selected = NULL;
- struct rib *new_selected = NULL;
- struct rib *old_fib = NULL;
- struct rib *new_fib = NULL;
- struct rib *best = NULL;
+ struct route_entry *re;
+ struct route_entry *next;
+ struct route_entry *old_selected = NULL;
+ struct route_entry *new_selected = NULL;
+ struct route_entry *old_fib = NULL;
+ struct route_entry *new_fib = NULL;
+ struct route_entry *best = NULL;
char buf[SRCDEST2STR_BUFFER];
rib_dest_t *dest;
struct zebra_vrf *zvrf = NULL;
@@ -1568,31 +1550,31 @@ rib_process (struct route_node *rn)
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug ("%u:%s: Processing rn %p", vrf_id, buf, rn);
- RNODE_FOREACH_RIB_SAFE (rn, rib, next)
+ RNODE_FOREACH_RE_SAFE (rn, re, next)
{
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- zlog_debug ("%u:%s: Examine rib %p (type %d) status %x flags %x "
+ zlog_debug ("%u:%s: Examine re %p (type %d) status %x flags %x "
"dist %d metric %d",
- vrf_id, buf, rib, rib->type, rib->status,
- rib->flags, rib->distance, rib->metric);
+ vrf_id, buf, re, re->type, re->status,
+ re->flags, re->distance, re->metric);
- UNSET_FLAG(rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
+ UNSET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
- /* Currently selected rib. */
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ /* Currently selected re. */
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED))
{
assert (old_selected == NULL);
- old_selected = rib;
+ old_selected = re;
}
/* Currently in fib */
- if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_SELECTED_FIB))
{
assert (old_fib == NULL);
- old_fib = rib;
+ old_fib = re;
}
/* Skip deleted entries from selection */
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
/* Skip unreachable nexthop. */
@@ -1606,68 +1588,68 @@ rib_process (struct route_node *rn)
* the nexthop_active_update() code. Thus, we might miss changes to
* recursive NHs.
*/
- if (!CHECK_FLAG(rib->status, RIB_ENTRY_CHANGED) &&
- ! nexthop_active_update (rn, rib, 0))
+ if (!CHECK_FLAG(re->status, ROUTE_ENTRY_CHANGED) &&
+ ! nexthop_active_update (rn, re, 0))
{
- if (rib->type == ZEBRA_ROUTE_TABLE)
+ if (re->type == ZEBRA_ROUTE_TABLE)
{
/* XXX: HERE BE DRAGONS!!!!!
* In all honesty, I have not yet figured out what this part
- * does or why the RIB_ENTRY_CHANGED test above is correct
+ * does or why the ROUTE_ENTRY_CHANGED test above is correct
* or why we need to delete a route here, and also not whether
* this concerns both selected and fib route, or only selected
* or only fib */
/* This entry was denied by the 'ip protocol table' route-map, we
* need to delete it */
- if (rib != old_selected)
+ if (re != old_selected)
{
if (IS_ZEBRA_DEBUG_RIB)
zlog_debug ("%s: %s: imported via import-table but denied "
"by the ip protocol table route-map",
__func__, buf);
- rib_unlink (rn, rib);
+ rib_unlink (rn, re);
}
else
- SET_FLAG (rib->status, RIB_ENTRY_REMOVED);
+ SET_FLAG (re->status, ROUTE_ENTRY_REMOVED);
}
continue;
}
/* Infinite distance. */
- if (rib->distance == DISTANCE_INFINITY)
+ if (re->distance == DISTANCE_INFINITY)
{
- UNSET_FLAG (rib->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG (re->status, ROUTE_ENTRY_CHANGED);
continue;
}
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_FIB_OVERRIDE))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_FIB_OVERRIDE))
{
- best = rib_choose_best(new_fib, rib);
+ best = rib_choose_best(new_fib, re);
if (new_fib && best != new_fib)
- UNSET_FLAG (new_fib->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG (new_fib->status, ROUTE_ENTRY_CHANGED);
new_fib = best;
}
else
{
- best = rib_choose_best(new_selected, rib);
+ best = rib_choose_best(new_selected, re);
if (new_selected && best != new_selected)
- UNSET_FLAG (new_selected->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG (new_selected->status, ROUTE_ENTRY_CHANGED);
new_selected = best;
}
- if (best != rib)
- UNSET_FLAG (rib->status, RIB_ENTRY_CHANGED);
- } /* RNODE_FOREACH_RIB */
+ if (best != re)
+ UNSET_FLAG (re->status, ROUTE_ENTRY_CHANGED);
+ } /* RNODE_FOREACH_RE */
/* If no FIB override route, use the selected route also for FIB */
if (new_fib == NULL)
new_fib = new_selected;
/* After the cycle is finished, the following pointers will be set:
- * old_selected --- RIB entry currently having SELECTED
- * new_selected --- RIB entry that is newly SELECTED
- * old_fib --- RIB entry currently in kernel FIB
- * new_fib --- RIB entry that is newly to be in kernel FIB
+ * old_selected --- RE entry currently having SELECTED
+ * new_selected --- RE entry that is newly SELECTED
+ * old_fib --- RE entry currently in kernel FIB
+ * new_fib --- RE entry that is newly to be in kernel FIB
*
* new_selected will get SELECTED flag, and is going to be redistributed
* the zclients. new_fib (which can be new_selected) will be installed in kernel.
@@ -1683,10 +1665,10 @@ rib_process (struct route_node *rn)
(void *)new_fib);
}
- /* Buffer RIB_ENTRY_CHANGED here, because it will get cleared if
+ /* Buffer ROUTE_ENTRY_CHANGED here, because it will get cleared if
* fib == selected */
bool selected_changed = new_selected && CHECK_FLAG(new_selected->status,
- RIB_ENTRY_CHANGED);
+ ROUTE_ENTRY_CHANGED);
/* Update fib according to selection results */
if (new_fib && old_fib)
@@ -1718,7 +1700,7 @@ rib_process (struct route_node *rn)
if (new_selected && new_selected != new_fib)
{
nexthop_active_update(rn, new_selected, 1);
- UNSET_FLAG(new_selected->status, RIB_ENTRY_CHANGED);
+ UNSET_FLAG(new_selected->status, ROUTE_ENTRY_CHANGED);
}
if (old_selected)
@@ -1737,17 +1719,17 @@ rib_process (struct route_node *rn)
}
}
- /* Remove all RIB entries queued for removal */
- RNODE_FOREACH_RIB_SAFE (rn, rib, next)
+ /* Remove all RE entries queued for removal */
+ RNODE_FOREACH_RE_SAFE (rn, re, next)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
{
if (IS_ZEBRA_DEBUG_RIB)
{
- rnode_debug (rn, vrf_id, "rn %p, removing rib %p",
- (void *)rn, (void *)rib);
+ rnode_debug (rn, vrf_id, "rn %p, removing re %p",
+ (void *)rn, (void *)re);
}
- rib_unlink(rn, rib);
+ rib_unlink(rn, re);
}
}
@@ -1884,11 +1866,11 @@ static const u_char meta_queue_map[ZEBRA_ROUTE_MAX] = {
static void
rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn)
{
- struct rib *rib;
+ struct route_entry *re;
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- u_char qindex = meta_queue_map[rib->type];
+ u_char qindex = meta_queue_map[re->type];
struct zebra_vrf *zvrf;
/* Invariant: at this point we always have rn->info set. */
@@ -1896,7 +1878,7 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn)
RIB_ROUTE_QUEUED (qindex)))
{
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- rnode_debug (rn, rib->vrf_id, "rn %p is already queued in sub-queue %u",
+ rnode_debug (rn, re->vrf_id, "rn %p is already queued in sub-queue %u",
(void *)rn, qindex);
continue;
}
@@ -1907,10 +1889,10 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn)
mq->size++;
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- rnode_debug (rn, rib->vrf_id, "queued rn %p into sub-queue %u",
+ rnode_debug (rn, re->vrf_id, "queued rn %p into sub-queue %u",
(void *)rn, qindex);
- zvrf = zebra_vrf_lookup_by_id (rib->vrf_id);
+ zvrf = zebra_vrf_lookup_by_id (re->vrf_id);
if (zvrf)
zvrf->flags |= ZEBRA_VRF_RIB_SCHEDULED;
}
@@ -2019,22 +2001,22 @@ rib_queue_init (struct zebra_t *zebra)
* The queue length is bounded by the maximal size of the routing table,
* as a route_node will not be requeued, if already queued.
*
- * RIBs are submitted via rib_addnode or rib_delnode which set minimal
- * state, or static_install_route (when an existing RIB is updated)
+ * REs are submitted via rib_addnode or rib_delnode which set minimal
+ * state, or static_install_route (when an existing RE is updated)
* and then submit route_node to queue for best-path selection later.
- * Order of add/delete state changes are preserved for any given RIB.
+ * Order of add/delete state changes are preserved for any given RE.
*
- * Deleted RIBs are reaped during best-path selection.
+ * Deleted REs are reaped during best-path selection.
*
* rib_addnode
- * |-> rib_link or unset RIB_ENTRY_REMOVE |->Update kernel with
- * |-------->| | best RIB, if required
+ * |-> rib_link or unset ROUTE_ENTRY_REMOVE |->Update kernel with
+ * |-------->| | best RE, if required
* | |
* static_install->|->rib_addqueue...... -> rib_process
* | |
* |-------->| |-> rib_unlink
- * |-> set RIB_ENTRY_REMOVE |
- * rib_delnode (RIB freed)
+ * |-> set ROUTE_ENTRY_REMOVE |
+ * rib_delnode (RE freed)
*
* The 'info' pointer of a route_node points to a rib_dest_t
* ('dest'). Queueing state for a route_node is kept on the dest. The
@@ -2051,22 +2033,22 @@ rib_queue_init (struct zebra_t *zebra)
*
*/
-/* Add RIB to head of the route node. */
+/* Add RE to head of the route node. */
static void
-rib_link (struct route_node *rn, struct rib *rib, int process)
+rib_link (struct route_node *rn, struct route_entry *re, int process)
{
- struct rib *head;
+ struct route_entry *head;
rib_dest_t *dest;
afi_t afi;
const char *rmap_name;
- assert (rib && rn);
+ assert (re && rn);
dest = rib_dest_from_rnode (rn);
if (!dest)
{
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- rnode_debug (rn, rib->vrf_id, "rn %p adding dest", rn);
+ rnode_debug (rn, re->vrf_id, "rn %p adding dest", rn);
dest = XCALLOC (MTYPE_RIB_DEST, sizeof (rib_dest_t));
route_lock_node (rn); /* rn route table reference */
@@ -2077,17 +2059,17 @@ rib_link (struct route_node *rn, struct rib *rib, int process)
head = dest->routes;
if (head)
{
- head->prev = rib;
+ head->prev = re;
}
- rib->next = head;
- dest->routes = rib;
+ re->next = head;
+ dest->routes = re;
afi = (rn->p.family == AF_INET) ? AFI_IP :
(rn->p.family == AF_INET6) ? AFI_IP6 : AFI_MAX;
- if (is_zebra_import_table_enabled (afi, rib->table))
+ if (is_zebra_import_table_enabled (afi, re->table))
{
- rmap_name = zebra_get_import_table_route_map (afi, rib->table);
- zebra_add_import_table_entry(rn, rib, rmap_name);
+ rmap_name = zebra_get_import_table_route_map (afi, re->table);
+ zebra_add_import_table_entry(rn, re, rmap_name);
}
else
if (process)
@@ -2095,20 +2077,20 @@ rib_link (struct route_node *rn, struct rib *rib, int process)
}
void
-rib_addnode (struct route_node *rn, struct rib *rib, int process)
+rib_addnode (struct route_node *rn, struct route_entry *re, int process)
{
- /* RIB node has been un-removed before route-node is processed.
- * route_node must hence already be on the queue for processing..
+ /* RE node has been un-removed before route-node is processed.
+ * route_node must hence already be on the queue for processing..
*/
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
{
if (IS_ZEBRA_DEBUG_RIB)
- rnode_debug (rn, rib->vrf_id, "rn %p, un-removed rib %p", (void *)rn, (void *)rib);
+ rnode_debug (rn, re->vrf_id, "rn %p, un-removed re %p", (void *)rn, (void *)re);
- UNSET_FLAG (rib->status, RIB_ENTRY_REMOVED);
+ UNSET_FLAG (re->status, ROUTE_ENTRY_REMOVED);
return;
}
- rib_link (rn, rib, process);
+ rib_link (rn, re, process);
}
/*
@@ -2121,58 +2103,58 @@ rib_addnode (struct route_node *rn, struct rib *rib, int process)
* longer required to be deleted.
*/
void
-rib_unlink (struct route_node *rn, struct rib *rib)
+rib_unlink (struct route_node *rn, struct route_entry *re)
{
rib_dest_t *dest;
- assert (rn && rib);
+ assert (rn && re);
if (IS_ZEBRA_DEBUG_RIB)
- rnode_debug (rn, rib->vrf_id, "rn %p, rib %p", (void *)rn, (void *)rib);
+ rnode_debug (rn, re->vrf_id, "rn %p, re %p", (void *)rn, (void *)re);
dest = rib_dest_from_rnode (rn);
- if (rib->next)
- rib->next->prev = rib->prev;
+ if (re->next)
+ re->next->prev = re->prev;
- if (rib->prev)
- rib->prev->next = rib->next;
+ if (re->prev)
+ re->prev->next = re->next;
else
{
- dest->routes = rib->next;
+ dest->routes = re->next;
}
- /* free RIB and nexthops */
- zebra_deregister_rnh_static_nexthops (rib->vrf_id, rib->nexthop, rn);
- nexthops_free(rib->nexthop);
- XFREE (MTYPE_RIB, rib);
+ /* free RE and nexthops */
+ zebra_deregister_rnh_static_nexthops (re->vrf_id, re->nexthop, rn);
+ nexthops_free(re->nexthop);
+ XFREE (MTYPE_RE, re);
}
void
-rib_delnode (struct route_node *rn, struct rib *rib)
+rib_delnode (struct route_node *rn, struct route_entry *re)
{
afi_t afi;
if (IS_ZEBRA_DEBUG_RIB)
- rnode_debug (rn, rib->vrf_id, "rn %p, rib %p, removing", (void *)rn, (void *)rib);
- SET_FLAG (rib->status, RIB_ENTRY_REMOVED);
+ rnode_debug (rn, re->vrf_id, "rn %p, re %p, removing", (void *)rn, (void *)re);
+ SET_FLAG (re->status, ROUTE_ENTRY_REMOVED);
afi = (rn->p.family == AF_INET) ? AFI_IP :
(rn->p.family == AF_INET6) ? AFI_IP6 : AFI_MAX;
- if (is_zebra_import_table_enabled (afi, rib->table))
+ if (is_zebra_import_table_enabled (afi, re->table))
{
- zebra_del_import_table_entry(rn, rib);
+ zebra_del_import_table_entry(rn, re);
/* Just clean up if non main table */
if (IS_ZEBRA_DEBUG_RIB)
{
char buf[SRCDEST2STR_BUFFER];
srcdest_rnode2str(rn, buf, sizeof(buf));
- zlog_debug ("%u:%s: Freeing route rn %p, rib %p (type %d)",
- rib->vrf_id, buf, rn, rib, rib->type);
+ zlog_debug ("%u:%s: Freeing route rn %p, re %p (type %d)",
+ re->vrf_id, buf, rn, re, re->type);
}
- rib_unlink(rn, rib);
+ rib_unlink(rn, re);
}
else
{
@@ -2180,15 +2162,15 @@ rib_delnode (struct route_node *rn, struct rib *rib)
}
}
-/* This function dumps the contents of a given RIB entry into
+/* This function dumps the contents of a given RE entry into
* standard debug log. Calling function name and IP prefix in
* question are passed as 1st and 2nd arguments.
*/
-void _rib_dump (const char * func,
- union prefixconstptr pp,
- union prefixconstptr src_pp,
- const struct rib * rib)
+void _route_entry_dump (const char * func,
+ union prefixconstptr pp,
+ union prefixconstptr src_pp,
+ const struct route_entry * re)
{
const struct prefix *p = pp.p;
const struct prefix *src_p = src_pp.p;
@@ -2198,40 +2180,40 @@ void _rib_dump (const char * func,
struct nexthop *nexthop, *tnexthop;
int recursing;
- zlog_debug ("%s: dumping RIB entry %p for %s%s%s vrf %u", func, (const void *)rib,
+ zlog_debug ("%s: dumping RE entry %p for %s%s%s vrf %u", func, (const void *)re,
prefix2str(pp, straddr, sizeof(straddr)),
is_srcdst ? " from " : "",
is_srcdst ? prefix2str(src_pp, srcaddr, sizeof(srcaddr)) : "",
- rib->vrf_id);
+ re->vrf_id);
zlog_debug
(
"%s: refcnt == %lu, uptime == %lu, type == %u, instance == %d, table == %d",
func,
- rib->refcnt,
- (unsigned long) rib->uptime,
- rib->type,
- rib->instance,
- rib->table
+ re->refcnt,
+ (unsigned long) re->uptime,
+ re->type,
+ re->instance,
+ re->table
);
zlog_debug
(
"%s: metric == %u, mtu == %u, distance == %u, flags == %u, status == %u",
func,
- rib->metric,
- rib->mtu,
- rib->distance,
- rib->flags,
- rib->status
+ re->metric,
+ re->mtu,
+ re->distance,
+ re->flags,
+ re->status
);
zlog_debug
(
"%s: nexthop_num == %u, nexthop_active_num == %u",
func,
- rib->nexthop_num,
- rib->nexthop_active_num
+ re->nexthop_num,
+ re->nexthop_active_num
);
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
inet_ntop (p->family, &nexthop->gate, straddr, INET6_ADDRSTRLEN);
zlog_debug
@@ -2249,14 +2231,14 @@ void _rib_dump (const char * func,
}
/* This is an exported helper to rtm_read() to dump the strange
- * RIB entry found by rib_lookup_ipv4_route()
+ * RE entry found by rib_lookup_ipv4_route()
*/
void rib_lookup_and_dump (struct prefix_ipv4 * p, vrf_id_t vrf_id)
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
char prefix_buf[INET_ADDRSTRLEN];
/* Lookup table. */
@@ -2267,7 +2249,7 @@ void rib_lookup_and_dump (struct prefix_ipv4 * p, vrf_id_t vrf_id)
return;
}
- /* Scan the RIB table for exactly matching RIB entry. */
+ /* Scan the RIB table for exactly matching RE entry. */
rn = route_node_lookup (table, (struct prefix *) p);
/* No route for this prefix. */
@@ -2282,31 +2264,31 @@ void rib_lookup_and_dump (struct prefix_ipv4 * p, vrf_id_t vrf_id)
route_unlock_node (rn);
/* let's go */
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
zlog_debug
(
- "%s: rn %p, rib %p: %s, %s",
+ "%s: rn %p, re %p: %s, %s",
__func__,
(void *)rn,
- (void *)rib,
- (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED) ? "removed" : "NOT removed"),
- (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED) ? "selected" : "NOT selected")
+ (void *)re,
+ (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED) ? "removed" : "NOT removed"),
+ (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED) ? "selected" : "NOT selected")
);
- rib_dump (p, NULL, rib);
+ route_entry_dump (p, NULL, re);
}
}
/* Check if requested address assignment will fail due to another
* route being installed by zebra in FIB already. Take necessary
* actions, if needed: remove such a route from FIB and deSELECT
- * corresponding RIB entry. Then put affected RN into RIBQ head.
+ * corresponding RE entry. Then put affected RN into RIBQ head.
*/
void rib_lookup_and_pushup (struct prefix_ipv4 * p, vrf_id_t vrf_id)
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
unsigned changed = 0;
if (NULL == (table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id)))
@@ -2322,27 +2304,27 @@ void rib_lookup_and_pushup (struct prefix_ipv4 * p, vrf_id_t vrf_id)
/* Unlock node. */
route_unlock_node (rn);
- /* Check all RIB entries. In case any changes have to be done, requeue
+ /* 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)
- * comes before the RIBQ is processed, the new RIB entry will join
+ * comes before the RIBQ is processed, the new RE entry will join
* RIBQ record already on head. This is necessary for proper revalidation
- * of the rest of the RIB.
+ * of the rest of the RE.
*/
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB) &&
- ! RIB_SYSTEM_ROUTE (rib))
+ 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",
- rib->vrf_id, prefix2str(&rn->p, buf, sizeof(buf)));
- rib_dump (&rn->p, NULL, rib);
+ re->vrf_id, prefix2str(&rn->p, buf, sizeof(buf)));
+ route_entry_dump (&rn->p, NULL, re);
}
- rib_uninstall (rn, rib);
+ rib_uninstall (rn, re);
}
}
if (changed)
@@ -2351,16 +2333,16 @@ void rib_lookup_and_pushup (struct prefix_ipv4 * p, vrf_id_t vrf_id)
int
rib_add_multipath (afi_t afi, safi_t safi, struct prefix *p,
- struct prefix_ipv6 *src_p, struct rib *rib)
+ struct prefix_ipv6 *src_p, struct route_entry *re)
{
struct route_table *table;
struct route_node *rn;
- struct rib *same;
+ struct route_entry *same;
struct nexthop *nexthop;
int ret = 0;
int family;
- if (!rib)
+ if (!re)
return 0;
if (p->family == AF_INET)
@@ -2371,7 +2353,7 @@ rib_add_multipath (afi_t afi, safi_t safi, struct prefix *p,
assert(!src_p || family == AFI_IP6);
/* Lookup table. */
- table = zebra_vrf_table_with_table_id (family, safi, rib->vrf_id, rib->table);
+ table = zebra_vrf_table_with_table_id (family, safi, re->vrf_id, re->table);
if (! table)
return 0;
@@ -2381,14 +2363,14 @@ rib_add_multipath (afi_t afi, safi_t safi, struct prefix *p,
apply_mask_ipv6 (src_p);
/* Set default distance by route type. */
- if (rib->distance == 0)
+ if (re->distance == 0)
{
- rib->distance = route_info[rib->type].distance;
+ re->distance = route_info[re->type].distance;
/* iBGP distance is 200. */
- if (rib->type == ZEBRA_ROUTE_BGP
- && CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
- rib->distance = 200;
+ if (re->type == ZEBRA_ROUTE_BGP
+ && CHECK_FLAG (re->flags, ZEBRA_FLAG_IBGP))
+ re->distance = 200;
}
/* Lookup route node.*/
@@ -2396,32 +2378,32 @@ rib_add_multipath (afi_t afi, safi_t safi, struct prefix *p,
/* If same type of route are installed, treat it as a implicit
withdraw. */
- RNODE_FOREACH_RIB (rn, same)
+ RNODE_FOREACH_RE (rn, same)
{
- if (CHECK_FLAG (same->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (same->status, ROUTE_ENTRY_REMOVED))
continue;
- if (same->type == rib->type && same->instance == rib->instance
- && same->table == rib->table
+ if (same->type == re->type && same->instance == re->instance
+ && same->table == re->table
&& same->type != ZEBRA_ROUTE_CONNECT)
break;
}
/* If this route is kernel route, set FIB flag to the route. */
- if (rib->type == ZEBRA_ROUTE_KERNEL || rib->type == ZEBRA_ROUTE_CONNECT)
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ if (re->type == ZEBRA_ROUTE_KERNEL || re->type == ZEBRA_ROUTE_CONNECT)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
- /* Link new rib to node.*/
+ /* Link new re to node.*/
if (IS_ZEBRA_DEBUG_RIB)
{
- rnode_debug(rn, rib->vrf_id, "Inserting route rn %p, rib %p (type %d) existing %p",
- (void *)rn, (void *)rib, rib->type, (void *)same);
+ rnode_debug(rn, re->vrf_id, "Inserting route rn %p, re %p (type %d) existing %p",
+ (void *)rn, (void *)re, re->type, (void *)same);
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- rib_dump (p, src_p, rib);
+ route_entry_dump (p, src_p, re);
}
- rib_addnode (rn, rib, 1);
+ rib_addnode (rn, re, 1);
ret = 1;
/* Free implicit route.*/
@@ -2442,9 +2424,9 @@ rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
- struct rib *fib = NULL;
- struct rib *same = NULL;
+ struct route_entry *re;
+ struct route_entry *fib = NULL;
+ struct route_entry *same = NULL;
struct nexthop *nexthop, *tnexthop;
int recursing;
char buf2[INET6_ADDRSTRLEN];
@@ -2482,31 +2464,31 @@ rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
}
/* Lookup same type route. */
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
- fib = rib;
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_SELECTED_FIB))
+ fib = re;
- if (rib->type != type)
+ if (re->type != type)
continue;
- if (rib->instance != instance)
+ if (re->instance != instance)
continue;
- if (rib->type == ZEBRA_ROUTE_CONNECT && (nexthop = rib->nexthop) &&
+ if (re->type == ZEBRA_ROUTE_CONNECT && (nexthop = re->nexthop) &&
nexthop->type == NEXTHOP_TYPE_IFINDEX)
{
if (nexthop->ifindex != ifindex)
continue;
- if (rib->refcnt)
+ if (re->refcnt)
{
- rib->refcnt--;
+ re->refcnt--;
route_unlock_node (rn);
route_unlock_node (rn);
return;
}
- same = rib;
+ same = re;
break;
}
/* Make sure that the route found has the same gateway. */
@@ -2514,14 +2496,14 @@ rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
{
if (gate == NULL)
{
- same = rib;
+ same = re;
break;
}
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
if (IPV4_ADDR_SAME (&nexthop->gate.ipv4, gate) ||
IPV6_ADDR_SAME (&nexthop->gate.ipv6, gate))
{
- same = rib;
+ same = re;
break;
}
if (same)
@@ -2537,7 +2519,7 @@ rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
{
if (IS_ZEBRA_DEBUG_RIB)
{
- rnode_debug (rn, vrf_id, "rn %p, rib %p (type %d) was deleted from kernel, adding",
+ rnode_debug (rn, vrf_id, "rn %p, re %p (type %d) was deleted from kernel, adding",
rn, fib, fib->type);
}
if (allow_delete)
@@ -2546,7 +2528,7 @@ rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
for (nexthop = fib->nexthop; nexthop; nexthop = nexthop->next)
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
- UNSET_FLAG (fib->status, RIB_ENTRY_SELECTED_FIB);
+ UNSET_FLAG (fib->status, ROUTE_ENTRY_SELECTED_FIB);
}
else
{
@@ -2592,8 +2574,8 @@ rib_add (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
u_int32_t table_id, u_int32_t metric, u_int32_t mtu,
u_char distance)
{
- struct rib *rib;
- struct rib *same = NULL;
+ struct route_entry *re;
+ struct route_entry *same = NULL;
struct route_table *table;
struct route_node *rn;
struct nexthop *nexthop;
@@ -2628,44 +2610,44 @@ rib_add (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
/* If same type of route are installed, treat it as a implicit
withdraw. */
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (rib->type != type)
+ if (re->type != type)
continue;
- if (rib->instance != instance)
+ if (re->instance != instance)
continue;
- if (rib->type != ZEBRA_ROUTE_CONNECT)
+ if (re->type != ZEBRA_ROUTE_CONNECT)
{
- same = rib;
+ same = re;
break;
}
/* Duplicate connected route comes in. */
- else if ((nexthop = rib->nexthop) &&
+ else if ((nexthop = re->nexthop) &&
nexthop->type == NEXTHOP_TYPE_IFINDEX &&
nexthop->ifindex == ifindex &&
- !CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ !CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
{
- rib->refcnt++;
+ re->refcnt++;
return 0 ;
}
}
- /* Allocate new rib structure. */
- rib = XCALLOC (MTYPE_RIB, sizeof (struct rib));
+ /* Allocate new re structure. */
+ re = XCALLOC (MTYPE_RE, sizeof (struct route_entry));
- rib->type = type;
- rib->instance = instance;
- rib->distance = distance;
- rib->flags = flags;
- rib->metric = metric;
- rib->mtu = mtu;
- rib->table = table_id;
- rib->vrf_id = vrf_id;
- rib->nexthop_num = 0;
- rib->uptime = time (NULL);
+ re->type = type;
+ re->instance = instance;
+ re->distance = distance;
+ re->flags = flags;
+ re->metric = metric;
+ re->mtu = mtu;
+ re->table = table_id;
+ re->vrf_id = vrf_id;
+ re->nexthop_num = 0;
+ re->uptime = time (NULL);
/* Nexthop settings. */
if (gate)
@@ -2673,36 +2655,36 @@ rib_add (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
if (afi == AFI_IP6)
{
if (ifindex)
- rib_nexthop_ipv6_ifindex_add (rib, &gate->ipv6, ifindex);
+ route_entry_nexthop_ipv6_ifindex_add (re, &gate->ipv6, ifindex);
else
- rib_nexthop_ipv6_add (rib, &gate->ipv6);
+ route_entry_nexthop_ipv6_add (re, &gate->ipv6);
}
else
{
if (ifindex)
- rib_nexthop_ipv4_ifindex_add (rib, &gate->ipv4, &src->ipv4, ifindex);
+ route_entry_nexthop_ipv4_ifindex_add (re, &gate->ipv4, &src->ipv4, ifindex);
else
- rib_nexthop_ipv4_add (rib, &gate->ipv4, &src->ipv4);
+ route_entry_nexthop_ipv4_add (re, &gate->ipv4, &src->ipv4);
}
}
else
- rib_nexthop_ifindex_add (rib, ifindex);
+ route_entry_nexthop_ifindex_add (re, ifindex);
/* If this route is kernel route, set FIB flag to the route. */
if (type == ZEBRA_ROUTE_KERNEL || type == ZEBRA_ROUTE_CONNECT)
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
/* Link new rib to node.*/
if (IS_ZEBRA_DEBUG_RIB)
{
- rnode_debug (rn, vrf_id, "Inserting route rn %p, rib %p (type %d) existing %p",
- (void *)rn, (void *)rib, rib->type, (void *)same);
+ rnode_debug (rn, vrf_id, "Inserting route rn %p, re %p (type %d) existing %p",
+ (void *)rn, (void *)re, re->type, (void *)same);
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- rib_dump (p, src_p, rib);
+ route_entry_dump (p, src_p, re);
}
- rib_addnode (rn, rib, 1);
+ rib_addnode (rn, re, 1);
/* Free implicit route.*/
if (same)
@@ -2717,7 +2699,7 @@ static void
rib_update_table (struct route_table *table, rib_update_event_t event)
{
struct route_node *rn;
- struct rib *rib, *next;
+ struct route_entry *re, *next;
/* Walk all routes and queue for processing, if appropriate for
* the trigger event.
@@ -2733,16 +2715,16 @@ rib_update_table (struct route_table *table, rib_update_event_t event)
* triggered upon an interface event as connected routes always
* get queued for processing.
*/
- RNODE_FOREACH_RIB_SAFE (rn, rib, next)
+ RNODE_FOREACH_RE_SAFE (rn, re, next)
{
- if (rib->type == ZEBRA_ROUTE_OSPF ||
- rib->type == ZEBRA_ROUTE_OSPF6 ||
- rib->type == ZEBRA_ROUTE_BGP)
+ if (re->type == ZEBRA_ROUTE_OSPF ||
+ re->type == ZEBRA_ROUTE_OSPF6 ||
+ re->type == ZEBRA_ROUTE_BGP)
continue; /* protocol will handle. */
- else if (rib->type == ZEBRA_ROUTE_STATIC)
+ else if (re->type == ZEBRA_ROUTE_STATIC)
{
struct nexthop *nh;
- for (nh = rib->nexthop; nh; nh = nh->next)
+ for (nh = re->nexthop; nh; nh = nh->next)
if (!(nh->type == NEXTHOP_TYPE_IPV4 ||
nh->type == NEXTHOP_TYPE_IPV6))
break;
@@ -2794,19 +2776,19 @@ static void
rib_weed_table (struct route_table *table)
{
struct route_node *rn;
- struct rib *rib;
- struct rib *next;
+ struct route_entry *re;
+ struct route_entry *next;
if (table)
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB_SAFE (rn, rib, next)
+ RNODE_FOREACH_RE_SAFE (rn, re, next)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (rib->table != zebrad.rtm_table_default &&
- rib->table != RT_TABLE_MAIN)
- rib_delnode (rn, rib);
+ if (re->table != zebrad.rtm_table_default &&
+ re->table != RT_TABLE_MAIN)
+ rib_delnode (rn, re);
}
}
@@ -2830,23 +2812,23 @@ static void
rib_sweep_table (struct route_table *table)
{
struct route_node *rn;
- struct rib *rib;
- struct rib *next;
+ struct route_entry *re;
+ struct route_entry *next;
int ret = 0;
if (table)
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB_SAFE (rn, rib, next)
+ RNODE_FOREACH_RE_SAFE (rn, re, next)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (rib->type == ZEBRA_ROUTE_KERNEL &&
- CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELFROUTE))
+ if (re->type == ZEBRA_ROUTE_KERNEL &&
+ CHECK_FLAG (re->flags, ZEBRA_FLAG_SELFROUTE))
{
- ret = rib_uninstall_kernel (rn, rib);
+ ret = rib_uninstall_kernel (rn, re);
if (! ret)
- rib_delnode (rn, rib);
+ rib_delnode (rn, re);
}
}
}
@@ -2871,19 +2853,19 @@ static unsigned long
rib_score_proto_table (u_char proto, u_short instance, struct route_table *table)
{
struct route_node *rn;
- struct rib *rib;
- struct rib *next;
+ struct route_entry *re;
+ struct route_entry *next;
unsigned long n = 0;
if (table)
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB_SAFE (rn, rib, next)
+ RNODE_FOREACH_RE_SAFE (rn, re, next)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (rib->type == proto && rib->instance == instance)
+ if (re->type == proto && re->instance == instance)
{
- rib_delnode (rn, rib);
+ rib_delnode (rn, re);
n++;
}
}
@@ -2912,20 +2894,20 @@ rib_close_table (struct route_table *table)
{
struct route_node *rn;
rib_table_info_t *info = table->info;
- struct rib *rib;
+ struct route_entry *re;
if (table)
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (!CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
+ if (!CHECK_FLAG (re->status, ROUTE_ENTRY_SELECTED_FIB))
continue;
if (info->safi == SAFI_UNICAST)
hook_call(rib_update, rn, NULL);
- if (! RIB_SYSTEM_ROUTE (rib))
- rib_uninstall_kernel (rn, rib);
+ if (! RIB_SYSTEM_ROUTE (re))
+ rib_uninstall_kernel (rn, re);
}
}
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 16c157e30..66b1cc78c 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -48,8 +48,8 @@
#include "zebra/interface.h"
#include "zebra/zebra_memory.h"
-static void free_state(vrf_id_t vrf_id, struct rib *rib, struct route_node *rn);
-static void copy_state(struct rnh *rnh, struct rib *rib,
+static void free_state(vrf_id_t vrf_id, struct route_entry *re, struct route_node *rn);
+static void copy_state(struct rnh *rnh, struct route_entry *re,
struct route_node *rn);
#define lookup_rnh_table(v, f) \
({ \
@@ -61,7 +61,7 @@ static void copy_state(struct rnh *rnh, struct rib *rib,
t; \
})
-static int compare_state(struct rib *r1, struct rib *r2);
+static int compare_state(struct route_entry *r1, struct route_entry *r2);
static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type,
vrf_id_t vrf_id);
static void print_rnh(struct route_node *rn, struct vty *vty);
@@ -305,7 +305,7 @@ zebra_deregister_rnh_static_nexthops (vrf_id_t vrf_id, struct nexthop *nexthop,
*/
static int
zebra_rnh_apply_nht_rmap(int family, struct route_node *prn,
- struct rib *rib, int proto)
+ struct route_entry *re, int proto)
{
int at_least_one = 0;
int rmap_family; /* Route map has diff AF family enum */
@@ -314,11 +314,11 @@ zebra_rnh_apply_nht_rmap(int family, struct route_node *prn,
rmap_family = (family == AF_INET) ? AFI_IP : AFI_IP6;
- if (prn && rib)
+ if (prn && re)
{
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
{
- ret = zebra_nht_route_map_check(rmap_family, proto, &prn->p, rib,
+ ret = zebra_nht_route_map_check(rmap_family, proto, &prn->p, re,
nexthop);
if (ret != RMAP_DENYMATCH)
{
@@ -335,17 +335,17 @@ zebra_rnh_apply_nht_rmap(int family, struct route_node *prn,
}
/*
- * Determine appropriate route (RIB entry) resolving a tracked entry
+ * Determine appropriate route (RE entry) resolving a tracked entry
* (nexthop or BGP route for import).
*/
-static struct rib *
+static struct route_entry *
zebra_rnh_resolve_entry (vrf_id_t vrfid, int family, rnh_type_t type,
struct route_node *nrn, struct rnh *rnh,
struct route_node **prn)
{
struct route_table *route_table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
*prn = NULL;
@@ -363,29 +363,29 @@ zebra_rnh_resolve_entry (vrf_id_t vrfid, int family, rnh_type_t type,
if ((type == RNH_NEXTHOP_TYPE) &&
(is_default_prefix (&rn->p) &&
!nh_resolve_via_default(rn->p.family)))
- rib = NULL;
+ re = NULL;
else if ((type == RNH_IMPORT_CHECK_TYPE) &&
CHECK_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH) &&
!prefix_same(&nrn->p, &rn->p))
- rib = NULL;
+ re = NULL;
else
{
/* Identify appropriate route entry. */
- RNODE_FOREACH_RIB(rn, rib)
+ RNODE_FOREACH_RE(rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (! CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
+ if (! CHECK_FLAG (re->status, ROUTE_ENTRY_SELECTED_FIB))
continue;
if (CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
{
- if (rib->type == ZEBRA_ROUTE_CONNECT)
+ if (re->type == ZEBRA_ROUTE_CONNECT)
break;
- if (rib->type == ZEBRA_ROUTE_NHRP)
+ if (re->type == ZEBRA_ROUTE_NHRP)
{
struct nexthop *nexthop;
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
if (nexthop->type == NEXTHOP_TYPE_IFINDEX)
break;
if (nexthop)
@@ -393,7 +393,7 @@ zebra_rnh_resolve_entry (vrf_id_t vrfid, int family, rnh_type_t type,
}
}
else if ((type == RNH_IMPORT_CHECK_TYPE) &&
- (rib->type == ZEBRA_ROUTE_BGP))
+ (re->type == ZEBRA_ROUTE_BGP))
continue;
else
break;
@@ -402,9 +402,9 @@ zebra_rnh_resolve_entry (vrf_id_t vrfid, int family, rnh_type_t type,
/* Need to unlock route node */
route_unlock_node(rn);
- if (rib)
+ if (re)
*prn = rn;
- return rib;
+ return re;
}
/*
@@ -414,7 +414,7 @@ zebra_rnh_resolve_entry (vrf_id_t vrfid, int family, rnh_type_t type,
static void
zebra_rnh_eval_import_check_entry (vrf_id_t vrfid, int family, int force,
struct route_node *nrn, struct rnh *rnh,
- struct rib *rib)
+ struct route_entry *re)
{
int state_changed = 0;
struct zserv *client;
@@ -423,20 +423,20 @@ zebra_rnh_eval_import_check_entry (vrf_id_t vrfid, int family, int force,
struct nexthop *nexthop, *tnexthop;
int recursing;
- if (rib && (rnh->state == NULL))
+ if (re && (rnh->state == NULL))
{
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
{
state_changed = 1;
break;
}
}
- else if (!rib && (rnh->state != NULL))
+ else if (!re && (rnh->state != NULL))
state_changed = 1;
- if (compare_state(rib, rnh->state))
- copy_state(rnh, rib, nrn);
+ if (compare_state(re, rnh->state))
+ copy_state(rnh, re, nrn);
if (state_changed || force)
{
@@ -461,7 +461,7 @@ zebra_rnh_eval_import_check_entry (vrf_id_t vrfid, int family, int force,
static void
zebra_rnh_notify_protocol_clients (vrf_id_t vrfid, int family,
struct route_node *nrn, struct rnh *rnh,
- struct route_node *prn, struct rib *rib)
+ struct route_node *prn, struct route_entry *re)
{
struct listnode *node;
struct zserv *client;
@@ -472,7 +472,7 @@ zebra_rnh_notify_protocol_clients (vrf_id_t vrfid, int family,
if (IS_ZEBRA_DEBUG_NHT)
{
prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
- if (prn && rib)
+ if (prn && re)
{
prefix2str(&prn->p, bufp, INET6_ADDRSTRLEN);
zlog_debug("%u:%s: NH resolved over route %s", vrfid, bufn, bufp);
@@ -483,12 +483,12 @@ zebra_rnh_notify_protocol_clients (vrf_id_t vrfid, int family,
for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client))
{
- if (prn && rib)
+ if (prn && re)
{
/* Apply route-map for this client to route resolving this
* nexthop to see if it is filtered or not.
*/
- num_resolving_nh = zebra_rnh_apply_nht_rmap(family, prn, rib,
+ num_resolving_nh = zebra_rnh_apply_nht_rmap(family, prn, re,
client->proto);
if (num_resolving_nh)
rnh->filtered[client->proto] = 0;
@@ -515,12 +515,12 @@ zebra_rnh_notify_protocol_clients (vrf_id_t vrfid, int family,
static void
zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
struct route_node *nrn, struct rnh *rnh,
- struct route_node *prn, struct rib *rib)
+ struct route_node *prn, struct route_entry *re)
{
struct listnode *node;
int num_resolving_nh = 0;
struct route_node *static_rn;
- struct rib *srib;
+ struct route_entry *sre;
struct nexthop *nexthop;
char bufn[INET6_ADDRSTRLEN];
char bufp[INET6_ADDRSTRLEN];
@@ -533,12 +533,12 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
prefix2str(&prn->p, bufp, INET6_ADDRSTRLEN);
}
- if (prn && rib)
+ if (prn && re)
{
/* Apply route-map for "static" to route resolving this
* nexthop to see if it is filtered or not.
*/
- num_resolving_nh = zebra_rnh_apply_nht_rmap(family, prn, rib,
+ num_resolving_nh = zebra_rnh_apply_nht_rmap(family, prn, re,
ZEBRA_ROUTE_STATIC);
if (num_resolving_nh)
rnh->filtered[ZEBRA_ROUTE_STATIC] = 0;
@@ -552,15 +552,15 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
for (ALL_LIST_ELEMENTS_RO(rnh->zebra_static_route_list, node,
static_rn))
{
- RNODE_FOREACH_RIB(static_rn, srib)
+ RNODE_FOREACH_RE(static_rn, sre)
{
- if (srib->type != ZEBRA_ROUTE_STATIC)
+ if (sre->type != ZEBRA_ROUTE_STATIC)
continue;
/* Set the filter flag for the correct nexthop - static route may
* be having multiple. We care here only about registered nexthops.
*/
- for (nexthop = srib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = sre->nexthop; nexthop; nexthop = nexthop->next)
{
switch (nexthop->type)
{
@@ -593,7 +593,7 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
if (IS_ZEBRA_DEBUG_NHT)
{
prefix2str(&static_rn->p, bufs, INET6_ADDRSTRLEN);
- if (prn && rib)
+ if (prn && re)
zlog_debug("%u:%s: NH change %s, scheduling static route %s",
vrfid, bufn, num_resolving_nh ?
"" : "(filtered by route-map)", bufs);
@@ -602,8 +602,8 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
vrfid, bufn, bufs);
}
- SET_FLAG(srib->status, RIB_ENTRY_CHANGED);
- SET_FLAG(srib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
+ SET_FLAG(sre->status, ROUTE_ENTRY_CHANGED);
+ SET_FLAG(sre->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
}
rib_queue_add(static_rn);
@@ -618,7 +618,7 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family,
static void
zebra_rnh_eval_nexthop_entry (vrf_id_t vrfid, int family, int force,
struct route_node *nrn, struct rnh *rnh,
- struct route_node *prn, struct rib *rib)
+ struct route_node *prn, struct route_entry *re)
{
int state_changed = 0;
@@ -633,12 +633,12 @@ zebra_rnh_eval_nexthop_entry (vrf_id_t vrfid, int family, int force,
else
memset(&rnh->resolved_route, 0, sizeof(struct prefix));
- copy_state(rnh, rib, nrn);
+ copy_state(rnh, re, nrn);
state_changed = 1;
}
- else if (compare_state(rib, rnh->state))
+ else if (compare_state(re, rnh->state))
{
- copy_state(rnh, rib, nrn);
+ copy_state(rnh, re, nrn);
state_changed = 1;
}
@@ -663,7 +663,7 @@ zebra_rnh_evaluate_entry (vrf_id_t vrfid, int family, int force, rnh_type_t type
struct route_node *nrn)
{
struct rnh *rnh;
- struct rib *rib;
+ struct route_entry *re;
struct route_node *prn;
char bufn[INET6_ADDRSTRLEN];
@@ -676,31 +676,31 @@ zebra_rnh_evaluate_entry (vrf_id_t vrfid, int family, int force, rnh_type_t type
rnh = nrn->info;
- /* Identify route entry (RIB) resolving this tracked entry. */
- rib = zebra_rnh_resolve_entry (vrfid, family, type, nrn, rnh, &prn);
+ /* Identify route entry (RE) resolving this tracked entry. */
+ re = zebra_rnh_resolve_entry (vrfid, family, type, nrn, rnh, &prn);
/* If the entry cannot be resolved and that is also the existing state,
* there is nothing further to do.
*/
- if (!rib && rnh->state == NULL && !force)
+ if (!re && rnh->state == NULL && !force)
return;
/* Process based on type of entry. */
if (type == RNH_IMPORT_CHECK_TYPE)
zebra_rnh_eval_import_check_entry (vrfid, family, force,
- nrn, rnh, rib);
+ nrn, rnh, re);
else
zebra_rnh_eval_nexthop_entry (vrfid, family, force,
- nrn, rnh, prn, rib);
+ nrn, rnh, prn, re);
}
/*
- * Clear the RIB_ENTRY_NEXTHOPS_CHANGED flag
- * from the rib entries.
+ * Clear the ROUTE_ENTRY_NEXTHOPS_CHANGED flag
+ * from the re entries.
*
* Please note we are doing this *after* we have
* notified the world about each nexthop as that
- * we can have a situation where one rib entry
+ * we can have a situation where one re entry
* covers multiple nexthops we are interested in.
*/
static void
@@ -708,15 +708,15 @@ zebra_rnh_clear_nhc_flag (vrf_id_t vrfid, int family, rnh_type_t type,
struct route_node *nrn)
{
struct rnh *rnh;
- struct rib *rib;
+ struct route_entry *re;
struct route_node *prn;
rnh = nrn->info;
- rib = zebra_rnh_resolve_entry (vrfid, family, type, nrn, rnh, &prn);
+ re = zebra_rnh_resolve_entry (vrfid, family, type, nrn, rnh, &prn);
- if (rib)
- UNSET_FLAG (rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
+ if (re)
+ UNSET_FLAG (re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
}
/* Evaluate all tracked entries (nexthops or routes for import into BGP)
@@ -812,25 +812,25 @@ zebra_cleanup_rnh_client (vrf_id_t vrf_id, int family, struct zserv *client,
}
/**
- * free_state - free up the rib structure associated with the rnh.
+ * free_state - free up the re structure associated with the rnh.
*/
static void
-free_state (vrf_id_t vrf_id, struct rib *rib, struct route_node *rn)
+free_state (vrf_id_t vrf_id, struct route_entry *re, struct route_node *rn)
{
- if (!rib)
+ if (!re)
return;
- /* free RIB and nexthops */
- zebra_deregister_rnh_static_nexthops (vrf_id, rib->nexthop, rn);
- nexthops_free(rib->nexthop);
- XFREE (MTYPE_RIB, rib);
+ /* free RE and nexthops */
+ zebra_deregister_rnh_static_nexthops (vrf_id, re->nexthop, rn);
+ nexthops_free(re->nexthop);
+ XFREE (MTYPE_RE, re);
}
static void
-copy_state (struct rnh *rnh, struct rib *rib, struct route_node *rn)
+copy_state (struct rnh *rnh, struct route_entry *re, struct route_node *rn)
{
- struct rib *state;
+ struct route_entry *state;
struct nexthop *nh;
if (rnh->state)
@@ -839,20 +839,20 @@ copy_state (struct rnh *rnh, struct rib *rib, struct route_node *rn)
rnh->state = NULL;
}
- if (!rib)
+ if (!re)
return;
- state = XCALLOC (MTYPE_RIB, sizeof (struct rib));
- state->type = rib->type;
- state->metric = rib->metric;
+ state = XCALLOC (MTYPE_RE, sizeof (struct route_entry));
+ state->type = re->type;
+ state->metric = re->metric;
- for (nh = rib->nexthop; nh; nh = nh->next)
- rib_copy_nexthops(state, nh);
+ for (nh = re->nexthop; nh; nh = nh->next)
+ route_entry_copy_nexthops(state, nh);
rnh->state = state;
}
static int
-compare_state (struct rib *r1, struct rib *r2)
+compare_state (struct route_entry *r1, struct route_entry *r2)
{
if (!r1 && !r2)
@@ -867,7 +867,7 @@ compare_state (struct rib *r1, struct rib *r2)
if (r1->nexthop_num != r2->nexthop_num)
return 1;
- if (CHECK_FLAG(r1->status, RIB_ENTRY_NEXTHOPS_CHANGED))
+ if (CHECK_FLAG(r1->status, ROUTE_ENTRY_NEXTHOPS_CHANGED))
return 1;
return 0;
@@ -877,7 +877,7 @@ static int
send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vrf_id)
{
struct stream *s;
- struct rib *rib;
+ struct route_entry *re;
unsigned long nump;
u_char num;
struct nexthop *nexthop;
@@ -886,7 +886,7 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr
? ZEBRA_IMPORT_CHECK_UPDATE : ZEBRA_NEXTHOP_UPDATE;
rn = rnh->node;
- rib = rnh->state;
+ re = rnh->state;
/* Get output stream. */
s = client->obuf;
@@ -910,14 +910,14 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr
__FUNCTION__, rn->p.family);
break;
}
- if (rib)
+ if (re)
{
- stream_putc (s, rib->distance);
- stream_putl (s, rib->metric);
+ stream_putc (s, re->distance);
+ stream_putl (s, re->metric);
num = 0;
nump = stream_get_endp(s);
stream_putc (s, 0);
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
if ((CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ||
CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) &&
CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h
index a75674d0c..d26b7be25 100644
--- a/zebra/zebra_rnh.h
+++ b/zebra/zebra_rnh.h
@@ -37,7 +37,7 @@ struct rnh
/* VRF identifier. */
vrf_id_t vrf_id;
- struct rib *state;
+ struct route_entry *state;
struct prefix resolved_route;
struct list *client_list;
struct list *zebra_static_route_list; /* static routes dependent on this NH */
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 4a81cb635..6ec43e592 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -1351,7 +1351,7 @@ zebra_del_import_table_route_map (afi_t afi, uint32_t table)
}
route_map_result_t
-zebra_import_table_route_map_check (int family, int rib_type, struct prefix *p,
+zebra_import_table_route_map_check (int family, int re_type, struct prefix *p,
struct nexthop *nexthop, vrf_id_t vrf_id, route_tag_t tag, const char *rmap_name)
{
struct route_map *rmap = NULL;
@@ -1360,11 +1360,11 @@ zebra_import_table_route_map_check (int family, int rib_type, struct prefix *p,
nh_obj.nexthop = nexthop;
nh_obj.vrf_id = vrf_id;
- nh_obj.source_protocol = rib_type;
+ nh_obj.source_protocol = re_type;
nh_obj.metric = 0;
nh_obj.tag = tag;
- if (rib_type >= 0 && rib_type < ZEBRA_ROUTE_MAX)
+ if (re_type >= 0 && re_type < ZEBRA_ROUTE_MAX)
rmap = route_map_lookup_by_name (rmap_name);
if (rmap) {
ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj);
@@ -1375,17 +1375,17 @@ zebra_import_table_route_map_check (int family, int rib_type, struct prefix *p,
route_map_result_t
zebra_nht_route_map_check (int family, int client_proto, struct prefix *p,
- struct rib * rib, struct nexthop *nexthop)
+ struct route_entry * re, struct nexthop *nexthop)
{
struct route_map *rmap = NULL;
route_map_result_t ret = RMAP_MATCH;
struct nh_rmap_obj nh_obj;
nh_obj.nexthop = nexthop;
- nh_obj.vrf_id = rib->vrf_id;
- nh_obj.source_protocol = rib->type;
- nh_obj.metric = rib->metric;
- nh_obj.tag = rib->tag;
+ nh_obj.vrf_id = re->vrf_id;
+ nh_obj.source_protocol = re->type;
+ nh_obj.metric = re->metric;
+ nh_obj.tag = re->tag;
if (client_proto >= 0 && client_proto < ZEBRA_ROUTE_MAX)
rmap = route_map_lookup_by_name (nht_rm[family][client_proto]);
diff --git a/zebra/zebra_routemap.h b/zebra/zebra_routemap.h
index 94981a3cd..ac9cc40ef 100644
--- a/zebra/zebra_routemap.h
+++ b/zebra/zebra_routemap.h
@@ -43,7 +43,7 @@ extern route_map_result_t zebra_route_map_check (int family, int rib_type,
extern route_map_result_t zebra_nht_route_map_check (int family,
int client_proto,
struct prefix *p,
- struct rib *,
+ struct route_entry *,
struct nexthop *nexthop);
diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c
index 7c2e6697c..bb1cee784 100644
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -143,7 +143,7 @@ ipFwNumber (struct variable *v, oid objid[], size_t *objid_len,
static int result;
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
if (smux_header_generic(v, objid, objid_len, exact, val_len, write_method) == MATCH_FAILED)
return NULL;
@@ -155,7 +155,7 @@ ipFwNumber (struct variable *v, oid objid[], size_t *objid_len,
/* Return number of routing entries. */
result = 0;
for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
result++;
return (u_char *)&result;
@@ -168,7 +168,7 @@ ipCidrNumber (struct variable *v, oid objid[], size_t *objid_len,
static int result;
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
if (smux_header_generic(v, objid, objid_len, exact, val_len, write_method) == MATCH_FAILED)
return NULL;
@@ -180,7 +180,7 @@ ipCidrNumber (struct variable *v, oid objid[], size_t *objid_len,
/* Return number of routing entries. */
result = 0;
for (rn = route_top (table); rn; rn = route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
result++;
return (u_char *)&result;
@@ -256,15 +256,15 @@ proto_trans(int type)
}
static void
-check_replace(struct route_node *np2, struct rib *rib2,
- struct route_node **np, struct rib **rib)
+check_replace(struct route_node *np2, struct route_entry *re2,
+ struct route_node **np, struct route_entry **re)
{
int proto, proto2;
if (!*np)
{
*np = np2;
- *rib = rib2;
+ *re = re2;
return;
}
@@ -273,39 +273,39 @@ check_replace(struct route_node *np2, struct rib *rib2,
if (in_addr_cmp(&(*np)->p.u.prefix, &np2->p.u.prefix) > 0)
{
*np = np2;
- *rib = rib2;
+ *re = re2;
return;
}
- proto = proto_trans((*rib)->type);
- proto2 = proto_trans(rib2->type);
+ proto = proto_trans((*re)->type);
+ proto2 = proto_trans(re2->type);
if (proto2 > proto)
return;
if (proto2 < proto)
{
*np = np2;
- *rib = rib2;
+ *re = re2;
return;
}
- if (in_addr_cmp((u_char *)&(*rib)->nexthop->gate.ipv4,
- (u_char *)&rib2->nexthop->gate.ipv4) <= 0)
+ if (in_addr_cmp((u_char *)&(*re)->nexthop->gate.ipv4,
+ (u_char *)&re2->nexthop->gate.ipv4) <= 0)
return;
*np = np2;
- *rib = rib2;
+ *re = re2;
return;
}
static void
get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len,
- int exact, struct route_node **np, struct rib **rib)
+ int exact, struct route_node **np, struct route_entry **re)
{
struct in_addr dest;
struct route_table *table;
struct route_node *np2;
- struct rib *rib2;
+ struct route_entry *re2;
int proto;
int policy;
struct in_addr nexthop;
@@ -328,7 +328,7 @@ get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len,
/* Init return variables */
*np = NULL;
- *rib = NULL;
+ *re = NULL;
/* Short circuit exact matches of wrong length */
@@ -374,11 +374,11 @@ get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len,
{
if (!in_addr_cmp(&(*np)->p.u.prefix, (u_char *)&dest))
{
- RNODE_FOREACH_RIB (*np, *rib)
+ RNODE_FOREACH_RE (*np, *re)
{
- if (!in_addr_cmp((u_char *)&(*rib)->nexthop->gate.ipv4,
+ if (!in_addr_cmp((u_char *)&(*re)->nexthop->gate.ipv4,
(u_char *)&nexthop))
- if (proto == proto_trans((*rib)->type))
+ if (proto == proto_trans((*re)->type))
return;
}
}
@@ -393,34 +393,34 @@ get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len,
/* Check destination first */
if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) > 0)
- RNODE_FOREACH_RIB (np2, rib2)
- check_replace(np2, rib2, np, rib);
+ RNODE_FOREACH_RE (np2, re2)
+ check_replace(np2, re2, np, re);
if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) == 0)
- { /* have to look at each rib individually */
- RNODE_FOREACH_RIB (np2, rib2)
+ { /* have to look at each re individually */
+ RNODE_FOREACH_RE (np2, re2)
{
int proto2, policy2;
- proto2 = proto_trans(rib2->type);
+ proto2 = proto_trans(re2->type);
policy2 = 0;
if ((policy < policy2)
|| ((policy == policy2) && (proto < proto2))
|| ((policy == policy2) && (proto == proto2)
- && (in_addr_cmp((u_char *)&rib2->nexthop->gate.ipv4,
+ && (in_addr_cmp((u_char *)&re2->nexthop->gate.ipv4,
(u_char *) &nexthop) >= 0)
))
- check_replace(np2, rib2, np, rib);
+ check_replace(np2, re2, np, re);
}
}
}
- if (!*rib)
+ if (!*re)
return;
policy = 0;
- proto = proto_trans((*rib)->type);
+ proto = proto_trans((*re)->type);
*objid_len = v->namelen + 10;
pnt = (u_char *) &(*np)->p.u.prefix;
@@ -433,7 +433,7 @@ get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len,
{
struct nexthop *nexthop;
- nexthop = (*rib)->nexthop;
+ nexthop = (*re)->nexthop;
if (nexthop)
{
pnt = (u_char *) &nexthop->gate.ipv4;
@@ -450,7 +450,7 @@ ipFwTable (struct variable *v, oid objid[], size_t *objid_len,
int exact, size_t *val_len, WriteMethod **write_method)
{
struct route_node *np;
- struct rib *rib;
+ struct route_entry *re;
static int result;
static int resarr[2];
static struct in_addr netmask;
@@ -460,11 +460,11 @@ ipFwTable (struct variable *v, oid objid[], size_t *objid_len,
== MATCH_FAILED)
return NULL;
- get_fwtable_route_node(v, objid, objid_len, exact, &np, &rib);
+ get_fwtable_route_node(v, objid, objid_len, exact, &np, &re);
if (!np)
return NULL;
- nexthop = rib->nexthop;
+ nexthop = re->nexthop;
if (! nexthop)
return NULL;
@@ -501,7 +501,7 @@ ipFwTable (struct variable *v, oid objid[], size_t *objid_len,
return (u_char *)&result;
break;
case IPFORWARDPROTO:
- result = proto_trans(rib->type);
+ result = proto_trans(re->type);
*val_len = sizeof(int);
return (u_char *)&result;
break;
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index b218eb521..05336ca6b 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -40,7 +40,7 @@ void
static_install_route (afi_t afi, safi_t safi, struct prefix *p,
struct prefix_ipv6 *src_p, struct static_route *si)
{
- struct rib *rib;
+ struct route_entry *re;
struct route_node *rn;
struct route_table *table;
struct prefix nh_p;
@@ -55,20 +55,20 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
/* Lookup existing route */
rn = srcdest_rnode_get (table, p, src_p);
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (rib->type == ZEBRA_ROUTE_STATIC && rib->distance == si->distance)
+ if (re->type == ZEBRA_ROUTE_STATIC && re->distance == si->distance)
break;
}
- if (rib)
+ if (re)
{
/* if tag value changed , update old value in RIB */
- if (rib->tag != si->tag)
- rib->tag = si->tag;
+ if (re->tag != si->tag)
+ re->tag = si->tag;
/* Same distance static route is there. Update it with new
nexthop. */
@@ -76,27 +76,27 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
switch (si->type)
{
case STATIC_IPV4_GATEWAY:
- nexthop = rib_nexthop_ipv4_add (rib, &si->addr.ipv4, NULL);
+ nexthop = route_entry_nexthop_ipv4_add (re, &si->addr.ipv4, NULL);
nh_p.family = AF_INET;
nh_p.prefixlen = IPV4_MAX_BITLEN;
nh_p.u.prefix4 = si->addr.ipv4;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
case STATIC_IFINDEX:
- nexthop = rib_nexthop_ifindex_add (rib, si->ifindex);
+ nexthop = route_entry_nexthop_ifindex_add (re, si->ifindex);
break;
case STATIC_BLACKHOLE:
- nexthop = rib_nexthop_blackhole_add (rib);
+ nexthop = route_entry_nexthop_blackhole_add (re);
break;
case STATIC_IPV6_GATEWAY:
- nexthop = rib_nexthop_ipv6_add (rib, &si->addr.ipv6);
+ nexthop = route_entry_nexthop_ipv6_add (re, &si->addr.ipv6);
nh_p.family = AF_INET6;
nh_p.prefixlen = IPV6_MAX_BITLEN;
nh_p.u.prefix6 = si->addr.ipv6;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
case STATIC_IPV6_GATEWAY_IFINDEX:
- nexthop = rib_nexthop_ipv6_ifindex_add (rib, &si->addr.ipv6,
+ nexthop = route_entry_nexthop_ipv6_ifindex_add (re, &si->addr.ipv6,
si->ifindex);
break;
}
@@ -111,8 +111,8 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
if (IS_ZEBRA_DEBUG_RIB)
{
inet_ntop (p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN);
- zlog_debug ("%u:%s/%d: Modifying route rn %p, rib %p (type %d)",
- si->vrf_id, buf, p->prefixlen, rn, rib, rib->type);
+ zlog_debug ("%u:%s/%d: Modifying route rn %p, re %p (type %d)",
+ si->vrf_id, buf, p->prefixlen, rn, re, re->type);
}
}
/* Schedule route for processing or invoke NHT, as appropriate. */
@@ -125,42 +125,42 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
else
{
/* This is new static route. */
- rib = XCALLOC (MTYPE_RIB, sizeof (struct rib));
-
- rib->type = ZEBRA_ROUTE_STATIC;
- rib->instance = 0;
- rib->distance = si->distance;
- rib->metric = 0;
- rib->mtu = 0;
- rib->vrf_id = si->vrf_id;
- rib->table = si->vrf_id ? (zebra_vrf_lookup_by_id(si->vrf_id))->table_id : zebrad.rtm_table_default;
- rib->nexthop_num = 0;
- rib->tag = si->tag;
+ re = XCALLOC (MTYPE_RE, sizeof (struct route_entry));
+
+ re->type = ZEBRA_ROUTE_STATIC;
+ re->instance = 0;
+ re->distance = si->distance;
+ re->metric = 0;
+ re->mtu = 0;
+ re->vrf_id = si->vrf_id;
+ re->table = si->vrf_id ? (zebra_vrf_lookup_by_id(si->vrf_id))->table_id : zebrad.rtm_table_default;
+ re->nexthop_num = 0;
+ re->tag = si->tag;
switch (si->type)
{
case STATIC_IPV4_GATEWAY:
- nexthop = rib_nexthop_ipv4_add (rib, &si->addr.ipv4, NULL);
+ nexthop = route_entry_nexthop_ipv4_add (re, &si->addr.ipv4, NULL);
nh_p.family = AF_INET;
nh_p.prefixlen = IPV4_MAX_BITLEN;
nh_p.u.prefix4 = si->addr.ipv4;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
case STATIC_IFINDEX:
- nexthop = rib_nexthop_ifindex_add (rib, si->ifindex);
+ nexthop = route_entry_nexthop_ifindex_add (re, si->ifindex);
break;
case STATIC_BLACKHOLE:
- nexthop = rib_nexthop_blackhole_add (rib);
+ nexthop = route_entry_nexthop_blackhole_add (re);
break;
case STATIC_IPV6_GATEWAY:
- nexthop = rib_nexthop_ipv6_add (rib, &si->addr.ipv6);
+ nexthop = route_entry_nexthop_ipv6_add (re, &si->addr.ipv6);
nh_p.family = AF_INET6;
nh_p.prefixlen = IPV6_MAX_BITLEN;
nh_p.u.prefix6 = si->addr.ipv6;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
case STATIC_IPV6_GATEWAY_IFINDEX:
- nexthop = rib_nexthop_ipv6_ifindex_add (rib, &si->addr.ipv6,
+ nexthop = route_entry_nexthop_ipv6_ifindex_add (re, &si->addr.ipv6,
si->ifindex);
break;
}
@@ -170,7 +170,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
&si->snh_label.label[0]);
/* Save the flags of this static routes (reject, blackhole) */
- rib->flags = si->flags;
+ re->flags = si->flags;
if (IS_ZEBRA_DEBUG_RIB)
{
@@ -178,21 +178,21 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
if (IS_ZEBRA_DEBUG_RIB)
{
inet_ntop (p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN);
- zlog_debug ("%u:%s/%d: Inserting route rn %p, rib %p (type %d)",
- si->vrf_id, buf, p->prefixlen, rn, rib, rib->type);
+ zlog_debug ("%u:%s/%d: Inserting route rn %p, re %p (type %d)",
+ si->vrf_id, buf, p->prefixlen, rn, re, re->type);
}
}
- /* Link this rib to the tree. Schedule for processing or invoke NHT,
+ /* Link this re to the tree. Schedule for processing or invoke NHT,
* as appropriate.
*/
if (si->type == STATIC_IPV4_GATEWAY ||
si->type == STATIC_IPV6_GATEWAY)
{
- rib_addnode (rn, rib, 0);
+ rib_addnode (rn, re, 0);
zebra_evaluate_rnh(si->vrf_id, nh_p.family, 1, RNH_NEXTHOP_TYPE, &nh_p);
}
else
- rib_addnode (rn, rib, 1);
+ rib_addnode (rn, re, 1);
}
}
@@ -230,7 +230,7 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
struct prefix_ipv6 *src_p, struct static_route *si)
{
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
struct nexthop *nexthop;
struct route_table *table;
struct prefix nh_p;
@@ -245,24 +245,24 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
if (! rn)
return;
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
+ if (CHECK_FLAG (re->status, ROUTE_ENTRY_REMOVED))
continue;
- if (rib->type == ZEBRA_ROUTE_STATIC && rib->distance == si->distance &&
- rib->tag == si->tag)
+ if (re->type == ZEBRA_ROUTE_STATIC && re->distance == si->distance &&
+ re->tag == si->tag)
break;
}
- if (! rib)
+ if (! re)
{
route_unlock_node (rn);
return;
}
/* Lookup nexthop. */
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
if (static_nexthop_same (nexthop, si))
break;
@@ -274,8 +274,8 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
}
/* Check nexthop. */
- if (rib->nexthop_num == 1)
- rib_delnode (rn, rib);
+ if (re->nexthop_num == 1)
+ rib_delnode (rn, re);
else
{
/* Mark this nexthop as inactive and reinstall the route. Then, delete
@@ -288,31 +288,31 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
if (IS_ZEBRA_DEBUG_RIB)
{
inet_ntop (p->family, &p->u.prefix, buf, INET6_ADDRSTRLEN);
- zlog_debug ("%u:%s/%d: Modifying route rn %p, rib %p (type %d)",
- si->vrf_id, buf, p->prefixlen, rn, rib, rib->type);
+ zlog_debug ("%u:%s/%d: Modifying route rn %p, re %p (type %d)",
+ si->vrf_id, buf, p->prefixlen, rn, re, re->type);
}
}
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
{
/* If there are other active nexthops, do an update. */
- if (rib->nexthop_active_num > 1)
+ if (re->nexthop_active_num > 1)
{
/* Update route in kernel if it's in fib */
- if (CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- rib_install_kernel (rn, rib, rib);
+ if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
+ rib_install_kernel (rn, re, re);
/* Update redistribution if it's selected */
- if (CHECK_FLAG(rib->flags, ZEBRA_FLAG_SELECTED))
- redistribute_update (p, (struct prefix*)src_p, rib, NULL);
+ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
+ redistribute_update (p, (struct prefix*)src_p, re, NULL);
}
else
{
/* Remove from redistribute if selected route becomes inactive */
- if (CHECK_FLAG(rib->flags, ZEBRA_FLAG_SELECTED))
- redistribute_delete (p, (struct prefix*)src_p, rib);
+ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
+ redistribute_delete (p, (struct prefix*)src_p, re);
/* Remove from kernel if fib route becomes inactive */
- if (CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
- rib_uninstall_kernel (rn, rib);
+ if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
+ rib_uninstall_kernel (rn, re);
}
}
@@ -329,7 +329,7 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
nh_p.prefixlen = IPV6_MAX_BITLEN;
nh_p.u.prefix6 = nexthop->gate.ipv6;
}
- rib_nexthop_delete (rib, nexthop);
+ route_entry_nexthop_delete (re, nexthop);
zebra_deregister_rnh_static_nh(si->vrf_id, &nh_p, rn);
nexthop_free (nexthop);
}
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 94e250618..2a759c2e7 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -334,10 +334,10 @@ zebra_vrf_table_with_table_id (afi_t afi, safi_t safi,
static void
zebra_rtable_node_cleanup (struct route_table *table, struct route_node *node)
{
- struct rib *rib, *next;
+ struct route_entry *re, *next;
- RNODE_FOREACH_RIB_SAFE (node, rib, next)
- rib_unlink (node, rib);
+ RNODE_FOREACH_RE_SAFE (node, re, next)
+ rib_unlink (node, re);
if (node->info)
XFREE (MTYPE_RIB_DEST, node->info);
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index d0d761af9..c865a8ed1 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -321,7 +321,7 @@ DEFUN (show_ip_rpf_addr,
int idx_ipv4 = 3;
struct in_addr addr;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
int ret;
ret = inet_aton (argv[idx_ipv4]->arg, &addr);
@@ -331,9 +331,9 @@ DEFUN (show_ip_rpf_addr,
return CMD_WARNING;
}
- rib = rib_match_ipv4_multicast (VRF_DEFAULT, addr, &rn);
+ re = rib_match_ipv4_multicast (VRF_DEFAULT, addr, &rn);
- if (rib)
+ if (re)
vty_show_ip_route_detail (vty, rn, 1);
else
vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE);
@@ -640,13 +640,13 @@ DEFUN (no_ip_route_mask_flags,
static void
vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
{
- struct rib *rib;
+ struct route_entry *re;
struct nexthop *nexthop, *tnexthop;
int recursing;
char buf[SRCDEST2STR_BUFFER];
struct zebra_vrf *zvrf;
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
const char *mcast_info = "";
if (mcast)
@@ -660,42 +660,42 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, "Routing entry for %s%s%s",
srcdest_rnode2str(rn, buf, sizeof(buf)), mcast_info,
VTY_NEWLINE);
- vty_out (vty, " Known via \"%s", zebra_route_string (rib->type));
- if (rib->instance)
- vty_out (vty, "[%d]", rib->instance);
+ vty_out (vty, " Known via \"%s", zebra_route_string (re->type));
+ if (re->instance)
+ vty_out (vty, "[%d]", re->instance);
vty_out (vty, "\"");
- vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
- if (rib->tag)
- vty_out (vty, ", tag %d", rib->tag);
- if (rib->mtu)
- vty_out (vty, ", mtu %u", rib->mtu);
- if (rib->vrf_id != VRF_DEFAULT)
+ vty_out (vty, ", distance %u, metric %u", re->distance, re->metric);
+ if (re->tag)
+ vty_out (vty, ", tag %d", re->tag);
+ if (re->mtu)
+ vty_out (vty, ", mtu %u", re->mtu);
+ if (re->vrf_id != VRF_DEFAULT)
{
- zvrf = vrf_info_lookup(rib->vrf_id);
+ zvrf = vrf_info_lookup(re->vrf_id);
vty_out (vty, ", vrf %s", zvrf_name (zvrf));
}
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED))
vty_out (vty, ", best");
- if (rib->refcnt)
- vty_out (vty, ", refcnt %ld", rib->refcnt);
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ if (re->refcnt)
+ vty_out (vty, ", refcnt %ld", re->refcnt);
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_BLACKHOLE))
vty_out (vty, ", blackhole");
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_REJECT))
vty_out (vty, ", reject");
vty_out (vty, "%s", VTY_NEWLINE);
- if (rib->type == ZEBRA_ROUTE_RIP
- || rib->type == ZEBRA_ROUTE_OSPF
- || rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_NHRP
- || rib->type == ZEBRA_ROUTE_TABLE
- || rib->type == ZEBRA_ROUTE_BGP)
+ if (re->type == ZEBRA_ROUTE_RIP
+ || re->type == ZEBRA_ROUTE_OSPF
+ || re->type == ZEBRA_ROUTE_ISIS
+ || re->type == ZEBRA_ROUTE_NHRP
+ || re->type == ZEBRA_ROUTE_TABLE
+ || re->type == ZEBRA_ROUTE_BGP)
{
time_t uptime;
struct tm *tm;
uptime = time (NULL);
- uptime -= rib->uptime;
+ uptime -= re->uptime;
tm = gmtime (&uptime);
vty_out (vty, " Last update ");
@@ -713,7 +713,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, " ago%s", VTY_NEWLINE);
}
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
char addrstr[32];
@@ -728,7 +728,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4));
if (nexthop->ifindex)
vty_out (vty, ", via %s",
- ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
@@ -736,11 +736,11 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
if (nexthop->ifindex)
vty_out (vty, ", via %s",
- ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_IFINDEX:
vty_out (vty, " directly connected, %s",
- ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
vty_out (vty, " directly connected, Null0");
@@ -796,7 +796,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
}
static void
-vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
+vty_show_ip_route (struct vty *vty, struct route_node *rn, struct route_entry *re,
json_object *json)
{
struct nexthop *nexthop, *tnexthop;
@@ -814,41 +814,41 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
json_nexthops = json_object_new_array();
json_object_string_add(json_route, "prefix", srcdest_rnode2str (rn, buf, sizeof buf));
- json_object_string_add(json_route, "protocol", zebra_route_string(rib->type));
+ json_object_string_add(json_route, "protocol", zebra_route_string(re->type));
- if (rib->instance)
- json_object_int_add(json_route, "instance", rib->instance);
+ if (re->instance)
+ json_object_int_add(json_route, "instance", re->instance);
- if (rib->vrf_id)
- json_object_int_add(json_route, "vrfId", rib->vrf_id);
+ if (re->vrf_id)
+ json_object_int_add(json_route, "vrfId", re->vrf_id);
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED))
json_object_boolean_true_add(json_route, "selected");
- if (rib->type != ZEBRA_ROUTE_CONNECT && rib->type != ZEBRA_ROUTE_KERNEL)
+ if (re->type != ZEBRA_ROUTE_CONNECT && re->type != ZEBRA_ROUTE_KERNEL)
{
- json_object_int_add(json_route, "distance", rib->distance);
- json_object_int_add(json_route, "metric", rib->metric);
+ json_object_int_add(json_route, "distance", re->distance);
+ json_object_int_add(json_route, "metric", re->metric);
}
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_BLACKHOLE))
json_object_boolean_true_add(json_route, "blackhole");
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_REJECT))
json_object_boolean_true_add(json_route, "reject");
- if (rib->type == ZEBRA_ROUTE_RIP
- || rib->type == ZEBRA_ROUTE_OSPF
- || rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_NHRP
- || rib->type == ZEBRA_ROUTE_TABLE
- || rib->type == ZEBRA_ROUTE_BGP)
+ if (re->type == ZEBRA_ROUTE_RIP
+ || re->type == ZEBRA_ROUTE_OSPF
+ || re->type == ZEBRA_ROUTE_ISIS
+ || re->type == ZEBRA_ROUTE_NHRP
+ || re->type == ZEBRA_ROUTE_TABLE
+ || re->type == ZEBRA_ROUTE_BGP)
{
time_t uptime;
struct tm *tm;
uptime = time (NULL);
- uptime -= rib->uptime;
+ uptime -= re->uptime;
tm = gmtime (&uptime);
if (uptime < ONE_DAY_SECOND)
@@ -861,7 +861,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
json_object_string_add(json_route, "uptime", buf);
}
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
json_nexthop = json_object_new_object();
@@ -878,7 +878,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
if (nexthop->ifindex)
{
json_object_int_add(json_nexthop, "interfaceIndex", nexthop->ifindex);
- json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, re->vrf_id));
}
break;
case NEXTHOP_TYPE_IPV6:
@@ -889,14 +889,14 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
if (nexthop->ifindex)
{
json_object_int_add(json_nexthop, "interfaceIndex", nexthop->ifindex);
- json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, re->vrf_id));
}
break;
case NEXTHOP_TYPE_IFINDEX:
json_object_boolean_true_add(json_nexthop, "directlyConnected");
json_object_int_add(json_nexthop, "interfaceIndex", nexthop->ifindex);
- json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ json_object_string_add(json_nexthop, "interfaceName", ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
json_object_boolean_true_add(json_nexthop, "blackhole");
@@ -955,26 +955,26 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
}
/* Nexthop information. */
- for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
+ for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
{
- if (nexthop == rib->nexthop)
+ if (nexthop == re->nexthop)
{
/* Prefix information. */
- len = vty_out (vty, "%c", zebra_route_char (rib->type));
- if (rib->instance)
- len += vty_out (vty, "[%d]", rib->instance);
+ len = vty_out (vty, "%c", zebra_route_char (re->type));
+ if (re->instance)
+ len += vty_out (vty, "[%d]", re->instance);
len += vty_out (vty, "%c%c %s",
- CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)
+ CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED)
? '>' : ' ',
CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
? '*' : ' ',
srcdest_rnode2str (rn, buf, sizeof buf));
/* Distance and metric display. */
- if (rib->type != ZEBRA_ROUTE_CONNECT
- && rib->type != ZEBRA_ROUTE_KERNEL)
- len += vty_out (vty, " [%d/%d]", rib->distance,
- rib->metric);
+ if (re->type != ZEBRA_ROUTE_CONNECT
+ && re->type != ZEBRA_ROUTE_KERNEL)
+ len += vty_out (vty, " [%d/%d]", re->distance,
+ re->metric);
}
else
vty_out (vty, " %c%*c",
@@ -989,7 +989,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4));
if (nexthop->ifindex)
vty_out (vty, ", %s",
- ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
@@ -997,12 +997,12 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
if (nexthop->ifindex)
vty_out (vty, ", %s",
- ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_IFINDEX:
vty_out (vty, " is directly connected, %s",
- ifindex2ifname (nexthop->ifindex, rib->vrf_id));
+ ifindex2ifname (nexthop->ifindex, re->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
vty_out (vty, " is directly connected, Null0");
@@ -1049,23 +1049,23 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib,
nexthop->nh_label->label, buf, BUFSIZ, 1));
}
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_BLACKHOLE))
vty_out (vty, ", bh");
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_REJECT))
vty_out (vty, ", rej");
- if (rib->type == ZEBRA_ROUTE_RIP
- || rib->type == ZEBRA_ROUTE_OSPF
- || rib->type == ZEBRA_ROUTE_ISIS
- || rib->type == ZEBRA_ROUTE_NHRP
- || rib->type == ZEBRA_ROUTE_TABLE
- || rib->type == ZEBRA_ROUTE_BGP)
+ if (re->type == ZEBRA_ROUTE_RIP
+ || re->type == ZEBRA_ROUTE_OSPF
+ || re->type == ZEBRA_ROUTE_ISIS
+ || re->type == ZEBRA_ROUTE_NHRP
+ || re->type == ZEBRA_ROUTE_TABLE
+ || re->type == ZEBRA_ROUTE_BGP)
{
time_t uptime;
struct tm *tm;
uptime = time (NULL);
- uptime -= rib->uptime;
+ uptime -= re->uptime;
tm = gmtime (&uptime);
if (uptime < ONE_DAY_SECOND)
@@ -1097,7 +1097,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
int first = 1;
struct zebra_vrf *zvrf = NULL;
char buf[BUFSIZ];
@@ -1137,12 +1137,12 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
/* Show all routes. */
for (rn = route_top (table); rn; rn = route_next (rn))
{
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ if (use_fib && !CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
continue;
- if (tag && rib->tag != tag)
+ if (tag && re->tag != tag)
continue;
if (longer_prefix_p && ! prefix_match (longer_prefix_p, &rn->p))
@@ -1163,10 +1163,10 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
continue;
}
- if (type && rib->type != type)
+ if (type && re->type != type)
continue;
- if (ospf_instance_id && (rib->type != ZEBRA_ROUTE_OSPF || rib->instance != ospf_instance_id))
+ if (ospf_instance_id && (re->type != ZEBRA_ROUTE_OSPF || re->instance != ospf_instance_id))
continue;
if (use_json)
@@ -1190,7 +1190,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
}
}
- vty_show_ip_route (vty, rn, rib, json_prefix);
+ vty_show_ip_route (vty, rn, re, json_prefix);
}
if (json_prefix)
@@ -1567,7 +1567,7 @@ static void
vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
{
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
@@ -1578,25 +1578,25 @@ vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
memset (&rib_cnt, 0, sizeof(rib_cnt));
memset (&fib_cnt, 0, sizeof(fib_cnt));
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
- is_ibgp = (rib->type == ZEBRA_ROUTE_BGP &&
- CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP));
+ is_ibgp = (re->type == ZEBRA_ROUTE_BGP &&
+ CHECK_FLAG (re->flags, ZEBRA_FLAG_IBGP));
rib_cnt[ZEBRA_ROUTE_TOTAL]++;
if (is_ibgp)
rib_cnt[ZEBRA_ROUTE_IBGP]++;
else
- rib_cnt[rib->type]++;
+ rib_cnt[re->type]++;
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (CHECK_FLAG (re->flags, ZEBRA_FLAG_SELECTED))
{
fib_cnt[ZEBRA_ROUTE_TOTAL]++;
if (is_ibgp)
fib_cnt[ZEBRA_ROUTE_IBGP]++;
else
- fib_cnt[rib->type]++;
+ fib_cnt[re->type]++;
}
}
@@ -1642,7 +1642,7 @@ static void
vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
{
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
struct nexthop *nexthop;
#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
@@ -1654,25 +1654,25 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
memset (&rib_cnt, 0, sizeof(rib_cnt));
memset (&fib_cnt, 0, sizeof(fib_cnt));
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
/*
* In case of ECMP, count only once.
*/
cnt = 0;
- for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next)
+ for (nexthop = re->nexthop; (!cnt && nexthop); nexthop = nexthop->next)
{
cnt++;
rib_cnt[ZEBRA_ROUTE_TOTAL]++;
- rib_cnt[rib->type]++;
+ rib_cnt[re->type]++;
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
{
fib_cnt[ZEBRA_ROUTE_TOTAL]++;
- fib_cnt[rib->type]++;
+ fib_cnt[re->type]++;
}
- if (rib->type == ZEBRA_ROUTE_BGP &&
- CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
+ if (re->type == ZEBRA_ROUTE_BGP &&
+ CHECK_FLAG (re->flags, ZEBRA_FLAG_IBGP))
{
rib_cnt[ZEBRA_ROUTE_IBGP]++;
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
@@ -2816,7 +2816,7 @@ DEFUN (show_ipv6_mroute,
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
@@ -2829,14 +2829,14 @@ DEFUN (show_ipv6_mroute,
/* Show all IPv6 route. */
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
if (first)
{
vty_out (vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
- vty_show_ip_route (vty, rn, rib, NULL);
+ vty_show_ip_route (vty, rn, re, NULL);
}
return CMD_SUCCESS;
}
@@ -2959,7 +2959,7 @@ DEFUN (show_ipv6_mroute_vrf_all,
{
struct route_table *table;
struct route_node *rn;
- struct rib *rib;
+ struct route_entry *re;
struct vrf *vrf;
struct zebra_vrf *zvrf;
int first = 1;
@@ -2972,14 +2972,14 @@ DEFUN (show_ipv6_mroute_vrf_all,
/* Show all IPv6 route. */
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
- RNODE_FOREACH_RIB (rn, rib)
+ RNODE_FOREACH_RE (rn, re)
{
if (first)
{
vty_out (vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
- vty_show_ip_route (vty, rn, rib, NULL);
+ vty_show_ip_route (vty, rn, re, NULL);
}
}
return CMD_SUCCESS;
diff --git a/zebra/zserv.c b/zebra/zserv.c
index e93299d62..29cdb9808 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -608,7 +608,7 @@ zsend_interface_update (int cmd, struct zserv *client, struct interface *ifp)
*/
int
zsend_redistribute_route (int add, struct zserv *client, struct prefix *p,
- struct prefix *src_p, struct rib *rib)
+ struct prefix *src_p, struct route_entry *re)
{
afi_t afi;
int cmd;
@@ -658,12 +658,12 @@ zsend_redistribute_route (int add, struct zserv *client, struct prefix *p,
stream_reset (s);
memset(&dummy_nh, 0, sizeof(struct nexthop));
- zserv_create_header (s, cmd, rib->vrf_id);
+ zserv_create_header (s, cmd, re->vrf_id);
/* Put type and nexthop. */
- stream_putc (s, rib->type);
- stream_putw (s, rib->instance);
- stream_putl (s, rib->flags);
+ stream_putc (s, re->type);
+ stream_putw (s, re->instance);
+ stream_putl (s, re->flags);
/* marker for message flags field */
messmark = stream_get_endp (s);
@@ -682,10 +682,10 @@ zsend_redistribute_route (int add, struct zserv *client, struct prefix *p,
stream_write (s, (u_char *) & src_p->u.prefix, psize);
}
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
{
/* We don't send any nexthops when there's a multipath */
- if (rib->nexthop_active_num > 1 && client->proto != ZEBRA_ROUTE_LDP)
+ if (re->nexthop_active_num > 1 && client->proto != ZEBRA_ROUTE_LDP)
{
SET_FLAG (zapi_flags, ZAPI_MESSAGE_NEXTHOP);
SET_FLAG (zapi_flags, ZAPI_MESSAGE_IFINDEX);
@@ -764,22 +764,22 @@ zsend_redistribute_route (int add, struct zserv *client, struct prefix *p,
/* Distance */
SET_FLAG (zapi_flags, ZAPI_MESSAGE_DISTANCE);
- stream_putc (s, rib->distance);
+ stream_putc (s, re->distance);
/* Metric */
SET_FLAG (zapi_flags, ZAPI_MESSAGE_METRIC);
- stream_putl (s, rib->metric);
+ stream_putl (s, re->metric);
/* Tag */
- if (rib->tag)
+ if (re->tag)
{
SET_FLAG(zapi_flags, ZAPI_MESSAGE_TAG);
- stream_putl(s, rib->tag);
+ stream_putl(s, re->tag);
}
/* MTU */
SET_FLAG (zapi_flags, ZAPI_MESSAGE_MTU);
- stream_putl (s, rib->mtu);
+ stream_putl (s, re->mtu);
/* write real message flags value */
stream_putc_at (s, messmark, zapi_flags);
@@ -1044,7 +1044,7 @@ zserv_fec_unregister (struct zserv *client, int sock, u_short length)
Returns both route metric and protocol distance.
*/
static int
-zsend_ipv4_nexthop_lookup_mrib (struct zserv *client, struct in_addr addr, struct rib *rib, struct zebra_vrf *zvrf)
+zsend_ipv4_nexthop_lookup_mrib (struct zserv *client, struct in_addr addr, struct route_entry *re, struct zebra_vrf *zvrf)
{
struct stream *s;
unsigned long nump;
@@ -1059,17 +1059,17 @@ zsend_ipv4_nexthop_lookup_mrib (struct zserv *client, struct in_addr addr, struc
zserv_create_header (s, ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB, zvrf_id (zvrf));
stream_put_in_addr (s, &addr);
- if (rib)
+ if (re)
{
- stream_putc (s, rib->distance);
- stream_putl (s, rib->metric);
+ stream_putc (s, re->distance);
+ stream_putl (s, re->metric);
num = 0;
nump = stream_get_endp(s); /* remember position for nexthop_num */
stream_putc (s, 0); /* reserve room for nexthop_num */
/* Only non-recursive routes are elegible to resolve the nexthop we
* are looking up. Therefore, we will just iterate over the top
* chain of nexthops. */
- for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
num += zsend_write_nexthop (s, nexthop);
@@ -1169,14 +1169,14 @@ zserv_nexthop_num_warn (const char *caller, const struct prefix *p, const unsign
/* This function support multiple nexthop. */
/*
- * Parse the ZEBRA_IPV4_ROUTE_ADD sent from client. Update rib and
+ * Parse the ZEBRA_IPV4_ROUTE_ADD sent from client. Update re and
* add kernel route.
*/
static int
zread_ipv4_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
{
int i;
- struct rib *rib;
+ struct route_entry *re;
struct prefix p;
u_char message;
struct in_addr nhop_addr;
@@ -1192,16 +1192,16 @@ zread_ipv4_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
/* Get input stream. */
s = client->ibuf;
- /* Allocate new rib. */
- rib = XCALLOC (MTYPE_RIB, sizeof (struct rib));
+ /* Allocate new re. */
+ re = XCALLOC (MTYPE_RE, sizeof (struct route_entry));
/* Type, flags, message. */
- rib->type = stream_getc (s);
- rib->instance = stream_getw (s);
- rib->flags = stream_getl (s);
+ re->type = stream_getc (s);
+ re->instance = stream_getw (s);
+ re->flags = stream_getl (s);
message = stream_getc (s);
safi = stream_getw (s);
- rib->uptime = time (NULL);
+ re->uptime = time (NULL);
/* IPv4 prefix. */
memset (&p, 0, sizeof (struct prefix_ipv4));
@@ -1210,7 +1210,7 @@ zread_ipv4_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
stream_get (&p.u.prefix4, s, PSIZE (p.prefixlen));
/* VRF ID */
- rib->vrf_id = zvrf_id (zvrf);
+ re->vrf_id = zvrf_id (zvrf);
/* Nexthop parse. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_NEXTHOP))
@@ -1226,11 +1226,11 @@ zread_ipv4_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
{
case NEXTHOP_TYPE_IFINDEX:
ifindex = stream_getl (s);
- rib_nexthop_ifindex_add (rib, ifindex);
+ route_entry_nexthop_ifindex_add (re, ifindex);
break;
case NEXTHOP_TYPE_IPV4:
nhop_addr.s_addr = stream_get_ipv4 (s);
- nexthop = rib_nexthop_ipv4_add (rib, &nhop_addr, NULL);
+ nexthop = route_entry_nexthop_ipv4_add (re, &nhop_addr, NULL);
/* For labeled-unicast, each nexthop is followed by label. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL))
{
@@ -1241,13 +1241,13 @@ zread_ipv4_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
case NEXTHOP_TYPE_IPV4_IFINDEX:
nhop_addr.s_addr = stream_get_ipv4 (s);
ifindex = stream_getl (s);
- rib_nexthop_ipv4_ifindex_add (rib, &nhop_addr, NULL, ifindex);
+ route_entry_nexthop_ipv4_ifindex_add (re, &nhop_addr, NULL, ifindex);
break;
case NEXTHOP_TYPE_IPV6:
stream_forward_getp (s, IPV6_MAX_BYTELEN);
break;
case NEXTHOP_TYPE_BLACKHOLE:
- rib_nexthop_blackhole_add (rib);
+ route_entry_nexthop_blackhole_add (re);
break;
}
}
@@ -1255,27 +1255,27 @@ zread_ipv4_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
/* Distance. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_DISTANCE))
- rib->distance = stream_getc (s);
+ re->distance = stream_getc (s);
/* Metric. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
- rib->metric = stream_getl (s);
+ re->metric = stream_getl (s);
/* Tag */
if (CHECK_FLAG (message, ZAPI_MESSAGE_TAG))
- rib->tag = stream_getl (s);
+ re->tag = stream_getl (s);
else
- rib->tag = 0;
+ re->tag = 0;
if (CHECK_FLAG (message, ZAPI_MESSAGE_MTU))
- rib->mtu = stream_getl (s);
+ re->mtu = stream_getl (s);
else
- rib->mtu = 0;
+ re->mtu = 0;
/* Table */
- rib->table = zvrf->table_id;
+ re->table = zvrf->table_id;
- ret = rib_add_multipath (AFI_IP, safi, &p, NULL, rib);
+ ret = rib_add_multipath (AFI_IP, safi, &p, NULL, re);
/* Stats */
if (ret > 0)
@@ -1384,11 +1384,11 @@ static int
zread_ipv4_nexthop_lookup_mrib (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
{
struct in_addr addr;
- struct rib *rib;
+ struct route_entry *re;
addr.s_addr = stream_get_ipv4 (client->ibuf);
- rib = rib_match_ipv4_multicast (zvrf_id (zvrf), addr, NULL);
- return zsend_ipv4_nexthop_lookup_mrib (client, addr, rib, zvrf);
+ re = rib_match_ipv4_multicast (zvrf_id (zvrf), addr, NULL);
+ return zsend_ipv4_nexthop_lookup_mrib (client, addr, re, zvrf);
}
/* Zebra server IPv6 prefix add function. */
@@ -1398,7 +1398,7 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
unsigned int i;
struct stream *s;
struct in6_addr nhop_addr;
- struct rib *rib;
+ struct route_entry *re;
u_char message;
u_char nexthop_num;
u_char nexthop_type;
@@ -1416,16 +1416,16 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
memset (&nhop_addr, 0, sizeof (struct in6_addr));
- /* Allocate new rib. */
- rib = XCALLOC (MTYPE_RIB, sizeof (struct rib));
+ /* Allocate new re. */
+ re = XCALLOC (MTYPE_RE, sizeof (struct route_entry));
/* Type, flags, message. */
- rib->type = stream_getc (s);
- rib->instance = stream_getw (s);
- rib->flags = stream_getl (s);
+ re->type = stream_getc (s);
+ re->instance = stream_getw (s);
+ re->flags = stream_getl (s);
message = stream_getc (s);
safi = stream_getw (s);
- rib->uptime = time (NULL);
+ re->uptime = time (NULL);
/* IPv4 prefix. */
memset (&p, 0, sizeof (struct prefix_ipv4));
@@ -1434,10 +1434,10 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
stream_get (&p.u.prefix4, s, PSIZE (p.prefixlen));
/* VRF ID */
- rib->vrf_id = zvrf_id (zvrf);
+ re->vrf_id = zvrf_id (zvrf);
/* We need to give nh-addr, nh-ifindex with the same next-hop object
- * to the rib to ensure that IPv6 multipathing works; need to coalesce
+ * to the re to ensure that IPv6 multipathing works; need to coalesce
* these. Clients should send the same number of paired set of
* next-hop-addr/next-hop-ifindices. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_NEXTHOP))
@@ -1474,7 +1474,7 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
}
break;
case NEXTHOP_TYPE_BLACKHOLE:
- rib_nexthop_blackhole_add (rib);
+ route_entry_nexthop_blackhole_add (re);
break;
}
}
@@ -1484,43 +1484,43 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct
{
if ((i < nh_count) && !IN6_IS_ADDR_UNSPECIFIED (&nexthops[i])) {
if ((i < if_count) && ifindices[i])
- nexthop = rib_nexthop_ipv6_ifindex_add (rib, &nexthops[i], ifindices[i]);
+ nexthop = route_entry_nexthop_ipv6_ifindex_add (re, &nexthops[i], ifindices[i]);
else
- nexthop = rib_nexthop_ipv6_add (rib, &nexthops[i]);
+ nexthop = route_entry_nexthop_ipv6_add (re, &nexthops[i]);
if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL))
nexthop_add_labels (nexthop, nexthop->nh_label_type, 1, &labels[i]);
}
else {
if ((i < if_count) && ifindices[i])
- rib_nexthop_ifindex_add (rib, ifindices[i]);
+ route_entry_nexthop_ifindex_add (re, ifindices[i]);
}
}
}
/* Distance. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_DISTANCE))
- rib->distance = stream_getc (s);
+ re->distance = stream_getc (s);
/* Metric. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
- rib->metric = stream_getl (s);
+ re->metric = stream_getl (s);
/* Tag */
if (CHECK_FLAG (message, ZAPI_MESSAGE_TAG))
- rib->tag = stream_getl (s);
+ re->tag = stream_getl (s);
else
- rib->tag = 0;
+ re->tag = 0;
if (CHECK_FLAG (message, ZAPI_MESSAGE_MTU))
- rib->mtu = stream_getl (s);
+ re->mtu = stream_getl (s);
else
- rib->mtu = 0;
+ re->mtu = 0;
/* Table */
- rib->table = zvrf->table_id;
+ re->table = zvrf->table_id;
- ret = rib_add_multipath (AFI_IP6, safi, &p, NULL, rib);
+ ret = rib_add_multipath (AFI_IP6, safi, &p, NULL, re);
/* Stats */
if (ret > 0)
client->v4_route_add_cnt++;
@@ -1536,7 +1536,7 @@ zread_ipv6_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
unsigned int i;
struct stream *s;
struct in6_addr nhop_addr;
- struct rib *rib;
+ struct route_entry *re;
u_char message;
u_char nexthop_num;
u_char nexthop_type;
@@ -1555,16 +1555,16 @@ zread_ipv6_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
memset (&nhop_addr, 0, sizeof (struct in6_addr));
- /* Allocate new rib. */
- rib = XCALLOC (MTYPE_RIB, sizeof (struct rib));
+ /* Allocate new re. */
+ re = XCALLOC (MTYPE_RE, sizeof (struct route_entry));
/* Type, flags, message. */
- rib->type = stream_getc (s);
- rib->instance = stream_getw (s);
- rib->flags = stream_getl (s);
+ re->type = stream_getc (s);
+ re->instance = stream_getw (s);
+ re->flags = stream_getl (s);
message = stream_getc (s);
safi = stream_getw (s);
- rib->uptime = time (NULL);
+ re->uptime = time (NULL);
/* IPv6 prefix. */
memset (&p, 0, sizeof (struct prefix_ipv6));
@@ -1584,7 +1584,7 @@ zread_ipv6_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
src_pp = NULL;
/* We need to give nh-addr, nh-ifindex with the same next-hop object
- * to the rib to ensure that IPv6 multipathing works; need to coalesce
+ * to the re to ensure that IPv6 multipathing works; need to coalesce
* these. Clients should send the same number of paired set of
* next-hop-addr/next-hop-ifindices. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_NEXTHOP))
@@ -1620,7 +1620,7 @@ zread_ipv6_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
}
break;
case NEXTHOP_TYPE_BLACKHOLE:
- rib_nexthop_blackhole_add (rib);
+ route_entry_nexthop_blackhole_add (re);
break;
}
}
@@ -1630,43 +1630,43 @@ zread_ipv6_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf)
{
if ((i < nh_count) && !IN6_IS_ADDR_UNSPECIFIED (&nexthops[i])) {
if ((i < if_count) && ifindices[i])
- nexthop = rib_nexthop_ipv6_ifindex_add (rib, &nexthops[i], ifindices[i]);
+ nexthop = route_entry_nexthop_ipv6_ifindex_add (re, &nexthops[i], ifindices[i]);
else
- nexthop = rib_nexthop_ipv6_add (rib, &nexthops[i]);
+ nexthop = route_entry_nexthop_ipv6_add (re, &nexthops[i]);
if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL))
nexthop_add_labels (nexthop, nexthop->nh_label_type, 1, &labels[i]);
}
else {
if ((i < if_count) && ifindices[i])
- rib_nexthop_ifindex_add (rib, ifindices[i]);
+ route_entry_nexthop_ifindex_add (re, ifindices[i]);
}
}
}
/* Distance. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_DISTANCE))
- rib->distance = stream_getc (s);
+ re->distance = stream_getc (s);
/* Metric. */
if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
- rib->metric = stream_getl (s);
+ re->metric = stream_getl (s);
/* Tag */
if (CHECK_FLAG (message, ZAPI_MESSAGE_TAG))
- rib->tag = stream_getl (s);
+ re->tag = stream_getl (s);
else
- rib->tag = 0;
+ re->tag = 0;
if (CHECK_FLAG (message, ZAPI_MESSAGE_MTU))
- rib->mtu = stream_getl (s);
+ re->mtu = stream_getl (s);
else
- rib->mtu = 0;
+ re->mtu = 0;
/* VRF ID */
- rib->vrf_id = zvrf_id (zvrf);
- rib->table = zvrf->table_id;
+ re->vrf_id = zvrf_id (zvrf);
+ re->table = zvrf->table_id;
- ret = rib_add_multipath (AFI_IP6, safi, &p, src_pp, rib);
+ ret = rib_add_multipath (AFI_IP6, safi, &p, src_pp, re);
/* Stats */
if (ret > 0)
client->v6_route_add_cnt++;
diff --git a/zebra/zserv.h b/zebra/zserv.h
index 2fafd040c..dcc98d83f 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -162,7 +162,7 @@ extern void nbr_connected_add_ipv6 (struct interface *, struct in6_addr *);
extern void nbr_connected_delete_ipv6 (struct interface *, struct in6_addr *);
extern int zsend_interface_update (int, struct zserv *, struct interface *);
extern int zsend_redistribute_route (int, struct zserv *, struct prefix *,
- struct prefix *, struct rib *);
+ struct prefix *, struct route_entry *);
extern int zsend_router_id_update (struct zserv *, struct prefix *,
vrf_id_t);
extern int zsend_interface_vrf_update (struct zserv *, struct interface *,