summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/IMPLEMENTATION.txt6
-rw-r--r--bgpd/bgp_advertise.c6
-rw-r--r--bgpd/bgp_advertise.h14
-rw-r--r--bgpd/bgp_damp.c96
-rw-r--r--bgpd/bgp_damp.h19
-rw-r--r--bgpd/bgp_dump.c24
-rw-r--r--bgpd/bgp_evpn.c957
-rw-r--r--bgpd/bgp_evpn.h11
-rw-r--r--bgpd/bgp_evpn_vty.c107
-rw-r--r--bgpd/bgp_filter.c133
-rw-r--r--bgpd/bgp_flowspec.h4
-rw-r--r--bgpd/bgp_flowspec_vty.c27
-rw-r--r--bgpd/bgp_label.c19
-rw-r--r--bgpd/bgp_label.h12
-rw-r--r--bgpd/bgp_mpath.c318
-rw-r--r--bgpd/bgp_mpath.h48
-rw-r--r--bgpd/bgp_mplsvpn.c361
-rw-r--r--bgpd/bgp_mplsvpn.h8
-rw-r--r--bgpd/bgp_nexthop.c10
-rw-r--r--bgpd/bgp_nexthop.h4
-rw-r--r--bgpd/bgp_nht.c92
-rw-r--r--bgpd/bgp_nht.h11
-rw-r--r--bgpd/bgp_pbr.c237
-rw-r--r--bgpd/bgp_pbr.h9
-rw-r--r--bgpd/bgp_route.c1924
-rw-r--r--bgpd/bgp_route.h158
-rw-r--r--bgpd/bgp_routemap.c420
-rw-r--r--bgpd/bgp_rpki.c14
-rw-r--r--bgpd/bgp_snmp.c53
-rw-r--r--bgpd/bgp_table.c2
-rw-r--r--bgpd/bgp_updgrp.c6
-rw-r--r--bgpd/bgp_updgrp.h9
-rw-r--r--bgpd/bgp_updgrp_adv.c53
-rw-r--r--bgpd/bgp_updgrp_packet.c16
-rw-r--r--bgpd/bgp_vty.c604
-rw-r--r--bgpd/bgp_zebra.c191
-rw-r--r--bgpd/bgp_zebra.h11
-rw-r--r--bgpd/bgpd.h5
-rw-r--r--bgpd/rfapi/rfapi.c115
-rw-r--r--bgpd/rfapi/rfapi_backend.h8
-rw-r--r--bgpd/rfapi/rfapi_import.c968
-rw-r--r--bgpd/rfapi/rfapi_import.h34
-rw-r--r--bgpd/rfapi/rfapi_monitor.c12
-rw-r--r--bgpd/rfapi/rfapi_monitor.h4
-rw-r--r--bgpd/rfapi/rfapi_private.h2
-rw-r--r--bgpd/rfapi/rfapi_rib.c64
-rw-r--r--bgpd/rfapi/rfapi_rib.h2
-rw-r--r--bgpd/rfapi/rfapi_vty.c189
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c80
-rw-r--r--bgpd/rfapi/vnc_export_bgp_p.h4
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c508
-rw-r--r--bgpd/rfapi/vnc_import_bgp.h21
-rw-r--r--bgpd/rfapi/vnc_import_bgp_p.h8
-rw-r--r--bgpd/rfapi/vnc_zebra.c2
-rw-r--r--bgpd/subdir.am2
-rw-r--r--doc/developer/building-frr-for-centos6.rst10
-rw-r--r--doc/developer/building-frr-for-centos7.rst10
-rw-r--r--doc/developer/building-frr-for-debian8.rst8
-rw-r--r--doc/developer/building-frr-for-debian9.rst9
-rw-r--r--doc/developer/building-frr-for-fedora24.rst13
-rw-r--r--doc/developer/building-frr-for-freebsd10.rst3
-rw-r--r--doc/developer/building-frr-for-freebsd11.rst3
-rw-r--r--doc/developer/building-frr-for-freebsd9.rst3
-rw-r--r--doc/developer/building-frr-for-netbsd6.rst3
-rw-r--r--doc/developer/building-frr-for-netbsd7.rst3
-rw-r--r--doc/developer/building-frr-for-omnios.rst5
-rw-r--r--doc/developer/building-frr-for-openbsd6.rst4
-rw-r--r--doc/developer/building-frr-for-ubuntu1204.rst5
-rw-r--r--doc/developer/building-frr-for-ubuntu1404.rst6
-rw-r--r--doc/developer/building-frr-for-ubuntu1604.rst5
-rw-r--r--doc/developer/building-frr-for-ubuntu1804.rst5
-rw-r--r--doc/developer/next-hop-tracking.rst2
-rw-r--r--doc/user/bgp.rst11
-rw-r--r--doc/user/routemap.rst12
-rw-r--r--gdb/lib.txt2
-rw-r--r--isisd/isis_adjacency.c18
-rw-r--r--isisd/isis_adjacency.h4
-rw-r--r--isisd/isis_bfd.c350
-rw-r--r--isisd/isis_bfd.h31
-rw-r--r--isisd/isis_circuit.c7
-rw-r--r--isisd/isis_circuit.h7
-rw-r--r--isisd/isis_events.c19
-rw-r--r--isisd/isis_events.h3
-rw-r--r--isisd/isis_lsp.c12
-rw-r--r--isisd/isis_lsp.h1
-rw-r--r--isisd/isis_main.c6
-rw-r--r--isisd/isis_mt.c9
-rw-r--r--isisd/isis_mt.h2
-rw-r--r--isisd/isis_vty_common.c48
-rw-r--r--isisd/isis_zebra.h2
-rw-r--r--isisd/isisd.c37
-rw-r--r--isisd/isisd.h1
-rw-r--r--isisd/subdir.am2
-rw-r--r--lib/log.c1
-rw-r--r--lib/vxlan.h9
-rw-r--r--lib/zclient.h1
-rw-r--r--ospf6d/ospf6_intra.c2
-rw-r--r--ospfd/ospf_flood.c2
-rw-r--r--ospfd/ospf_vty.c26
-rw-r--r--ospfd/ospf_zebra.c133
-rw-r--r--tests/bgpd/test_mpath.c54
-rw-r--r--tests/bgpd/test_mpath.py2
-rw-r--r--vtysh/vtysh_config.c16
-rw-r--r--zebra/subdir.am4
-rw-r--r--zebra/zapi_msg.c4
-rw-r--r--zebra/zebra_ptm.c30
-rw-r--r--zebra/zebra_ptm.h9
-rw-r--r--zebra/zebra_ptm_redistribute.c13
-rw-r--r--zebra/zebra_rib.c27
-rw-r--r--zebra/zebra_rnh.c96
-rw-r--r--zebra/zebra_rnh.h2
-rw-r--r--zebra/zebra_routemap.c858
-rw-r--r--zebra/zebra_routemap.h14
-rw-r--r--zebra/zebra_vrf.c7
-rw-r--r--zebra/zebra_vrf.h26
-rw-r--r--zebra/zebra_vty.c44
-rw-r--r--zebra/zebra_vxlan.c78
-rw-r--r--zebra/zebra_vxlan.h10
118 files changed, 5861 insertions, 4310 deletions
diff --git a/bgpd/IMPLEMENTATION.txt b/bgpd/IMPLEMENTATION.txt
index 0f06359686..5822dbba82 100644
--- a/bgpd/IMPLEMENTATION.txt
+++ b/bgpd/IMPLEMENTATION.txt
@@ -104,8 +104,8 @@ bgp_route.[hc]:
looking for data in hash table, and putting there if missing, refcnt
using pointer to existing data
many validity checks
- get new struct bgp_info (10 words/40 bytes)
- call bgp_info_add with rn and bgp_info
+ get new struct bgp_path_info
+ call bgp_path_info_add with rn and bgp_path_info
call bgp_process
bgp_routemap.c
@@ -149,7 +149,7 @@ bgpd.c
Question: How much memory does quagga's bgpd use as a function of
state received from peers?
-It seems that a struct bgp_info is kept for each prefix. The "struct
+It seems that a struct bgp_path_info is kept for each prefix. The "struct
attr *" is interned, and variables within that are interned. So, 40
bytes are kept per received prefix, plus interned shared values. This
could be 36 if 'int suppress' where changed to a u_char and moved to
diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c
index 94413117c1..be47cbb6d8 100644
--- a/bgpd/bgp_advertise.c
+++ b/bgpd/bgp_advertise.c
@@ -90,9 +90,9 @@ struct bgp_advertise *bgp_advertise_new(void)
void bgp_advertise_free(struct bgp_advertise *adv)
{
- if (adv->binfo)
- bgp_info_unlock(
- adv->binfo); /* bgp_advertise bgp_info reference */
+ if (adv->pathi)
+ /* bgp_advertise bgp_path_info reference */
+ bgp_path_info_unlock(adv->pathi);
XFREE(MTYPE_BGP_ADVERTISE, adv);
}
diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h
index 920cca6301..6ff476e7b8 100644
--- a/bgpd/bgp_advertise.h
+++ b/bgpd/bgp_advertise.h
@@ -62,7 +62,7 @@ struct bgp_advertise {
struct bgp_advertise_attr *baa;
/* BGP info. */
- struct bgp_info *binfo;
+ struct bgp_path_info *pathi;
};
/* BGP adjacency out. */
@@ -113,7 +113,7 @@ struct bgp_synchronize {
};
/* BGP adjacency linked list. */
-#define BGP_INFO_ADD(N, A, TYPE) \
+#define BGP_PATH_INFO_ADD(N, A, TYPE) \
do { \
(A)->prev = NULL; \
(A)->next = (N)->TYPE; \
@@ -122,7 +122,7 @@ struct bgp_synchronize {
(N)->TYPE = (A); \
} while (0)
-#define BGP_INFO_DEL(N, A, TYPE) \
+#define BGP_PATH_INFO_DEL(N, A, TYPE) \
do { \
if ((A)->next) \
(A)->next->prev = (A)->prev; \
@@ -132,10 +132,10 @@ struct bgp_synchronize {
(N)->TYPE = (A)->next; \
} while (0)
-#define BGP_ADJ_IN_ADD(N,A) BGP_INFO_ADD(N,A,adj_in)
-#define BGP_ADJ_IN_DEL(N,A) BGP_INFO_DEL(N,A,adj_in)
-#define BGP_ADJ_OUT_ADD(N,A) BGP_INFO_ADD(N,A,adj_out)
-#define BGP_ADJ_OUT_DEL(N,A) BGP_INFO_DEL(N,A,adj_out)
+#define BGP_ADJ_IN_ADD(N, A) BGP_PATH_INFO_ADD(N, A, adj_in)
+#define BGP_ADJ_IN_DEL(N, A) BGP_PATH_INFO_DEL(N, A, adj_in)
+#define BGP_ADJ_OUT_ADD(N, A) BGP_PATH_INFO_ADD(N, A, adj_out)
+#define BGP_ADJ_OUT_DEL(N, A) BGP_PATH_INFO_DEL(N, A, adj_out)
#define BGP_ADV_FIFO_ADD(F, N) \
do { \
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index 5ffab0bf4f..cff5caf52f 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -42,8 +42,8 @@ static struct bgp_damp_config *damp = &bgp_damp_cfg;
/* Utility macro to add and delete BGP dampening information to no
used list. */
-#define BGP_DAMP_LIST_ADD(N,A) BGP_INFO_ADD(N,A,no_reuse_list)
-#define BGP_DAMP_LIST_DEL(N,A) BGP_INFO_DEL(N,A,no_reuse_list)
+#define BGP_DAMP_LIST_ADD(N, A) BGP_PATH_INFO_ADD(N, A, no_reuse_list)
+#define BGP_DAMP_LIST_DEL(N, A) BGP_PATH_INFO_DEL(N, A, no_reuse_list)
/* Calculate reuse list index by penalty value. */
static int bgp_reuse_index(int penalty)
@@ -128,7 +128,7 @@ static int bgp_reuse_timer(struct thread *t)
/* 3. if ( the saved list head pointer is non-empty ) */
for (; bdi; bdi = next) {
- struct bgp *bgp = bdi->binfo->peer->bgp;
+ struct bgp *bgp = bdi->path->peer->bgp;
next = bdi->next;
@@ -145,15 +145,15 @@ static int bgp_reuse_timer(struct thread *t)
/* if (figure-of-merit < reuse). */
if (bdi->penalty < damp->reuse_limit) {
/* Reuse the route. */
- bgp_info_unset_flag(bdi->rn, bdi->binfo,
- BGP_INFO_DAMPED);
+ bgp_path_info_unset_flag(bdi->rn, bdi->path,
+ BGP_PATH_DAMPED);
bdi->suppress_time = 0;
if (bdi->lastrecord == BGP_RECORD_UPDATE) {
- bgp_info_unset_flag(bdi->rn, bdi->binfo,
- BGP_INFO_HISTORY);
+ bgp_path_info_unset_flag(bdi->rn, bdi->path,
+ BGP_PATH_HISTORY);
bgp_aggregate_increment(bgp, &bdi->rn->p,
- bdi->binfo, bdi->afi,
+ bdi->path, bdi->afi,
bdi->safi);
bgp_process(bgp, bdi->rn, bdi->afi, bdi->safi);
}
@@ -172,8 +172,8 @@ static int bgp_reuse_timer(struct thread *t)
}
/* A route becomes unreachable (RFC2439 Section 4.8.2). */
-int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
- safi_t safi, int attr_change)
+int bgp_damp_withdraw(struct bgp_path_info *path, struct bgp_node *rn,
+ afi_t afi, safi_t safi, int attr_change)
{
time_t t_now;
struct bgp_damp_info *bdi = NULL;
@@ -182,8 +182,8 @@ int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
t_now = bgp_clock();
/* Processing Unreachable Messages. */
- if (binfo->extra)
- bdi = binfo->extra->damp_info;
+ if (path->extra)
+ bdi = path->extra->damp_info;
if (bdi == NULL) {
/* If there is no previous stability history. */
@@ -195,7 +195,7 @@ int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
bdi = XCALLOC(MTYPE_BGP_DAMP_INFO,
sizeof(struct bgp_damp_info));
- bdi->binfo = binfo;
+ bdi->path = path;
bdi->rn = rn;
bdi->penalty =
(attr_change ? DEFAULT_PENALTY / 2 : DEFAULT_PENALTY);
@@ -205,7 +205,7 @@ int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
bdi->index = -1;
bdi->afi = afi;
bdi->safi = safi;
- (bgp_info_extra_get(binfo))->damp_info = bdi;
+ (bgp_path_info_extra_get(path))->damp_info = bdi;
BGP_DAMP_LIST_ADD(damp, bdi);
} else {
last_penalty = bdi->penalty;
@@ -222,16 +222,16 @@ int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
bdi->flap++;
}
- assert((rn == bdi->rn) && (binfo == bdi->binfo));
+ assert((rn == bdi->rn) && (path == bdi->path));
bdi->lastrecord = BGP_RECORD_WITHDRAW;
bdi->t_updated = t_now;
/* Make this route as historical status. */
- bgp_info_set_flag(rn, binfo, BGP_INFO_HISTORY);
+ bgp_path_info_set_flag(rn, path, BGP_PATH_HISTORY);
/* Remove the route from a reuse list if it is on one. */
- if (CHECK_FLAG(bdi->binfo->flags, BGP_INFO_DAMPED)) {
+ if (CHECK_FLAG(bdi->path->flags, BGP_PATH_DAMPED)) {
/* If decay rate isn't equal to 0, reinsert brn. */
if (bdi->penalty != last_penalty && bdi->index >= 0) {
bgp_reuse_list_delete(bdi);
@@ -243,7 +243,7 @@ int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
/* If not suppressed before, do annonunce this withdraw and
insert into reuse_list. */
if (bdi->penalty >= damp->suppress_value) {
- bgp_info_set_flag(rn, binfo, BGP_INFO_DAMPED);
+ bgp_path_info_set_flag(rn, path, BGP_PATH_DAMPED);
bdi->suppress_time = t_now;
BGP_DAMP_LIST_DEL(damp, bdi);
bgp_reuse_list_add(bdi);
@@ -252,28 +252,28 @@ int bgp_damp_withdraw(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
return BGP_DAMP_USED;
}
-int bgp_damp_update(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
+int bgp_damp_update(struct bgp_path_info *path, struct bgp_node *rn, afi_t afi,
safi_t safi)
{
time_t t_now;
struct bgp_damp_info *bdi;
int status;
- if (!binfo->extra || !((bdi = binfo->extra->damp_info)))
+ if (!path->extra || !((bdi = path->extra->damp_info)))
return BGP_DAMP_USED;
t_now = bgp_clock();
- bgp_info_unset_flag(rn, binfo, BGP_INFO_HISTORY);
+ bgp_path_info_unset_flag(rn, path, BGP_PATH_HISTORY);
bdi->lastrecord = BGP_RECORD_UPDATE;
bdi->penalty = bgp_damp_decay(t_now - bdi->t_updated, bdi->penalty);
- if (!CHECK_FLAG(bdi->binfo->flags, BGP_INFO_DAMPED)
+ if (!CHECK_FLAG(bdi->path->flags, BGP_PATH_DAMPED)
&& (bdi->penalty < damp->suppress_value))
status = BGP_DAMP_USED;
- else if (CHECK_FLAG(bdi->binfo->flags, BGP_INFO_DAMPED)
+ else if (CHECK_FLAG(bdi->path->flags, BGP_PATH_DAMPED)
&& (bdi->penalty < damp->reuse_limit)) {
- bgp_info_unset_flag(rn, binfo, BGP_INFO_DAMPED);
+ bgp_path_info_unset_flag(rn, path, BGP_PATH_DAMPED);
bgp_reuse_list_delete(bdi);
BGP_DAMP_LIST_ADD(damp, bdi);
bdi->suppress_time = 0;
@@ -290,28 +290,29 @@ int bgp_damp_update(struct bgp_info *binfo, struct bgp_node *rn, afi_t afi,
}
/* Remove dampening information and history route. */
-int bgp_damp_scan(struct bgp_info *binfo, afi_t afi, safi_t safi)
+int bgp_damp_scan(struct bgp_path_info *path, afi_t afi, safi_t safi)
{
time_t t_now, t_diff;
struct bgp_damp_info *bdi;
- assert(binfo->extra && binfo->extra->damp_info);
+ assert(path->extra && path->extra->damp_info);
t_now = bgp_clock();
- bdi = binfo->extra->damp_info;
+ bdi = path->extra->damp_info;
- if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED)) {
t_diff = t_now - bdi->suppress_time;
if (t_diff >= damp->max_suppress_time) {
- bgp_info_unset_flag(bdi->rn, binfo, BGP_INFO_DAMPED);
+ bgp_path_info_unset_flag(bdi->rn, path,
+ BGP_PATH_DAMPED);
bgp_reuse_list_delete(bdi);
BGP_DAMP_LIST_ADD(damp, bdi);
bdi->penalty = damp->reuse_limit;
bdi->suppress_time = 0;
bdi->t_updated = t_now;
- /* Need to announce UPDATE once this binfo is usable
+ /* Need to announce UPDATE once this path is usable
* again. */
if (bdi->lastrecord == BGP_RECORD_UPDATE)
return 1;
@@ -323,7 +324,7 @@ int bgp_damp_scan(struct bgp_info *binfo, afi_t afi, safi_t safi)
bdi->penalty = bgp_damp_decay(t_diff, bdi->penalty);
if (bdi->penalty <= damp->reuse_limit / 2.0) {
- /* release the bdi, bdi->binfo. */
+ /* release the bdi, bdi->path. */
bgp_damp_info_free(bdi, 1);
return 0;
} else
@@ -334,23 +335,24 @@ int bgp_damp_scan(struct bgp_info *binfo, afi_t afi, safi_t safi)
void bgp_damp_info_free(struct bgp_damp_info *bdi, int withdraw)
{
- struct bgp_info *binfo;
+ struct bgp_path_info *path;
if (!bdi)
return;
- binfo = bdi->binfo;
- binfo->extra->damp_info = NULL;
+ path = bdi->path;
+ path->extra->damp_info = NULL;
- if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED))
bgp_reuse_list_delete(bdi);
else
BGP_DAMP_LIST_DEL(damp, bdi);
- bgp_info_unset_flag(bdi->rn, binfo, BGP_INFO_HISTORY | BGP_INFO_DAMPED);
+ bgp_path_info_unset_flag(bdi->rn, path,
+ BGP_PATH_HISTORY | BGP_PATH_DAMPED);
if (bdi->lastrecord == BGP_RECORD_WITHDRAW && withdraw)
- bgp_info_delete(bdi->rn, binfo);
+ bgp_path_info_delete(bdi->rn, path);
XFREE(MTYPE_BGP_DAMP_INFO, bdi);
}
@@ -588,7 +590,7 @@ static const char *bgp_get_reuse_time(unsigned int penalty, char *buf,
return buf;
}
-void bgp_damp_info_vty(struct vty *vty, struct bgp_info *binfo,
+void bgp_damp_info_vty(struct vty *vty, struct bgp_path_info *path,
json_object *json_path)
{
struct bgp_damp_info *bdi;
@@ -596,11 +598,11 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_info *binfo,
char timebuf[BGP_UPTIME_LEN];
int penalty;
- if (!binfo->extra)
+ if (!path->extra)
return;
/* BGP dampening information. */
- bdi = binfo->extra->damp_info;
+ bdi = path->extra->damp_info;
/* If dampening is not enabled or there is no dampening information,
return immediately. */
@@ -618,8 +620,8 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_info *binfo,
peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 1,
json_path);
- if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)
- && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY))
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED)
+ && !CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
bgp_get_reuse_time(penalty, timebuf, BGP_UPTIME_LEN, 1,
json_path);
} else {
@@ -629,8 +631,8 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_info *binfo,
peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 0,
json_path));
- if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)
- && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY))
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED)
+ && !CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
vty_out(vty, ", reuse in %s",
bgp_get_reuse_time(penalty, timebuf,
BGP_UPTIME_LEN, 0,
@@ -640,7 +642,7 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_info *binfo,
}
}
-const char *bgp_damp_reuse_time_vty(struct vty *vty, struct bgp_info *binfo,
+const char *bgp_damp_reuse_time_vty(struct vty *vty, struct bgp_path_info *path,
char *timebuf, size_t len, bool use_json,
json_object *json)
{
@@ -648,11 +650,11 @@ const char *bgp_damp_reuse_time_vty(struct vty *vty, struct bgp_info *binfo,
time_t t_now, t_diff;
int penalty;
- if (!binfo->extra)
+ if (!path->extra)
return NULL;
/* BGP dampening information. */
- bdi = binfo->extra->damp_info;
+ bdi = path->extra->damp_info;
/* If dampening is not enabled or there is no dampening information,
return immediately. */
diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h
index 8326bae697..18bf561c47 100644
--- a/bgpd/bgp_damp.h
+++ b/bgpd/bgp_damp.h
@@ -43,8 +43,8 @@ struct bgp_damp_info {
/* Time of route start to be suppressed. */
time_t suppress_time;
- /* Back reference to bgp_info. */
- struct bgp_info *binfo;
+ /* Back reference to bgp_path_info. */
+ struct bgp_path_info *path;
/* Back reference to bgp_node. */
struct bgp_node *rn;
@@ -130,18 +130,19 @@ struct bgp_damp_config {
extern int bgp_damp_enable(struct bgp *, afi_t, safi_t, time_t, unsigned int,
unsigned int, time_t);
extern int bgp_damp_disable(struct bgp *, afi_t, safi_t);
-extern int bgp_damp_withdraw(struct bgp_info *, struct bgp_node *, afi_t,
- safi_t, int);
-extern int bgp_damp_update(struct bgp_info *, struct bgp_node *, afi_t, safi_t);
-extern int bgp_damp_scan(struct bgp_info *, afi_t, safi_t);
-extern void bgp_damp_info_free(struct bgp_damp_info *, int);
+extern int bgp_damp_withdraw(struct bgp_path_info *path, struct bgp_node *rn,
+ afi_t afi, safi_t safi, int attr_change);
+extern int bgp_damp_update(struct bgp_path_info *path, struct bgp_node *rn,
+ afi_t afi, safi_t saff);
+extern int bgp_damp_scan(struct bgp_path_info *path, afi_t afi, safi_t safi);
+extern void bgp_damp_info_free(struct bgp_damp_info *path, int withdraw);
extern void bgp_damp_info_clean(void);
extern int bgp_damp_decay(time_t, int);
extern void bgp_config_write_damp(struct vty *);
-extern void bgp_damp_info_vty(struct vty *, struct bgp_info *,
+extern void bgp_damp_info_vty(struct vty *vty, struct bgp_path_info *path,
json_object *json_path);
extern const char *bgp_damp_reuse_time_vty(struct vty *vty,
- struct bgp_info *binfo,
+ struct bgp_path_info *path,
char *timebuf, size_t len,
bool use_json, json_object *json);
extern int bgp_show_dampening_parameters(struct vty *vty, afi_t, safi_t);
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index ef746597a4..3d1880ca48 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -299,9 +299,9 @@ static void bgp_dump_routes_index_table(struct bgp *bgp)
}
-static struct bgp_info *bgp_dump_route_node_record(int afi, struct bgp_node *rn,
- struct bgp_info *info,
- unsigned int seq)
+static struct bgp_path_info *
+bgp_dump_route_node_record(int afi, struct bgp_node *rn,
+ struct bgp_path_info *path, unsigned int seq)
{
struct stream *obuf;
size_t sizep;
@@ -349,18 +349,18 @@ static struct bgp_info *bgp_dump_route_node_record(int afi, struct bgp_node *rn,
stream_putw(obuf, 0);
endp = stream_get_endp(obuf);
- for (; info; info = info->next) {
+ for (; path; path = path->next) {
size_t cur_endp;
/* Peer index */
- stream_putw(obuf, info->peer->table_dump_index);
+ stream_putw(obuf, path->peer->table_dump_index);
/* Originated */
- stream_putl(obuf, time(NULL) - (bgp_clock() - info->uptime));
+ stream_putl(obuf, time(NULL) - (bgp_clock() - path->uptime));
/* Dump attribute. */
/* Skip prefix & AFI/SAFI for MP_NLRI */
- bgp_dump_routes_attr(obuf, info->attr, &rn->p);
+ bgp_dump_routes_attr(obuf, path->attr, &rn->p);
cur_endp = stream_get_endp(obuf);
if (cur_endp > BGP_MAX_PACKET_SIZE + BGP_DUMP_MSG_HEADER
@@ -379,7 +379,7 @@ static struct bgp_info *bgp_dump_route_node_record(int afi, struct bgp_node *rn,
bgp_dump_set_size(obuf, MSG_TABLE_DUMP_V2);
fwrite(STREAM_DATA(obuf), stream_get_endp(obuf), 1, bgp_dump_routes.fp);
- return info;
+ return path;
}
@@ -387,7 +387,7 @@ static struct bgp_info *bgp_dump_route_node_record(int afi, struct bgp_node *rn,
static unsigned int bgp_dump_routes_func(int afi, int first_run,
unsigned int seq)
{
- struct bgp_info *info;
+ struct bgp_path_info *path;
struct bgp_node *rn;
struct bgp *bgp;
struct bgp_table *table;
@@ -410,9 +410,9 @@ static unsigned int bgp_dump_routes_func(int afi, int first_run,
table = bgp->rib[afi][SAFI_UNICAST];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- info = rn->info;
- while (info) {
- info = bgp_dump_route_node_record(afi, rn, info, seq);
+ path = rn->info;
+ while (path) {
+ path = bgp_dump_route_node_record(afi, rn, path, seq);
seq++;
}
}
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index c350015cc4..9e71f1855c 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -60,10 +60,9 @@ DEFINE_QOBJ_TYPE(evpnes)
/*
* Static function declarations
*/
-static void delete_evpn_route_entry(struct bgp *bgp,
- afi_t afi, safi_t safi,
+static void delete_evpn_route_entry(struct bgp *bgp, afi_t afi, safi_t safi,
struct bgp_node *rn,
- struct bgp_info **ri);
+ struct bgp_path_info **pi);
static int delete_all_vni_routes(struct bgp *bgp, struct bgpevpn *vpn);
/*
@@ -914,10 +913,10 @@ static int evpn_zebra_uninstall(struct bgp *bgp, struct bgpevpn *vpn,
*/
static void evpn_delete_old_local_route(struct bgp *bgp, struct bgpevpn *vpn,
struct bgp_node *rn,
- struct bgp_info *old_local)
+ struct bgp_path_info *old_local)
{
struct bgp_node *global_rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
@@ -929,18 +928,18 @@ static void evpn_delete_old_local_route(struct bgp *bgp, struct bgpevpn *vpn,
(struct prefix *)&rn->p, &vpn->prd);
if (global_rn) {
/* Delete route entry in the global EVPN table. */
- delete_evpn_route_entry(bgp, afi, safi, global_rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
/* Schedule for processing - withdraws to peers happen from
* this table.
*/
- if (ri)
+ if (pi)
bgp_process(bgp, global_rn, afi, safi);
bgp_unlock_node(global_rn);
}
/* Delete route entry in the VNI route table, caller to remove. */
- bgp_info_delete(rn, old_local);
+ bgp_path_info_delete(rn, old_local);
}
static struct in_addr *es_vtep_new(struct in_addr vtep)
@@ -1030,9 +1029,9 @@ static int evpn_es_route_select_install(struct bgp *bgp,
int ret = 0;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
- struct bgp_info *old_select; /* old best */
- struct bgp_info *new_select; /* new best */
- struct bgp_info_pair old_and_new;
+ struct bgp_path_info *old_select; /* old best */
+ struct bgp_path_info *new_select; /* new best */
+ struct bgp_path_info_pair old_and_new;
/* Compute the best path. */
bgp_best_selection(bgp, rn, &bgp->maxpaths[afi][safi],
@@ -1048,14 +1047,14 @@ static int evpn_es_route_select_install(struct bgp *bgp,
&& old_select->type == ZEBRA_ROUTE_BGP
&& old_select->sub_type == BGP_ROUTE_IMPORTED
&& !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR)
- && !CHECK_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED)
+ && !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
&& !bgp->addpath_tx_used[afi][safi]) {
if (bgp_zebra_has_route_changed(rn, old_select)) {
ret = evpn_es_install_vtep(bgp, es,
(struct prefix_evpn *)&rn->p,
old_select->attr->nexthop);
}
- UNSET_FLAG(old_select->flags, BGP_INFO_MULTIPATH_CHG);
+ UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG);
bgp_zebra_clear_route_change_flags(rn);
return ret;
}
@@ -1071,11 +1070,11 @@ static int evpn_es_route_select_install(struct bgp *bgp,
bgp_bump_version(rn);
if (old_select)
- bgp_info_unset_flag(rn, old_select, BGP_INFO_SELECTED);
+ bgp_path_info_unset_flag(rn, old_select, BGP_PATH_SELECTED);
if (new_select) {
- bgp_info_set_flag(rn, new_select, BGP_INFO_SELECTED);
- bgp_info_unset_flag(rn, new_select, BGP_INFO_ATTR_CHANGED);
- UNSET_FLAG(new_select->flags, BGP_INFO_MULTIPATH_CHG);
+ bgp_path_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
+ bgp_path_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
+ UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG);
}
if (new_select && new_select->type == ZEBRA_ROUTE_BGP
@@ -1094,9 +1093,9 @@ static int evpn_es_route_select_install(struct bgp *bgp,
/* Clear any route change flags. */
bgp_zebra_clear_route_change_flags(rn);
- /* Reap old select bgp_info, if it has been removed */
- if (old_select && CHECK_FLAG(old_select->flags, BGP_INFO_REMOVED))
- bgp_info_reap(rn, old_select);
+ /* Reap old select bgp_path_info, if it has been removed */
+ if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED))
+ bgp_path_info_reap(rn, old_select);
return ret;
}
@@ -1108,8 +1107,8 @@ static int evpn_es_route_select_install(struct bgp *bgp,
static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
struct bgp_node *rn)
{
- struct bgp_info *old_select, *new_select;
- struct bgp_info_pair old_and_new;
+ struct bgp_path_info *old_select, *new_select;
+ struct bgp_path_info_pair old_and_new;
struct prefix_evpn *evp;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
@@ -1131,7 +1130,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
&& old_select->type == ZEBRA_ROUTE_BGP
&& old_select->sub_type == BGP_ROUTE_IMPORTED
&& !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR)
- && !CHECK_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED)
+ && !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
&& !bgp->addpath_tx_used[afi][safi]) {
if (bgp_zebra_has_route_changed(rn, old_select)) {
if (old_select->attr->sticky)
@@ -1147,7 +1146,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
old_select->attr->nexthop, flags,
mac_mobility_seqnum(old_select->attr));
}
- UNSET_FLAG(old_select->flags, BGP_INFO_MULTIPATH_CHG);
+ UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG);
bgp_zebra_clear_route_change_flags(rn);
return ret;
}
@@ -1162,11 +1161,11 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
bgp_bump_version(rn);
if (old_select)
- bgp_info_unset_flag(rn, old_select, BGP_INFO_SELECTED);
+ bgp_path_info_unset_flag(rn, old_select, BGP_PATH_SELECTED);
if (new_select) {
- bgp_info_set_flag(rn, new_select, BGP_INFO_SELECTED);
- bgp_info_unset_flag(rn, new_select, BGP_INFO_ATTR_CHANGED);
- UNSET_FLAG(new_select->flags, BGP_INFO_MULTIPATH_CHG);
+ bgp_path_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
+ bgp_path_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
+ UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG);
}
if (new_select && new_select->type == ZEBRA_ROUTE_BGP
@@ -1205,9 +1204,9 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
/* Clear any route change flags. */
bgp_zebra_clear_route_change_flags(rn);
- /* Reap old select bgp_info, if it has been removed */
- if (old_select && CHECK_FLAG(old_select->flags, BGP_INFO_REMOVED))
- bgp_info_reap(rn, old_select);
+ /* Reap old select bgp_path_info, if it has been removed */
+ if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED))
+ bgp_path_info_reap(rn, old_select);
return ret;
}
@@ -1217,21 +1216,21 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
*/
static int evpn_route_is_def_gw(struct bgp *bgp, struct bgp_node *rn)
{
- struct bgp_info *tmp_ri = NULL;
- struct bgp_info *local_ri = NULL;
+ struct bgp_path_info *tmp_pi = NULL;
+ struct bgp_path_info *local_pi = NULL;
- local_ri = NULL;
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
+ local_pi = NULL;
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
}
- if (!local_ri)
+ if (!local_pi)
return 0;
- return local_ri->attr->default_gw;
+ return local_pi->attr->default_gw;
}
@@ -1240,21 +1239,21 @@ static int evpn_route_is_def_gw(struct bgp *bgp, struct bgp_node *rn)
*/
static int evpn_route_is_sticky(struct bgp *bgp, struct bgp_node *rn)
{
- struct bgp_info *tmp_ri;
- struct bgp_info *local_ri;
+ struct bgp_path_info *tmp_pi;
+ struct bgp_path_info *local_pi;
- local_ri = NULL;
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
+ local_pi = NULL;
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
}
- if (!local_ri)
+ if (!local_pi)
return 0;
- return local_ri->attr->sticky;
+ return local_pi->attr->sticky;
}
/*
@@ -1262,20 +1261,17 @@ static int evpn_route_is_sticky(struct bgp *bgp, struct bgp_node *rn)
* This could be in the ES table or the global table.
* TODO: handle remote ES (type4) routes as well
*/
-static int update_evpn_type4_route_entry(struct bgp *bgp,
- struct evpnes *es,
+static int update_evpn_type4_route_entry(struct bgp *bgp, struct evpnes *es,
afi_t afi, safi_t safi,
- struct bgp_node *rn,
- struct attr *attr,
- int add,
- struct bgp_info **ri,
+ struct bgp_node *rn, struct attr *attr,
+ int add, struct bgp_path_info **ri,
int *route_changed)
{
char buf[ESI_STR_LEN];
char buf1[INET6_ADDRSTRLEN];
- struct bgp_info *tmp_ri = NULL;
- struct bgp_info *local_ri = NULL; /* local route entry if any */
- struct bgp_info *remote_ri = NULL; /* remote route entry if any */
+ struct bgp_path_info *tmp_pi = NULL;
+ struct bgp_path_info *local_pi = NULL; /* local route entry if any */
+ struct bgp_path_info *remote_pi = NULL; /* remote route entry if any */
struct attr *attr_new = NULL;
struct prefix_evpn *evp = NULL;
@@ -1284,22 +1280,22 @@ static int update_evpn_type4_route_entry(struct bgp *bgp,
evp = (struct prefix_evpn *)&rn->p;
/* locate the local and remote entries if any */
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self &&
- tmp_ri->type == ZEBRA_ROUTE_BGP &&
- tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
- if (tmp_ri->type == ZEBRA_ROUTE_BGP &&
- tmp_ri->sub_type == BGP_ROUTE_IMPORTED &&
- CHECK_FLAG(tmp_ri->flags, BGP_INFO_VALID))
- remote_ri = tmp_ri;
- }
-
- /* we don't expect to see a remote_ri at this point.
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
+ if (tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_IMPORTED
+ && CHECK_FLAG(tmp_pi->flags, BGP_PATH_VALID))
+ remote_pi = tmp_pi;
+ }
+
+ /* we don't expect to see a remote_pi at this point.
* An ES route has esi + vtep_ip as the key,
* We shouldn't see the same route from any other vtep.
*/
- if (remote_ri) {
+ if (remote_pi) {
flog_err(
EC_BGP_ES_INVALID,
"%u ERROR: local es route for ESI: %s Vtep %s also learnt from remote",
@@ -1309,46 +1305,47 @@ static int update_evpn_type4_route_entry(struct bgp *bgp,
return -1;
}
- if (!local_ri && !add)
+ if (!local_pi && !add)
return 0;
/* create or update the entry */
- if (!local_ri) {
+ if (!local_pi) {
/* Add or update attribute to hash */
attr_new = bgp_attr_intern(attr);
/* Create new route with its attribute. */
- tmp_ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC,
- 0, bgp->peer_self, attr_new, rn);
- SET_FLAG(tmp_ri->flags, BGP_INFO_VALID);
+ tmp_pi = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
+ bgp->peer_self, attr_new, rn);
+ SET_FLAG(tmp_pi->flags, BGP_PATH_VALID);
/* add the newly created path to the route-node */
- bgp_info_add(rn, tmp_ri);
+ bgp_path_info_add(rn, tmp_pi);
} else {
- tmp_ri = local_ri;
- if (attrhash_cmp(tmp_ri->attr, attr)
- && !CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED))
+ tmp_pi = local_pi;
+ if (attrhash_cmp(tmp_pi->attr, attr)
+ && !CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
*route_changed = 0;
else {
/* The attribute has changed.
* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);
- bgp_info_set_flag(rn, tmp_ri, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, tmp_pi,
+ BGP_PATH_ATTR_CHANGED);
/* Restore route, if needed. */
- if (CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED))
- bgp_info_restore(rn, tmp_ri);
+ if (CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, tmp_pi);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&tmp_ri->attr);
- tmp_ri->attr = attr_new;
- tmp_ri->uptime = bgp_clock();
+ bgp_attr_unintern(&tmp_pi->attr);
+ tmp_pi->attr = attr_new;
+ tmp_pi->uptime = bgp_clock();
}
}
/* Return back the route entry. */
- *ri = tmp_ri;
+ *ri = tmp_pi;
return 0;
}
@@ -1366,7 +1363,7 @@ static int update_evpn_type4_route(struct bgp *bgp,
struct attr attr;
struct attr *attr_new = NULL;
struct bgp_node *rn = NULL;
- struct bgp_info *ri = NULL;
+ struct bgp_path_info *pi = NULL;
memset(&attr, 0, sizeof(struct attr));
@@ -1384,9 +1381,8 @@ static int update_evpn_type4_route(struct bgp *bgp,
rn = bgp_node_get(es->route_table, (struct prefix *)p);
/* Create or update route entry. */
- ret = update_evpn_type4_route_entry(bgp, es, afi, safi, rn,
- &attr, 1, &ri,
- &route_changed);
+ ret = update_evpn_type4_route_entry(bgp, es, afi, safi, rn, &attr, 1,
+ &pi, &route_changed);
if (ret != 0) {
flog_err(EC_BGP_ES_INVALID,
"%u ERROR: Failed to updated ES route ESI: %s VTEP %s",
@@ -1395,8 +1391,8 @@ static int update_evpn_type4_route(struct bgp *bgp,
ipaddr2str(&es->originator_ip, buf1, sizeof(buf1)));
}
- assert(ri);
- attr_new = ri->attr;
+ assert(pi);
+ attr_new = pi->attr;
/* Perform route selection;
* this is just to set the flags correctly
@@ -1411,14 +1407,12 @@ static int update_evpn_type4_route(struct bgp *bgp,
* Prefix-level) similar to L3VPN routes.
*/
if (route_changed) {
- struct bgp_info *global_ri;
+ struct bgp_path_info *global_pi;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)p, &es->prd);
- update_evpn_type4_route_entry(bgp, es, afi, safi,
- rn, attr_new,
- 1, &global_ri,
- &route_changed);
+ update_evpn_type4_route_entry(bgp, es, afi, safi, rn, attr_new,
+ 1, &global_pi, &route_changed);
/* Schedule for processing and unlock node. */
bgp_process(bgp, rn, afi, safi);
@@ -1436,25 +1430,25 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_def,
struct attr *attr, int *route_changed)
{
struct attr *attr_new = NULL;
- struct bgp_info *ri = NULL;
+ struct bgp_path_info *pi = NULL;
mpls_label_t label = MPLS_INVALID_LABEL;
- struct bgp_info *local_ri = NULL;
- struct bgp_info *tmp_ri = NULL;
+ struct bgp_path_info *local_pi = NULL;
+ struct bgp_path_info *tmp_pi = NULL;
*route_changed = 0;
/* locate the local route entry if any */
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp_def->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp_def->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
}
/*
* create a new route entry if one doesnt exist.
* Otherwise see if route attr has changed
*/
- if (!local_ri) {
+ if (!local_pi) {
/* route has changed as this is the first entry */
*route_changed = 1;
@@ -1463,22 +1457,22 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_def,
attr_new = bgp_attr_intern(attr);
/* create the route info from attribute */
- ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
+ pi = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
bgp_def->peer_self, attr_new, rn);
- SET_FLAG(ri->flags, BGP_INFO_VALID);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
/* Type-5 routes advertise the L3-VNI */
- bgp_info_extra_get(ri);
+ bgp_path_info_extra_get(pi);
vni2label(bgp_vrf->l3vni, &label);
- memcpy(&ri->extra->label, &label, sizeof(label));
- ri->extra->num_labels = 1;
+ memcpy(&pi->extra->label, &label, sizeof(label));
+ pi->extra->num_labels = 1;
/* add the route entry to route node*/
- bgp_info_add(rn, ri);
+ bgp_path_info_add(rn, pi);
} else {
- tmp_ri = local_ri;
- if (!attrhash_cmp(tmp_ri->attr, attr)) {
+ tmp_pi = local_pi;
+ if (!attrhash_cmp(tmp_pi->attr, attr)) {
/* attribute changed */
*route_changed = 1;
@@ -1486,16 +1480,17 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_def,
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);
- bgp_info_set_flag(rn, tmp_ri, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, tmp_pi,
+ BGP_PATH_ATTR_CHANGED);
/* Restore route, if needed. */
- if (CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED))
- bgp_info_restore(rn, tmp_ri);
+ if (CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, tmp_pi);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&tmp_ri->attr);
- tmp_ri->attr = attr_new;
- tmp_ri->uptime = bgp_clock();
+ bgp_attr_unintern(&tmp_pi->attr);
+ tmp_pi->attr = attr_new;
+ tmp_pi->uptime = bgp_clock();
}
}
return 0;
@@ -1562,11 +1557,11 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp,
static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
afi_t afi, safi_t safi, struct bgp_node *rn,
struct attr *attr, int add,
- struct bgp_info **ri, uint8_t flags,
+ struct bgp_path_info **pi, uint8_t flags,
uint32_t seq)
{
- struct bgp_info *tmp_ri;
- struct bgp_info *local_ri;
+ struct bgp_path_info *tmp_pi;
+ struct bgp_path_info *local_pi;
struct attr *attr_new;
mpls_label_t label[BGP_MAX_LABELS];
uint32_t num_labels = 1;
@@ -1574,31 +1569,31 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
uint8_t sticky = 0;
struct prefix_evpn *evp;
- *ri = NULL;
+ *pi = NULL;
evp = (struct prefix_evpn *)&rn->p;
memset(&label, 0, sizeof(label));
/* See if this is an update of an existing route, or a new add. */
- local_ri = NULL;
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
- local_ri = tmp_ri;
+ local_pi = NULL;
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
+ local_pi = tmp_pi;
}
/* If route doesn't exist already, create a new one, if told to.
* Otherwise act based on whether the attributes of the route have
* changed or not.
*/
- if (!local_ri && !add)
+ if (!local_pi && !add)
return 0;
/* For non-GW MACs, update MAC mobility seq number, if needed. */
if (seq && !CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW))
add_mac_mobility_to_attr(seq, attr);
- if (!local_ri) {
+ if (!local_pi) {
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);
@@ -1608,10 +1603,10 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
attr_new->sticky = sticky;
/* Create new route with its attribute. */
- tmp_ri = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
+ tmp_pi = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
bgp->peer_self, attr_new, rn);
- SET_FLAG(tmp_ri->flags, BGP_INFO_VALID);
- bgp_info_extra_get(tmp_ri);
+ SET_FLAG(tmp_pi->flags, BGP_PATH_VALID);
+ bgp_path_info_extra_get(tmp_pi);
/* The VNI goes into the 'label' field of the route */
vni2label(vpn->vni, &label[0]);
@@ -1631,13 +1626,13 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
}
}
- memcpy(&tmp_ri->extra->label, label, sizeof(label));
- tmp_ri->extra->num_labels = num_labels;
- bgp_info_add(rn, tmp_ri);
+ memcpy(&tmp_pi->extra->label, label, sizeof(label));
+ tmp_pi->extra->num_labels = num_labels;
+ bgp_path_info_add(rn, tmp_pi);
} else {
- tmp_ri = local_ri;
- if (attrhash_cmp(tmp_ri->attr, attr)
- && !CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED))
+ tmp_pi = local_pi;
+ if (attrhash_cmp(tmp_pi->attr, attr)
+ && !CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
route_change = 0;
else {
/*
@@ -1656,13 +1651,14 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
num_labels++;
}
}
- memcpy(&tmp_ri->extra->label, label, sizeof(label));
- tmp_ri->extra->num_labels = num_labels;
+ memcpy(&tmp_pi->extra->label, label, sizeof(label));
+ tmp_pi->extra->num_labels = num_labels;
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(attr);
- bgp_info_set_flag(rn, tmp_ri, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, tmp_pi,
+ BGP_PATH_ATTR_CHANGED);
/* Extract MAC mobility sequence number, if any. */
attr_new->mm_seqnum =
@@ -1670,18 +1666,18 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
attr_new->sticky = sticky;
/* Restore route, if needed. */
- if (CHECK_FLAG(tmp_ri->flags, BGP_INFO_REMOVED))
- bgp_info_restore(rn, tmp_ri);
+ if (CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, tmp_pi);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&tmp_ri->attr);
- tmp_ri->attr = attr_new;
- tmp_ri->uptime = bgp_clock();
+ bgp_attr_unintern(&tmp_pi->attr);
+ tmp_pi->attr = attr_new;
+ tmp_pi->uptime = bgp_clock();
}
}
/* Return back the route entry. */
- *ri = tmp_ri;
+ *pi = tmp_pi;
return route_change;
}
@@ -1697,7 +1693,7 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
struct attr attr;
struct attr *attr_new;
int add_l3_ecomm = 0;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
int route_change;
@@ -1743,9 +1739,9 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
/* Create or update route entry. */
route_change = update_evpn_route_entry(bgp, vpn, afi, safi, rn, &attr,
- 1, &ri, flags, seq);
- assert(ri);
- attr_new = ri->attr;
+ 1, &pi, flags, seq);
+ assert(pi);
+ attr_new = pi->attr;
/* Perform route selection; this is just to set the flags correctly
* as local route in the VNI always wins.
@@ -1759,12 +1755,12 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
* Prefix-level) similar to L3VPN routes.
*/
if (route_change) {
- struct bgp_info *global_ri;
+ struct bgp_path_info *global_pi;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)p, &vpn->prd);
update_evpn_route_entry(bgp, vpn, afi, safi, rn, attr_new, 1,
- &global_ri, flags, seq);
+ &global_pi, flags, seq);
/* Schedule for processing and unlock node. */
bgp_process(bgp, rn, afi, safi);
@@ -1781,27 +1777,26 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
* Delete EVPN route entry.
* The entry can be in ESI/VNI table or the global table.
*/
-static void delete_evpn_route_entry(struct bgp *bgp,
- afi_t afi, safi_t safi,
+static void delete_evpn_route_entry(struct bgp *bgp, afi_t afi, safi_t safi,
struct bgp_node *rn,
- struct bgp_info **ri)
+ struct bgp_path_info **pi)
{
- struct bgp_info *tmp_ri;
+ struct bgp_path_info *tmp_pi;
- *ri = NULL;
+ *pi = NULL;
/* Now, find matching route. */
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next)
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next)
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
break;
- *ri = tmp_ri;
+ *pi = tmp_pi;
/* Mark route for delete. */
- if (tmp_ri)
- bgp_info_delete(rn, tmp_ri);
+ if (tmp_pi)
+ bgp_path_info_delete(rn, tmp_pi);
}
@@ -1813,7 +1808,7 @@ static int delete_evpn_type4_route(struct bgp *bgp,
{
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_node *rn = NULL; /* rn in esi table */
struct bgp_node *global_rn = NULL; /* rn in global table */
@@ -1833,13 +1828,12 @@ static int delete_evpn_type4_route(struct bgp *bgp,
if (global_rn) {
/* Delete route entry in the global EVPN table. */
- delete_evpn_route_entry(bgp, afi, safi,
- global_rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
/* Schedule for processing - withdraws to peers happen from
* this table.
*/
- if (ri)
+ if (pi)
bgp_process(bgp, global_rn, afi, safi);
bgp_unlock_node(global_rn);
}
@@ -1848,9 +1842,9 @@ static int delete_evpn_type4_route(struct bgp *bgp,
* Delete route entry in the ESI route table.
* This can just be removed.
*/
- delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
- if (ri)
- bgp_info_reap(rn, ri);
+ delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
+ if (pi)
+ bgp_path_info_reap(rn, pi);
bgp_unlock_node(rn);
return 0;
}
@@ -1861,7 +1855,7 @@ static int delete_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp)
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
struct bgp_node *rn = NULL;
- struct bgp_info *ri = NULL;
+ struct bgp_path_info *pi = NULL;
struct bgp *bgp_def = NULL; /* default bgp instance */
bgp_def = bgp_get_default();
@@ -1874,8 +1868,8 @@ static int delete_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp)
if (!rn)
return 0;
- delete_evpn_route_entry(bgp_def, afi, safi, rn, &ri);
- if (ri)
+ delete_evpn_route_entry(bgp_def, afi, safi, rn, &pi);
+ if (pi)
bgp_process(bgp_def, rn, afi, safi);
bgp_unlock_node(rn);
return 0;
@@ -1889,7 +1883,7 @@ static int delete_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
struct prefix_evpn *p)
{
struct bgp_node *rn, *global_rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
@@ -1910,21 +1904,21 @@ static int delete_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
(struct prefix *)p, &vpn->prd);
if (global_rn) {
/* Delete route entry in the global EVPN table. */
- delete_evpn_route_entry(bgp, afi, safi, global_rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
/* Schedule for processing - withdraws to peers happen from
* this table.
*/
- if (ri)
+ if (pi)
bgp_process(bgp, global_rn, afi, safi);
bgp_unlock_node(global_rn);
}
/* Delete route entry in the VNI route table. This can just be removed.
*/
- delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
- if (ri)
- bgp_info_reap(rn, ri);
+ delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
+ if (pi)
+ bgp_path_info_reap(rn, pi);
bgp_unlock_node(rn);
return 0;
@@ -1939,7 +1933,7 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
afi_t afi;
safi_t safi;
struct bgp_node *rn;
- struct bgp_info *ri, *tmp_ri;
+ struct bgp_path_info *pi, *tmp_pi;
struct attr attr;
struct attr *attr_new;
uint32_t seq;
@@ -1955,20 +1949,20 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
rn = bgp_route_next(rn)) {
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
struct bgp_node *rd_rn;
- struct bgp_info *global_ri;
+ struct bgp_path_info *global_pi;
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue;
/* Identify local route. */
- for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
- if (tmp_ri->peer == bgp->peer_self
- && tmp_ri->type == ZEBRA_ROUTE_BGP
- && tmp_ri->sub_type == BGP_ROUTE_STATIC)
+ for (tmp_pi = rn->info; tmp_pi; tmp_pi = tmp_pi->next) {
+ if (tmp_pi->peer == bgp->peer_self
+ && tmp_pi->type == ZEBRA_ROUTE_BGP
+ && tmp_pi->sub_type == BGP_ROUTE_STATIC)
break;
}
- if (!tmp_ri)
+ if (!tmp_pi)
continue;
/*
@@ -2003,25 +1997,25 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
/* Set up extended community. */
build_evpn_route_extcomm(vpn, &attr, add_l3_ecomm);
- seq = mac_mobility_seqnum(tmp_ri->attr);
+ seq = mac_mobility_seqnum(tmp_pi->attr);
/* Update the route entry. */
- update_evpn_route_entry(bgp, vpn, afi, safi, rn,
- &attr, 0, &ri, 0, seq);
+ update_evpn_route_entry(bgp, vpn, afi, safi, rn, &attr, 0, &pi,
+ 0, seq);
/* Perform route selection; this is just to set the flags
* correctly as local route in the VNI always wins.
*/
evpn_route_select_install(bgp, vpn, rn);
- attr_new = ri->attr;
+ attr_new = pi->attr;
/* Update route in global routing table. */
rd_rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)evp, &vpn->prd);
assert(rd_rn);
update_evpn_route_entry(bgp, vpn, afi, safi, rd_rn, attr_new, 0,
- &global_ri, 0,
+ &global_pi, 0,
mac_mobility_seqnum(attr_new));
/* Schedule for processing and unlock node. */
@@ -2046,7 +2040,7 @@ static int delete_global_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
safi_t safi;
struct bgp_node *rdrn, *rn;
struct bgp_table *table;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi = AFI_L2VPN;
safi = SAFI_EVPN;
@@ -2060,8 +2054,8 @@ static int delete_global_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue;
- delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
- if (ri)
+ delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
+ if (pi)
bgp_process(bgp, rn, afi, safi);
}
}
@@ -2082,7 +2076,7 @@ static int delete_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
afi_t afi;
safi_t safi;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi = AFI_L2VPN;
safi = SAFI_EVPN;
@@ -2101,11 +2095,11 @@ static int delete_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue;
- delete_evpn_route_entry(bgp, afi, safi, rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
/* Route entry in local table gets deleted immediately. */
- if (ri)
- bgp_info_reap(rn, ri);
+ if (pi)
+ bgp_path_info_reap(rn, pi);
}
return 0;
@@ -2117,15 +2111,15 @@ static int delete_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
static int delete_all_es_routes(struct bgp *bgp, struct evpnes *es)
{
struct bgp_node *rn;
- struct bgp_info *ri, *nextri;
+ struct bgp_path_info *pi, *nextpi;
/* Walk this ES's route table and delete all routes. */
for (rn = bgp_table_top(es->route_table); rn;
rn = bgp_route_next(rn)) {
- for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
- ri = nextri) {
- bgp_info_delete(rn, ri);
- bgp_info_reap(rn, ri);
+ for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
+ pi = nextpi) {
+ bgp_path_info_delete(rn, pi);
+ bgp_path_info_reap(rn, pi);
}
}
@@ -2138,15 +2132,15 @@ static int delete_all_es_routes(struct bgp *bgp, struct evpnes *es)
static int delete_all_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
{
struct bgp_node *rn;
- struct bgp_info *ri, *nextri;
+ struct bgp_path_info *pi, *nextpi;
/* Walk this VNI's route table and delete all routes. */
for (rn = bgp_table_top(vpn->route_table); rn;
rn = bgp_route_next(rn)) {
- for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
- ri = nextri) {
- bgp_info_delete(rn, ri);
- bgp_info_reap(rn, ri);
+ for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
+ pi = nextpi) {
+ bgp_path_info_delete(rn, pi);
+ bgp_path_info_reap(rn, pi);
}
}
@@ -2166,11 +2160,15 @@ static int update_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn)
/* Update and advertise the type-3 route (only one) followed by the
* locally learnt type-2 routes (MACIP) - for this VNI.
+ *
+ * RT-3 only if doing head-end replication
*/
- build_evpn_type3_prefix(&p, vpn->originator_ip);
- ret = update_evpn_route(bgp, vpn, &p, 0, 0);
- if (ret)
- return ret;
+ if (bgp->vxlan_flood_ctrl == VXLAN_FLOOD_HEAD_END_REPL) {
+ build_evpn_type3_prefix(&p, vpn->originator_ip);
+ ret = update_evpn_route(bgp, vpn, &p, 0, 0);
+ if (ret)
+ return ret;
+ }
return update_all_type2_routes(bgp, vpn);
}
@@ -2261,14 +2259,13 @@ static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,
}
/* Install EVPN route entry in ES */
-static int install_evpn_route_entry_in_es(struct bgp *bgp,
- struct evpnes *es,
+static int install_evpn_route_entry_in_es(struct bgp *bgp, struct evpnes *es,
struct prefix_evpn *p,
- struct bgp_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
int ret = 0;
struct bgp_node *rn = NULL;
- struct bgp_info *ri = NULL;
+ struct bgp_path_info *pi = NULL;
struct attr *attr_new = NULL;
/* Create (or fetch) route within the VNI.
@@ -2277,44 +2274,44 @@ static int install_evpn_route_entry_in_es(struct bgp *bgp,
rn = bgp_node_get(es->route_table, (struct prefix *)p);
/* Check if route entry is already present. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra &&
- (struct bgp_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri) {
+ if (!pi) {
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_ri->attr);
+ attr_new = bgp_attr_intern(parent_pi->attr);
/* Create new route with its attribute. */
- ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
- parent_ri->peer, attr_new, rn);
- SET_FLAG(ri->flags, BGP_INFO_VALID);
- bgp_info_extra_get(ri);
- ri->extra->parent = parent_ri;
- bgp_info_add(rn, ri);
+ pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0,
+ parent_pi->peer, attr_new, rn);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
+ bgp_path_info_extra_get(pi);
+ pi->extra->parent = parent_pi;
+ bgp_path_info_add(rn, pi);
} else {
- if (attrhash_cmp(ri->attr, parent_ri->attr)
- && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) {
+ if (attrhash_cmp(pi->attr, parent_pi->attr)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_unlock_node(rn);
return 0;
}
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_ri->attr);
+ attr_new = bgp_attr_intern(parent_pi->attr);
/* Restore route, if needed. */
- if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED))
- bgp_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
/* Mark if nexthop has changed. */
- if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop))
- SET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED);
+ if (!IPV4_ADDR_SAME(&pi->attr->nexthop, &attr_new->nexthop))
+ SET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
}
/* Perform route selection and update zebra, if required. */
@@ -2327,10 +2324,10 @@ static int install_evpn_route_entry_in_es(struct bgp *bgp,
*/
static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
struct prefix_evpn *evp,
- struct bgp_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct attr attr;
struct attr *attr_new;
int ret = 0;
@@ -2371,38 +2368,38 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
* address for the rest of the code to flow through. In the case of IPv4,
* make sure to set the flag for next hop attribute.
*/
- bgp_attr_dup(&attr, parent_ri->attr);
+ bgp_attr_dup(&attr, parent_pi->attr);
if (afi == AFI_IP6)
evpn_convert_nexthop_to_ipv6(&attr);
else
attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
/* Check if route entry is already present. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri) {
+ if (!pi) {
/* Add (or update) attribute to hash. */
attr_new = bgp_attr_intern(&attr);
/* Create new route with its attribute. */
- ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
- parent_ri->peer, attr_new, rn);
- SET_FLAG(ri->flags, BGP_INFO_VALID);
- bgp_info_extra_get(ri);
- ri->extra->parent = bgp_info_lock(parent_ri);
- bgp_lock_node((struct bgp_node *)parent_ri->net);
- if (parent_ri->extra) {
- memcpy(&ri->extra->label, &parent_ri->extra->label,
- sizeof(ri->extra->label));
- ri->extra->num_labels = parent_ri->extra->num_labels;
+ pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0,
+ parent_pi->peer, attr_new, rn);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
+ bgp_path_info_extra_get(pi);
+ pi->extra->parent = bgp_path_info_lock(parent_pi);
+ bgp_lock_node((struct bgp_node *)parent_pi->net);
+ if (parent_pi->extra) {
+ memcpy(&pi->extra->label, &parent_pi->extra->label,
+ sizeof(pi->extra->label));
+ pi->extra->num_labels = parent_pi->extra->num_labels;
}
- bgp_info_add(rn, ri);
+ bgp_path_info_add(rn, pi);
} else {
- if (attrhash_cmp(ri->attr, &attr)
- && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) {
+ if (attrhash_cmp(pi->attr, &attr)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_unlock_node(rn);
return 0;
}
@@ -2411,24 +2408,24 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
attr_new = bgp_attr_intern(&attr);
/* Restore route, if needed. */
- if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED))
- bgp_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
/* Mark if nexthop has changed. */
- if ((afi == AFI_IP &&
- !IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop)) ||
- (afi == AFI_IP6 &&
- !IPV6_ADDR_SAME(&ri->attr->mp_nexthop_global,
- &attr_new->mp_nexthop_global)))
- SET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED);
+ if ((afi == AFI_IP
+ && !IPV4_ADDR_SAME(&pi->attr->nexthop, &attr_new->nexthop))
+ || (afi == AFI_IP6
+ && !IPV6_ADDR_SAME(&pi->attr->mp_nexthop_global,
+ &attr_new->mp_nexthop_global)))
+ SET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
}
- bgp_aggregate_increment(bgp_vrf, &rn->p, ri, afi, safi);
+ bgp_aggregate_increment(bgp_vrf, &rn->p, pi, afi, safi);
/* Perform route selection and update zebra, if required. */
bgp_process(bgp_vrf, rn, afi, safi);
@@ -2441,10 +2438,10 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
*/
static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
struct prefix_evpn *p,
- struct bgp_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct attr *attr_new;
int ret;
@@ -2453,50 +2450,50 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
rn = bgp_node_get(vpn->route_table, (struct prefix *)p);
/* Check if route entry is already present. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri) {
+ if (!pi) {
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_ri->attr);
+ attr_new = bgp_attr_intern(parent_pi->attr);
/* Create new route with its attribute. */
- ri = info_make(parent_ri->type, BGP_ROUTE_IMPORTED, 0,
- parent_ri->peer, attr_new, rn);
- SET_FLAG(ri->flags, BGP_INFO_VALID);
- bgp_info_extra_get(ri);
- ri->extra->parent = bgp_info_lock(parent_ri);
- bgp_lock_node((struct bgp_node *)parent_ri->net);
- if (parent_ri->extra) {
- memcpy(&ri->extra->label, &parent_ri->extra->label,
- sizeof(ri->extra->label));
- ri->extra->num_labels = parent_ri->extra->num_labels;
+ pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0,
+ parent_pi->peer, attr_new, rn);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
+ bgp_path_info_extra_get(pi);
+ pi->extra->parent = bgp_path_info_lock(parent_pi);
+ bgp_lock_node((struct bgp_node *)parent_pi->net);
+ if (parent_pi->extra) {
+ memcpy(&pi->extra->label, &parent_pi->extra->label,
+ sizeof(pi->extra->label));
+ pi->extra->num_labels = parent_pi->extra->num_labels;
}
- bgp_info_add(rn, ri);
+ bgp_path_info_add(rn, pi);
} else {
- if (attrhash_cmp(ri->attr, parent_ri->attr)
- && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) {
+ if (attrhash_cmp(pi->attr, parent_pi->attr)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_unlock_node(rn);
return 0;
}
/* The attribute has changed. */
/* Add (or update) attribute to hash. */
- attr_new = bgp_attr_intern(parent_ri->attr);
+ attr_new = bgp_attr_intern(parent_pi->attr);
/* Restore route, if needed. */
- if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED))
- bgp_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
/* Mark if nexthop has changed. */
- if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop))
- SET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED);
+ if (!IPV4_ADDR_SAME(&pi->attr->nexthop, &attr_new->nexthop))
+ SET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
/* Unintern existing, set to new. */
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
}
/* Perform route selection and update zebra, if required. */
@@ -2506,14 +2503,13 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
}
/* Uninstall EVPN route entry from ES route table */
-static int uninstall_evpn_route_entry_in_es(struct bgp *bgp,
- struct evpnes *es,
+static int uninstall_evpn_route_entry_in_es(struct bgp *bgp, struct evpnes *es,
struct prefix_evpn *p,
- struct bgp_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
int ret;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
if (!es->route_table)
return 0;
@@ -2526,16 +2522,16 @@ static int uninstall_evpn_route_entry_in_es(struct bgp *bgp,
return 0;
/* Find matching route entry. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra &&
- (struct bgp_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri)
+ if (!pi)
return 0;
/* Mark entry for deletion */
- bgp_info_delete(rn, ri);
+ bgp_path_info_delete(rn, pi);
/* Perform route selection and update zebra, if required. */
ret = evpn_es_route_select_install(bgp, es, rn);
@@ -2552,10 +2548,10 @@ static int uninstall_evpn_route_entry_in_es(struct bgp *bgp,
*/
static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
struct prefix_evpn *evp,
- struct bgp_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
int ret = 0;
struct prefix p;
struct prefix *pp = &p;
@@ -2591,18 +2587,18 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
return 0;
/* Find matching route entry. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri)
+ if (!pi)
return 0;
- bgp_aggregate_decrement(bgp_vrf, &rn->p, ri, afi, safi);
+ bgp_aggregate_decrement(bgp_vrf, &rn->p, pi, afi, safi);
/* Mark entry for deletion */
- bgp_info_delete(rn, ri);
+ bgp_path_info_delete(rn, pi);
/* Perform route selection and update zebra, if required. */
bgp_process(bgp_vrf, rn, afi, safi);
@@ -2619,10 +2615,10 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
*/
static int uninstall_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
struct prefix_evpn *p,
- struct bgp_info *parent_ri)
+ struct bgp_path_info *parent_pi)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
int ret;
/* Locate route within the VNI. */
@@ -2632,16 +2628,16 @@ static int uninstall_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
return 0;
/* Find matching route entry. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->extra
- && (struct bgp_info *)ri->extra->parent == parent_ri)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->extra
+ && (struct bgp_path_info *)pi->extra->parent == parent_pi)
break;
- if (!ri)
+ if (!pi)
return 0;
/* Mark entry for deletion */
- bgp_info_delete(rn, ri);
+ bgp_path_info_delete(rn, pi);
/* Perform route selection and update zebra, if required. */
ret = evpn_route_select_install(bgp, vpn, rn);
@@ -2672,9 +2668,10 @@ static int is_prefix_matching_for_es(struct prefix_evpn *p,
* Given a route entry and a VRF, see if this route entry should be
* imported into the VRF i.e., RTs match.
*/
-static int is_route_matching_for_vrf(struct bgp *bgp_vrf, struct bgp_info *ri)
+static int is_route_matching_for_vrf(struct bgp *bgp_vrf,
+ struct bgp_path_info *pi)
{
- struct attr *attr = ri->attr;
+ struct attr *attr = pi->attr;
struct ecommunity *ecom;
int i;
@@ -2739,9 +2736,9 @@ static int is_route_matching_for_vrf(struct bgp *bgp_vrf, struct bgp_info *ri)
* imported into the VNI i.e., RTs match.
*/
static int is_route_matching_for_vni(struct bgp *bgp, struct bgpevpn *vpn,
- struct bgp_info *ri)
+ struct bgp_path_info *pi)
{
- struct attr *attr = ri->attr;
+ struct attr *attr = pi->attr;
struct ecommunity *ecom;
int i;
@@ -2812,7 +2809,7 @@ static int install_uninstall_routes_for_es(struct bgp *bgp,
char buf1[ESI_STR_LEN];
struct bgp_node *rd_rn, *rn;
struct bgp_table *table;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi = AFI_L2VPN;
safi = SAFI_EVPN;
@@ -2831,14 +2828,14 @@ static int install_uninstall_routes_for_es(struct bgp *bgp,
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
/*
* Consider "valid" remote routes applicable for
* this ES.
*/
- if (!(CHECK_FLAG(ri->flags, BGP_INFO_VALID)
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_NORMAL))
+ if (!(CHECK_FLAG(pi->flags, BGP_PATH_VALID)
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_NORMAL))
continue;
if (!is_prefix_matching_for_es(evp, es))
@@ -2846,10 +2843,10 @@ static int install_uninstall_routes_for_es(struct bgp *bgp,
if (install)
ret = install_evpn_route_entry_in_es(
- bgp, es, evp, ri);
+ bgp, es, evp, pi);
else
ret = uninstall_evpn_route_entry_in_es(
- bgp, es, evp, ri);
+ bgp, es, evp, pi);
if (ret) {
flog_err(
@@ -2879,7 +2876,7 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
safi_t safi;
struct bgp_node *rd_rn, *rn;
struct bgp_table *table;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
int ret;
char buf[PREFIX_STRLEN];
struct bgp *bgp_def = NULL;
@@ -2914,22 +2911,22 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
|| is_evpn_prefix_ipaddr_v6(evp)))
continue;
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
/* Consider "valid" remote routes applicable for
* this VRF.
*/
- if (!(CHECK_FLAG(ri->flags, BGP_INFO_VALID)
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_NORMAL))
+ if (!(CHECK_FLAG(pi->flags, BGP_PATH_VALID)
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_NORMAL))
continue;
- if (is_route_matching_for_vrf(bgp_vrf, ri)) {
+ if (is_route_matching_for_vrf(bgp_vrf, pi)) {
if (install)
ret = install_evpn_route_entry_in_vrf(
- bgp_vrf, evp, ri);
+ bgp_vrf, evp, pi);
else
ret = uninstall_evpn_route_entry_in_vrf(
- bgp_vrf, evp, ri);
+ bgp_vrf, evp, pi);
if (ret) {
flog_err(
@@ -2964,7 +2961,7 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
safi_t safi;
struct bgp_node *rd_rn, *rn;
struct bgp_table *table;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
int ret;
afi = AFI_L2VPN;
@@ -2989,21 +2986,21 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
if (evp->prefix.route_type != rtype)
continue;
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
/* Consider "valid" remote routes applicable for
* this VNI. */
- if (!(CHECK_FLAG(ri->flags, BGP_INFO_VALID)
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_NORMAL))
+ if (!(CHECK_FLAG(pi->flags, BGP_PATH_VALID)
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_NORMAL))
continue;
- if (is_route_matching_for_vni(bgp, vpn, ri)) {
+ if (is_route_matching_for_vni(bgp, vpn, pi)) {
if (install)
ret = install_evpn_route_entry(
- bgp, vpn, evp, ri);
+ bgp, vpn, evp, pi);
else
ret = uninstall_evpn_route_entry(
- bgp, vpn, evp, ri);
+ bgp, vpn, evp, pi);
if (ret) {
flog_err(
@@ -3097,16 +3094,15 @@ static int uninstall_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn)
static int install_uninstall_route_in_es(struct bgp *bgp, struct evpnes *es,
afi_t afi, safi_t safi,
struct prefix_evpn *evp,
- struct bgp_info *ri,
- int install)
+ struct bgp_path_info *pi, int install)
{
int ret = 0;
char buf[ESI_STR_LEN];
if (install)
- ret = install_evpn_route_entry_in_es(bgp, es, evp, ri);
+ ret = install_evpn_route_entry_in_es(bgp, es, evp, pi);
else
- ret = uninstall_evpn_route_entry_in_es(bgp, es, evp, ri);
+ ret = uninstall_evpn_route_entry_in_es(bgp, es, evp, pi);
if (ret) {
flog_err(
@@ -3124,7 +3120,7 @@ static int install_uninstall_route_in_es(struct bgp *bgp, struct evpnes *es,
*/
static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
safi_t safi, struct prefix_evpn *evp,
- struct bgp_info *ri,
+ struct bgp_path_info *pi,
struct list *vrfs, int install)
{
char buf[PREFIX2STR_BUFFER];
@@ -3146,10 +3142,10 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
int ret;
if (install)
- ret = install_evpn_route_entry_in_vrf(bgp_vrf, evp, ri);
+ ret = install_evpn_route_entry_in_vrf(bgp_vrf, evp, pi);
else
ret = uninstall_evpn_route_entry_in_vrf(bgp_vrf, evp,
- ri);
+ pi);
if (ret) {
flog_err(EC_BGP_EVPN_FAIL,
@@ -3170,7 +3166,7 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
*/
static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi,
safi_t safi, struct prefix_evpn *evp,
- struct bgp_info *ri,
+ struct bgp_path_info *pi,
struct list *vnis, int install)
{
struct bgpevpn *vpn;
@@ -3183,9 +3179,9 @@ static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi,
continue;
if (install)
- ret = install_evpn_route_entry(bgp, vpn, evp, ri);
+ ret = install_evpn_route_entry(bgp, vpn, evp, pi);
else
- ret = uninstall_evpn_route_entry(bgp, vpn, evp, ri);
+ ret = uninstall_evpn_route_entry(bgp, vpn, evp, pi);
if (ret) {
flog_err(EC_BGP_EVPN_FAIL,
@@ -3206,11 +3202,11 @@ static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi,
* Install or uninstall route for appropriate VNIs/ESIs.
*/
static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct prefix *p, struct bgp_info *ri,
- int import)
+ struct prefix *p,
+ struct bgp_path_info *pi, int import)
{
struct prefix_evpn *evp = (struct prefix_evpn *)p;
- struct attr *attr = ri->attr;
+ struct attr *attr = pi->attr;
struct ecommunity *ecom;
int i;
@@ -3262,17 +3258,15 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
irt = lookup_import_rt(bgp, eval);
if (irt)
- install_uninstall_route_in_vnis(bgp, afi, safi,
- evp, ri,
- irt->vnis,
- import);
+ install_uninstall_route_in_vnis(
+ bgp, afi, safi, evp, pi, irt->vnis,
+ import);
vrf_irt = lookup_vrf_import_rt(eval);
if (vrf_irt)
- install_uninstall_route_in_vrfs(bgp, afi, safi,
- evp, ri,
- vrf_irt->vrfs,
- import);
+ install_uninstall_route_in_vrfs(
+ bgp, afi, safi, evp, pi, vrf_irt->vrfs,
+ import);
/* Also check for non-exact match.
* In this, we mask out the AS and
@@ -3292,15 +3286,13 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
}
if (irt)
- install_uninstall_route_in_vnis(bgp, afi, safi,
- evp, ri,
- irt->vnis,
- import);
+ install_uninstall_route_in_vnis(
+ bgp, afi, safi, evp, pi, irt->vnis,
+ import);
if (vrf_irt)
- install_uninstall_route_in_vrfs(bgp, afi, safi,
- evp, ri,
- vrf_irt->vrfs,
- import);
+ install_uninstall_route_in_vrfs(
+ bgp, afi, safi, evp, pi, vrf_irt->vrfs,
+ import);
}
/* es route is imported into the es table */
@@ -3311,9 +3303,8 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
*/
es = bgp_evpn_lookup_es(bgp, &evp->prefix.es_addr.esi);
if (es && is_es_local(es))
- install_uninstall_route_in_es(bgp, es,
- afi, safi,
- evp, ri, import);
+ install_uninstall_route_in_es(
+ bgp, es, afi, safi, evp, pi, import);
}
}
@@ -3393,7 +3384,7 @@ static int update_advertise_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
{
struct prefix_evpn p;
struct bgp_node *rn, *global_rn;
- struct bgp_info *ri, *global_ri;
+ struct bgp_path_info *pi, *global_pi;
struct attr *attr;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
@@ -3401,27 +3392,32 @@ static int update_advertise_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
/* Locate type-3 route for VNI in the per-VNI table and use its
* attributes to create and advertise the type-3 route for this VNI
* in the global table.
+ *
+ * RT-3 only if doing head-end replication
*/
- build_evpn_type3_prefix(&p, vpn->originator_ip);
- rn = bgp_node_lookup(vpn->route_table, (struct prefix *)&p);
- if (!rn) /* unexpected */
- return 0;
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
- break;
- if (!ri) /* unexpected */
- return 0;
- attr = ri->attr;
+ if (bgp->vxlan_flood_ctrl == VXLAN_FLOOD_HEAD_END_REPL) {
+ build_evpn_type3_prefix(&p, vpn->originator_ip);
+ rn = bgp_node_lookup(vpn->route_table, (struct prefix *)&p);
+ if (!rn) /* unexpected */
+ return 0;
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self &&
+ pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
+ break;
+ if (!pi) /* unexpected */
+ return 0;
+ attr = pi->attr;
- global_rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
- (struct prefix *)&p, &vpn->prd);
- update_evpn_route_entry(bgp, vpn, afi, safi, global_rn, attr, 1, &ri,
- 0, mac_mobility_seqnum(attr));
+ global_rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
+ (struct prefix *)&p, &vpn->prd);
+ update_evpn_route_entry(bgp, vpn, afi, safi, global_rn, attr,
+ 1, &pi, 0, mac_mobility_seqnum(attr));
- /* Schedule for processing and unlock node. */
- bgp_process(bgp, global_rn, afi, safi);
- bgp_unlock_node(global_rn);
+ /* Schedule for processing and unlock node. */
+ bgp_process(bgp, global_rn, afi, safi);
+ bgp_unlock_node(global_rn);
+ }
/* Now, walk this VNI's route table and use the route and its attribute
* to create and schedule route in global table.
@@ -3434,23 +3430,23 @@ static int update_advertise_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue;
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
- if (!ri)
+ if (!pi)
continue;
/* Create route in global routing table using this route entry's
* attribute.
*/
- attr = ri->attr;
+ attr = pi->attr;
global_rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi,
(struct prefix *)evp, &vpn->prd);
assert(global_rn);
update_evpn_route_entry(bgp, vpn, afi, safi, global_rn, attr, 1,
- &global_ri, 0,
+ &global_pi, 0,
mac_mobility_seqnum(attr));
/* Schedule for processing and unlock node. */
@@ -3470,7 +3466,7 @@ static int delete_withdraw_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
int ret;
struct prefix_evpn p;
struct bgp_node *global_rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
@@ -3487,12 +3483,12 @@ static int delete_withdraw_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
(struct prefix *)&p, &vpn->prd);
if (global_rn) {
/* Delete route entry in the global EVPN table. */
- delete_evpn_route_entry(bgp, afi, safi, global_rn, &ri);
+ delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
/* Schedule for processing - withdraws to peers happen from
* this table.
*/
- if (ri)
+ if (pi)
bgp_process(bgp, global_rn, afi, safi);
bgp_unlock_node(global_rn);
}
@@ -3536,6 +3532,42 @@ static void withdraw_router_id_vni(struct hash_backet *backet, struct bgp *bgp)
}
/*
+ * Create RT-3 for a VNI and schedule for processing and advertisement.
+ * This is invoked upon flooding mode changing to head-end replication.
+ */
+static void create_advertise_type3(struct hash_backet *backet, void *data)
+{
+ struct bgpevpn *vpn = backet->data;
+ struct bgp *bgp = data;
+ struct prefix_evpn p;
+
+ if (!vpn || !is_vni_live(vpn))
+ return;
+
+ build_evpn_type3_prefix(&p, vpn->originator_ip);
+ if (update_evpn_route(bgp, vpn, &p, 0, 0))
+ flog_err(EC_BGP_EVPN_ROUTE_CREATE,
+ "Type3 route creation failure for VNI %u", vpn->vni);
+}
+
+/*
+ * Delete RT-3 for a VNI and schedule for processing and withdrawal.
+ * This is invoked upon flooding mode changing to drop BUM packets.
+ */
+static void delete_withdraw_type3(struct hash_backet *backet, void *data)
+{
+ struct bgpevpn *vpn = backet->data;
+ struct bgp *bgp = data;
+ struct prefix_evpn p;
+
+ if (!vpn || !is_vni_live(vpn))
+ return;
+
+ build_evpn_type3_prefix(&p, vpn->originator_ip);
+ delete_evpn_route(bgp, vpn, &p);
+}
+
+/*
* Process received EVPN type-2 route (advertise or withdraw).
*/
static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi,
@@ -4090,15 +4122,15 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf, afi_t afi, safi_t safi)
{
struct bgp_table *table = NULL;
struct bgp_node *rn = NULL;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
table = bgp_vrf->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
/* Only care about "selected" routes - non-imported. */
/* TODO: Support for AddPath for EVPN. */
- for (ri = rn->info; ri; ri = ri->next) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)
- && (!ri->extra || !ri->extra->parent)) {
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)
+ && (!pi->extra || !pi->extra->parent)) {
bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p,
afi, safi);
break;
@@ -4138,7 +4170,7 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi,
{
struct bgp_table *table = NULL;
struct bgp_node *rn = NULL;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
table = bgp_vrf->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
@@ -4146,9 +4178,9 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi,
* attribute. Also, we only consider "non-imported" routes.
* TODO: Support for AddPath for EVPN.
*/
- for (ri = rn->info; ri; ri = ri->next) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)
- && (!ri->extra || !ri->extra->parent)) {
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)
+ && (!pi->extra || !pi->extra->parent)) {
/* apply the route-map */
if (bgp_vrf->adv_cmd_rmap[afi][safi].map) {
@@ -4157,12 +4189,12 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi,
ret = route_map_apply(
bgp_vrf->adv_cmd_rmap[afi][safi]
.map,
- &rn->p, RMAP_BGP, ri);
+ &rn->p, RMAP_BGP, pi);
if (ret == RMAP_DENYMATCH)
continue;
}
bgp_evpn_advertise_type5_route(
- bgp_vrf, &rn->p, ri->attr, afi, safi);
+ bgp_vrf, &rn->p, pi->attr, afi, safi);
break;
}
}
@@ -5074,18 +5106,18 @@ void bgp_evpn_es_free(struct bgp *bgp, struct evpnes *es)
* Import evpn route from global table to VNI/VRF/ESI.
*/
int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct prefix *p, struct bgp_info *ri)
+ struct prefix *p, struct bgp_path_info *pi)
{
- return install_uninstall_evpn_route(bgp, afi, safi, p, ri, 1);
+ return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 1);
}
/*
* Unimport evpn route from VNI/VRF/ESI.
*/
int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct prefix *p, struct bgp_info *ri)
+ struct prefix *p, struct bgp_path_info *pi)
{
- return install_uninstall_evpn_route(bgp, afi, safi, p, ri, 0);
+ return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 0);
}
/* filter routes which have martian next hops */
@@ -5095,7 +5127,7 @@ int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp)
safi_t safi;
struct bgp_node *rd_rn, *rn;
struct bgp_table *table;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi = AFI_L2VPN;
safi = SAFI_EVPN;
@@ -5114,23 +5146,23 @@ int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp)
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
/* Consider "valid" remote routes applicable for
* this VNI. */
- if (!(ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_NORMAL))
+ if (!(pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_NORMAL))
continue;
- if (bgp_nexthop_self(bgp, ri->attr->nexthop)) {
+ if (bgp_nexthop_self(bgp, pi->attr->nexthop)) {
char attr_str[BUFSIZ];
char pbuf[PREFIX_STRLEN];
- bgp_dump_attr(ri->attr, attr_str,
+ bgp_dump_attr(pi->attr, attr_str,
BUFSIZ);
- if (bgp_debug_update(ri->peer, &rn->p,
+ if (bgp_debug_update(pi->peer, &rn->p,
NULL, 1))
zlog_debug(
"%u: prefix %s with attr %s - DENIED due to martian or self nexthop",
@@ -5141,9 +5173,9 @@ int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp)
attr_str);
bgp_evpn_unimport_route(bgp, afi, safi,
- &rn->p, ri);
+ &rn->p, pi);
- bgp_rib_remove(rn, ri, ri->peer, afi,
+ bgp_rib_remove(rn, pi, pi->peer, afi,
safi);
}
}
@@ -5349,7 +5381,7 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id)
}
/* Remove remote routes from BGT VRF even if BGP_VRF_AUTO is configured,
- * bgp_delete would not remove/decrement bgp_info of the ip_prefix
+ * bgp_delete would not remove/decrement bgp_path_info of the ip_prefix
* routes. This will uninstalling the routes from zebra and decremnt the
* bgp info count.
*/
@@ -5494,13 +5526,19 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
/* filter routes as nexthop database has changed */
bgp_filter_evpn_routes_upon_martian_nh_change(bgp);
- /* Create EVPN type-3 route and schedule for processing. */
- build_evpn_type3_prefix(&p, vpn->originator_ip);
- if (update_evpn_route(bgp, vpn, &p, 0, 0)) {
- flog_err(EC_BGP_EVPN_ROUTE_CREATE,
- "%u: Type3 route creation failure for VNI %u",
- bgp->vrf_id, vni);
- return -1;
+ /*
+ * Create EVPN type-3 route and schedule for processing.
+ *
+ * RT-3 only if doing head-end replication
+ */
+ if (bgp->vxlan_flood_ctrl == VXLAN_FLOOD_HEAD_END_REPL) {
+ build_evpn_type3_prefix(&p, vpn->originator_ip);
+ if (update_evpn_route(bgp, vpn, &p, 0, 0)) {
+ flog_err(EC_BGP_EVPN_ROUTE_CREATE,
+ "%u: Type3 route creation failure for VNI %u",
+ bgp->vrf_id, vni);
+ return -1;
+ }
}
/* If we have learnt and retained remote routes (VTEPs, MACs) for this
@@ -5599,6 +5637,26 @@ int bgp_evpn_local_es_add(struct bgp *bgp,
}
/*
+ * Handle change in setting for BUM handling. The supported values
+ * are head-end replication and dropping all BUM packets. Any change
+ * should be registered with zebra. Also, if doing head-end replication,
+ * need to advertise local VNIs as EVPN RT-3 wheras, if BUM packets are
+ * to be dropped, the RT-3s must be withdrawn.
+ */
+void bgp_evpn_flood_control_change(struct bgp *bgp)
+{
+ zlog_info("L2VPN EVPN BUM handling is %s",
+ bgp->vxlan_flood_ctrl == VXLAN_FLOOD_HEAD_END_REPL ?
+ "Flooding" : "Flooding Disabled");
+
+ bgp_zebra_vxlan_flood_control(bgp, bgp->vxlan_flood_ctrl);
+ if (bgp->vxlan_flood_ctrl == VXLAN_FLOOD_HEAD_END_REPL)
+ hash_iterate(bgp->vnihash, create_advertise_type3, bgp);
+ else if (bgp->vxlan_flood_ctrl == VXLAN_FLOOD_DISABLED)
+ hash_iterate(bgp->vnihash, delete_withdraw_type3, bgp);
+}
+
+/*
* Cleanup EVPN information on disable - Need to delete and withdraw
* EVPN routes from peers.
*/
@@ -5665,6 +5723,9 @@ void bgp_evpn_init(struct bgp *bgp)
bgp->vrf_export_rtl->del = evpn_xxport_delete_ecomm;
bgp->l2vnis = list_new();
bgp->l2vnis->cmp = (int (*)(void *, void *))vni_hash_cmp;
+
+ /* Default BUM handling is to do head-end replication. */
+ bgp->vxlan_flood_ctrl = VXLAN_FLOOD_HEAD_END_REPL;
}
void bgp_evpn_vrf_delete(struct bgp *bgp_vrf)
diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h
index b002be3d3d..8728fdcab7 100644
--- a/bgpd/bgp_evpn.h
+++ b/bgpd/bgp_evpn.h
@@ -76,9 +76,9 @@ static inline int advertise_type5_routes(struct bgp *bgp_vrf,
}
/* Flag if the route's parent is a EVPN route. */
-static inline int is_route_parent_evpn(struct bgp_info *ri)
+static inline int is_route_parent_evpn(struct bgp_path_info *ri)
{
- struct bgp_info *parent_ri;
+ struct bgp_path_info *parent_ri;
struct bgp_table *table;
struct bgp_node *rn;
@@ -89,7 +89,7 @@ static inline int is_route_parent_evpn(struct bgp_info *ri)
return 0;
/* See if the parent is of family L2VPN/EVPN */
- parent_ri = (struct bgp_info *)ri->extra->parent;
+ parent_ri = (struct bgp_path_info *)ri->extra->parent;
rn = parent_ri->net;
if (!rn)
return 0;
@@ -124,9 +124,9 @@ extern void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
extern int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet, int withdraw);
extern int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct prefix *p, struct bgp_info *ri);
+ struct prefix *p, struct bgp_path_info *ri);
extern int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct prefix *p, struct bgp_info *ri);
+ struct prefix *p, struct bgp_path_info *ri);
extern int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp);
extern int bgp_evpn_local_macip_del(struct bgp *bgp, vni_t vni,
struct ethaddr *mac, struct ipaddr *ip);
@@ -145,6 +145,7 @@ extern int bgp_evpn_local_es_add(struct bgp *bgp, esi_t *esi,
struct ipaddr *originator_ip);
extern int bgp_evpn_local_es_del(struct bgp *bgp, esi_t *esi,
struct ipaddr *originator_ip);
+extern void bgp_evpn_flood_control_change(struct bgp *bgp);
extern void bgp_evpn_cleanup_on_disable(struct bgp *bgp);
extern void bgp_evpn_cleanup(struct bgp *bgp);
extern void bgp_evpn_init(struct bgp *bgp);
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 5a1e8edac4..90c9db3dfe 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -536,7 +536,7 @@ static void show_esi_routes(struct bgp *bgp,
{
int header = 1;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
uint32_t prefix_cnt, path_cnt;
uint64_t tbl_ver;
@@ -573,13 +573,13 @@ static void show_esi_routes(struct bgp *bgp,
/* For EVPN, the prefix is displayed for each path (to fit in
* with code that already exists).
*/
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out(vty, &rn->p, ri, 0, SAFI_EVPN, json_path);
+ route_vty_out(vty, &rn->p, pi, 0, SAFI_EVPN, json_path);
if (json)
json_object_array_add(json_paths, json_path);
@@ -616,7 +616,7 @@ static void show_vni_routes(struct bgp *bgp, struct bgpevpn *vpn, int type,
json_object *json)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_table *table;
int header = 1;
uint64_t tbl_ver;
@@ -660,18 +660,18 @@ static void show_vni_routes(struct bgp *bgp, struct bgpevpn *vpn, int type,
/* For EVPN, the prefix is displayed for each path (to fit in
* with code that already exists).
*/
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (vtep_ip.s_addr
&& !IPV4_ADDR_SAME(&(vtep_ip),
- &(ri->attr->nexthop)))
+ &(pi->attr->nexthop)))
continue;
if (json)
json_path = json_object_new_array();
- route_vty_out(vty, &rn->p, ri, 0, SAFI_EVPN, json_path);
+ route_vty_out(vty, &rn->p, pi, 0, SAFI_EVPN, json_path);
if (json)
json_object_array_add(json_paths, json_path);
@@ -990,7 +990,7 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
struct bgp_table *table;
struct bgp_node *rn;
struct bgp_node *rm;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
int rd_header;
int header = 1;
@@ -1046,14 +1046,14 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
tbl_ver = table->version;
for (rm = bgp_table_top(table); rm; rm = bgp_route_next(rm))
- for (ri = rm->info; ri; ri = ri->next) {
+ for (pi = rm->info; pi; pi = pi->next) {
total_count++;
if (type == bgp_show_type_neighbor) {
union sockunion *su = output_arg;
- if (ri->peer->su_remote == NULL
+ if (pi->peer->su_remote == NULL
|| !sockunion_same(
- ri->peer->su_remote, su))
+ pi->peer->su_remote, su))
continue;
}
if (header == 0) {
@@ -1162,14 +1162,14 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
else
json_array = NULL;
if (option == SHOW_DISPLAY_TAGS)
- route_vty_out_tag(vty, &rm->p, ri, 0,
+ route_vty_out_tag(vty, &rm->p, pi, 0,
SAFI_EVPN,
json_array);
else if (option == SHOW_DISPLAY_OVERLAY)
- route_vty_out_overlay(vty, &rm->p, ri,
+ route_vty_out_overlay(vty, &rm->p, pi,
0, json_array);
else
- route_vty_out(vty, &rm->p, ri, 0,
+ route_vty_out(vty, &rm->p, pi, 0,
SAFI_EVPN, json_array);
output_count++;
}
@@ -2017,7 +2017,7 @@ static void evpn_show_route_vni_multicast(struct vty *vty, struct bgp *bgp,
struct bgpevpn *vpn;
struct prefix_evpn p;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
uint32_t path_cnt = 0;
afi_t afi;
safi_t safi;
@@ -2049,13 +2049,13 @@ static void evpn_show_route_vni_multicast(struct vty *vty, struct bgp *bgp,
route_vty_out_detail_header(vty, bgp, rn, NULL, afi, safi, json);
/* Display each path for this prefix. */
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out_detail(vty, bgp, &rn->p, ri, afi, safi,
+ route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi,
json_path);
if (json)
@@ -2086,7 +2086,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
struct bgpevpn *vpn;
struct prefix_evpn p;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
uint32_t path_cnt = 0;
afi_t afi;
safi_t safi;
@@ -2119,13 +2119,13 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
route_vty_out_detail_header(vty, bgp, rn, NULL, afi, safi, json);
/* Display each path for this prefix. */
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out_detail(vty, bgp, &rn->p, ri, afi, safi,
+ route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi,
json_path);
if (json)
@@ -2196,7 +2196,7 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp,
{
struct prefix_evpn p;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi_t afi;
safi_t safi;
uint32_t path_cnt = 0;
@@ -2226,13 +2226,13 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp,
json_paths = json_object_new_array();
/* Display each path for this prefix. */
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out_detail(vty, bgp, &rn->p, ri, afi, safi,
+ route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi,
json_path);
if (json)
@@ -2262,7 +2262,7 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp,
struct bgp_node *rd_rn;
struct bgp_table *table;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
int rd_header = 1;
afi_t afi;
safi_t safi;
@@ -2330,13 +2330,13 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp,
json_paths = json_object_new_array();
/* Display each path for this prefix. */
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
if (json)
json_path = json_object_new_array();
- route_vty_out_detail(vty, bgp, &rn->p, ri, afi, safi,
+ route_vty_out_detail(vty, bgp, &rn->p, pi, afi, safi,
json_path);
if (json)
@@ -2383,7 +2383,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
struct bgp_node *rd_rn;
struct bgp_table *table;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
int header = 1;
int rd_header;
afi_t afi;
@@ -2467,7 +2467,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
* fit in
* with code that already exists).
*/
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
json_object *json_path = NULL;
path_cnt++;
add_prefix_to_json = 1;
@@ -2476,7 +2476,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
if (json)
json_path = json_object_new_array();
- route_vty_out(vty, &rn->p, ri, 0, SAFI_EVPN,
+ route_vty_out(vty, &rn->p, pi, 0, SAFI_EVPN,
json_path);
if (json)
@@ -2807,6 +2807,40 @@ static void write_vni_config(struct vty *vty, struct bgpevpn *vpn)
}
}
+#ifndef VTYSH_EXTRACT_PL
+#include "bgpd/bgp_evpn_vty_clippy.c"
+#endif
+
+DEFPY(bgp_evpn_flood_control,
+ bgp_evpn_flood_control_cmd,
+ "[no$no] flooding <disable$disable|head-end-replication$her>",
+ NO_STR
+ "Specify handling for BUM packets\n"
+ "Do not flood any BUM packets\n"
+ "Flood BUM packets using head-end replication\n")
+{
+ struct bgp *bgp = VTY_GET_CONTEXT(bgp);
+ enum vxlan_flood_control flood_ctrl;
+
+ if (!bgp)
+ return CMD_WARNING;
+
+ if (disable && !no)
+ flood_ctrl = VXLAN_FLOOD_DISABLED;
+ else if (her || no)
+ flood_ctrl = VXLAN_FLOOD_HEAD_END_REPL;
+ else
+ return CMD_WARNING;
+
+ if (bgp->vxlan_flood_ctrl == flood_ctrl)
+ return CMD_SUCCESS;
+
+ bgp->vxlan_flood_ctrl = flood_ctrl;
+ bgp_evpn_flood_control_change(bgp);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (bgp_evpn_advertise_default_gw_vni,
bgp_evpn_advertise_default_gw_vni_cmd,
"advertise-default-gw",
@@ -3210,6 +3244,12 @@ DEFUN(show_bgp_l2vpn_evpn_vni,
json_object_string_add(json, "advertiseAllVnis",
is_evpn_enabled() ? "Enabled"
: "Disabled");
+ json_object_string_add(
+ json, "flooding",
+ bgp_def->vxlan_flood_ctrl
+ == VXLAN_FLOOD_HEAD_END_REPL
+ ? "Head-end replication"
+ : "Disabled");
json_object_int_add(json, "numVnis", num_vnis);
json_object_int_add(json, "numL2Vnis", num_l2vnis);
json_object_int_add(json, "numL3Vnis", num_l3vnis);
@@ -3219,6 +3259,11 @@ DEFUN(show_bgp_l2vpn_evpn_vni,
: "Disabled");
vty_out(vty, "Advertise All VNI flag: %s\n",
is_evpn_enabled() ? "Enabled" : "Disabled");
+ vty_out(vty, "BUM flooding: %s\n",
+ bgp_def->vxlan_flood_ctrl
+ == VXLAN_FLOOD_HEAD_END_REPL
+ ? "Head-end replication"
+ : "Disabled");
vty_out(vty, "Number of L2 VNIs: %u\n", num_l2vnis);
vty_out(vty, "Number of L3 VNIs: %u\n", num_l3vnis);
}
@@ -4874,6 +4919,9 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi,
if (bgp->advertise_gw_macip)
vty_out(vty, " advertise-default-gw\n");
+ if (bgp->vxlan_flood_ctrl == VXLAN_FLOOD_DISABLED)
+ vty_out(vty, " flooding disable\n");
+
if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN],
BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) {
if (bgp->adv_cmd_rmap[AFI_IP][SAFI_UNICAST].name)
@@ -4965,6 +5013,7 @@ void bgp_ethernetvpn_init(void)
install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_type5_cmd);
install_element(BGP_EVPN_NODE, &bgp_evpn_default_originate_cmd);
install_element(BGP_EVPN_NODE, &no_bgp_evpn_default_originate_cmd);
+ install_element(BGP_EVPN_NODE, &bgp_evpn_flood_control_cmd);
/* test commands */
install_element(BGP_EVPN_NODE, &test_adv_evpn_type4_route_cmd);
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c
index c7977a9af4..1ccb8fb245 100644
--- a/bgpd/bgp_filter.c
+++ b/bgpd/bgp_filter.c
@@ -77,7 +77,7 @@ struct as_list {
struct as_filter *tail;
};
-/* ip as-path access-list 10 permit AS1. */
+/* as-path access-list 10 permit AS1. */
static struct as_list_master as_list_master = {{NULL, NULL},
{NULL, NULL},
@@ -401,9 +401,9 @@ static int config_bgp_aspath_validate(const char *regstr)
return 0;
}
-DEFUN(ip_as_path, ip_as_path_cmd,
- "ip as-path access-list WORD <deny|permit> LINE...",
- IP_STR
+DEFUN(as_path, bgp_as_path_cmd,
+ "bgp as-path access-list WORD <deny|permit> LINE...",
+ BGP_STR
"BGP autonomous system path filter\n"
"Specify an access list name\n"
"Regular expression access list name\n"
@@ -418,6 +418,13 @@ DEFUN(ip_as_path, ip_as_path_cmd,
regex_t *regex;
char *regstr;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command\n");
+ vty_out(vty, "'bgp as-path access-list WORD <deny|permit> LINE'\n");
+ zlog_warn("Deprecated option: 'ip as-path access-list WORD <deny|permit> LINE' being used");
+ }
+
/* Retrieve access list name */
argv_find(argv, argc, "WORD", &idx);
char *alname = argv[idx]->arg;
@@ -459,9 +466,23 @@ DEFUN(ip_as_path, ip_as_path_cmd,
return CMD_SUCCESS;
}
-DEFUN(no_ip_as_path, no_ip_as_path_cmd,
- "no ip as-path access-list WORD <deny|permit> LINE...",
- NO_STR IP_STR
+#if CONFDATE > 20191005
+CPP_NOTICE("bgpd: remove deprecated 'ip as-path access-list WORD <deny|permit> LINE' command")
+#endif
+ALIAS(as_path, ip_as_path_cmd,
+ "ip as-path access-list WORD <deny|permit> LINE...",
+ IP_STR
+ "BGP autonomous system path filter\n"
+ "Specify an access list name\n"
+ "Regular expression access list name\n"
+ "Specify packets to reject\n"
+ "Specify packets to forward\n"
+ "A regular-expression (1234567890_(^|[,{}() ]|$)) to match the BGP AS paths\n")
+
+DEFUN(no_as_path, no_bgp_as_path_cmd,
+ "no bgp as-path access-list WORD <deny|permit> LINE...",
+ NO_STR
+ BGP_STR
"BGP autonomous system path filter\n"
"Specify an access list name\n"
"Regular expression access list name\n"
@@ -476,13 +497,19 @@ DEFUN(no_ip_as_path, no_ip_as_path_cmd,
char *regstr;
regex_t *regex;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command\n");
+ vty_out(vty, "'no bgp as-path access-list WORD <deny|permit> LINE'\n");
+ zlog_warn("Deprecated option: 'no ip as-path access-list WORD <deny|permit> LINE' being used");
+ }
char *aslistname =
argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
/* Lookup AS list from AS path list. */
aslist = as_list_lookup(aslistname);
if (aslist == NULL) {
- vty_out(vty, "ip as-path access-list %s doesn't exist\n",
+ vty_out(vty, "bgp as-path access-list %s doesn't exist\n",
aslistname);
return CMD_WARNING_CONFIG_FAILED;
}
@@ -530,21 +557,39 @@ DEFUN(no_ip_as_path, no_ip_as_path_cmd,
return CMD_SUCCESS;
}
-DEFUN (no_ip_as_path_all,
- no_ip_as_path_all_cmd,
- "no ip as-path access-list WORD",
+ALIAS(no_as_path, no_ip_as_path_cmd,
+ "no ip as-path access-list WORD <deny|permit> LINE...",
+ NO_STR IP_STR
+ "BGP autonomous system path filter\n"
+ "Specify an access list name\n"
+ "Regular expression access list name\n"
+ "Specify packets to reject\n"
+ "Specify packets to forward\n"
+ "A regular-expression (1234567890_(^|[,{}() ]|$)) to match the BGP AS paths\n")
+
+DEFUN (no_as_path_all,
+ no_bgp_as_path_all_cmd,
+ "no bgp as-path access-list WORD",
NO_STR
- IP_STR
+ BGP_STR
"BGP autonomous system path filter\n"
"Specify an access list name\n"
"Regular expression access list name\n")
{
int idx_word = 4;
struct as_list *aslist;
+ int idx = 0;
+
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command\n");
+ vty_out(vty, "'no bgp as-path access-list WORD'\n");
+ zlog_warn("Deprecated option: `no ip as-path access-list WORD` being used");
+ }
aslist = as_list_lookup(argv[idx_word]->arg);
if (aslist == NULL) {
- vty_out(vty, "ip as-path access-list %s doesn't exist\n",
+ vty_out(vty, "bgp as-path access-list %s doesn't exist\n",
argv[idx_word]->arg);
return CMD_WARNING_CONFIG_FAILED;
}
@@ -558,6 +603,15 @@ DEFUN (no_ip_as_path_all,
return CMD_SUCCESS;
}
+ALIAS (no_as_path_all,
+ no_ip_as_path_all_cmd,
+ "no ip as-path access-list WORD",
+ NO_STR
+ IP_STR
+ "BGP autonomous system path filter\n"
+ "Specify an access list name\n"
+ "Regular expression access list name\n")
+
static void as_list_show(struct vty *vty, struct as_list *aslist)
{
struct as_filter *asfilter;
@@ -598,17 +652,24 @@ static void as_list_show_all(struct vty *vty)
}
}
-DEFUN (show_ip_as_path_access_list,
- show_ip_as_path_access_list_cmd,
- "show ip as-path-access-list WORD",
+DEFUN (show_as_path_access_list,
+ show_bgp_as_path_access_list_cmd,
+ "show bgp as-path-access-list WORD",
SHOW_STR
- IP_STR
+ BGP_STR
"List AS path access lists\n"
"AS path access list name\n")
{
int idx_word = 3;
struct as_list *aslist;
+ int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command\n");
+ vty_out(vty, "'show bgp as-path-access-list WORD'\n");
+ zlog_warn("Deprecated option: 'show ip as-path-access-list WORD' being used");
+ }
aslist = as_list_lookup(argv[idx_word]->arg);
if (aslist)
as_list_show(vty, aslist);
@@ -616,17 +677,40 @@ DEFUN (show_ip_as_path_access_list,
return CMD_SUCCESS;
}
-DEFUN (show_ip_as_path_access_list_all,
- show_ip_as_path_access_list_all_cmd,
- "show ip as-path-access-list",
+ALIAS (show_as_path_access_list,
+ show_ip_as_path_access_list_cmd,
+ "show ip as-path-access-list WORD",
SHOW_STR
IP_STR
+ "List AS path access lists\n"
+ "AS path access list name\n")
+
+DEFUN (show_as_path_access_list_all,
+ show_bgp_as_path_access_list_all_cmd,
+ "show bgp as-path-access-list",
+ SHOW_STR
+ BGP_STR
"List AS path access lists\n")
{
+ int idx = 0;
+
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command\n");
+ vty_out(vty, "'show bgp as-path-access-list'\n");
+ zlog_warn("Deprecated option: 'show ip as-path-access-list' being used");
+ }
as_list_show_all(vty);
return CMD_SUCCESS;
}
+ALIAS (show_as_path_access_list_all,
+ show_ip_as_path_access_list_all_cmd,
+ "show ip as-path-access-list",
+ SHOW_STR
+ IP_STR
+ "List AS path access lists\n")
+
static int config_write_as_list(struct vty *vty)
{
struct as_list *aslist;
@@ -636,7 +720,7 @@ static int config_write_as_list(struct vty *vty)
for (aslist = as_list_master.num.head; aslist; aslist = aslist->next)
for (asfilter = aslist->head; asfilter;
asfilter = asfilter->next) {
- vty_out(vty, "ip as-path access-list %s %s %s\n",
+ vty_out(vty, "bgp as-path access-list %s %s %s\n",
aslist->name, filter_type_str(asfilter->type),
asfilter->reg_str);
write++;
@@ -645,7 +729,7 @@ static int config_write_as_list(struct vty *vty)
for (aslist = as_list_master.str.head; aslist; aslist = aslist->next)
for (asfilter = aslist->head; asfilter;
asfilter = asfilter->next) {
- vty_out(vty, "ip as-path access-list %s %s %s\n",
+ vty_out(vty, "bgp as-path access-list %s %s %s\n",
aslist->name, filter_type_str(asfilter->type),
asfilter->reg_str);
write++;
@@ -660,11 +744,16 @@ void bgp_filter_init(void)
{
install_node(&as_list_node, config_write_as_list);
+ install_element(CONFIG_NODE, &bgp_as_path_cmd);
install_element(CONFIG_NODE, &ip_as_path_cmd);
+ install_element(CONFIG_NODE, &no_bgp_as_path_cmd);
install_element(CONFIG_NODE, &no_ip_as_path_cmd);
+ install_element(CONFIG_NODE, &no_bgp_as_path_all_cmd);
install_element(CONFIG_NODE, &no_ip_as_path_all_cmd);
+ install_element(VIEW_NODE, &show_bgp_as_path_access_list_cmd);
install_element(VIEW_NODE, &show_ip_as_path_access_list_cmd);
+ install_element(VIEW_NODE, &show_bgp_as_path_access_list_all_cmd);
install_element(VIEW_NODE, &show_ip_as_path_access_list_all_cmd);
}
diff --git a/bgpd/bgp_flowspec.h b/bgpd/bgp_flowspec.h
index f07b696b8d..bc201b739f 100644
--- a/bgpd/bgp_flowspec.h
+++ b/bgpd/bgp_flowspec.h
@@ -44,8 +44,8 @@ extern void bgp_fs_nlri_get_string(unsigned char *nlri_content, size_t len,
json_object *json_path);
extern void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
- struct bgp_info *binfo,
- int display, json_object *json_paths);
+ struct bgp_path_info *path, int display,
+ json_object *json_paths);
extern int bgp_fs_config_write_pbr(struct vty *vty, struct bgp *bgp,
afi_t afi, safi_t safi);
diff --git a/bgpd/bgp_flowspec_vty.c b/bgpd/bgp_flowspec_vty.c
index ceeecc7e19..4fb055bcc3 100644
--- a/bgpd/bgp_flowspec_vty.c
+++ b/bgpd/bgp_flowspec_vty.c
@@ -253,8 +253,8 @@ void bgp_fs_nlri_get_string(unsigned char *nlri_content, size_t len,
}
void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
- struct bgp_info *binfo,
- int display, json_object *json_paths)
+ struct bgp_path_info *path, int display,
+ json_object *json_paths)
{
struct attr *attr;
char return_string[BGP_FLOWSPEC_STRING_DISPLAY_MAX];
@@ -274,9 +274,9 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
else
json_nlri_path = json_paths;
}
- if (display == NLRI_STRING_FORMAT_LARGE && binfo)
+ if (display == NLRI_STRING_FORMAT_LARGE && path)
vty_out(vty, "BGP flowspec entry: (flags 0x%x)\n",
- binfo->flags);
+ path->flags);
bgp_fs_nlri_get_string((unsigned char *)
p->u.prefix_flowspec.ptr,
p->u.prefix_flowspec.prefixlen,
@@ -292,11 +292,11 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
else if (json_paths && display == NLRI_STRING_FORMAT_JSON)
json_object_array_add(json_paths, json_nlri_path);
}
- if (!binfo)
+ if (!path)
return;
- if (binfo->attr && binfo->attr->ecommunity) {
+ if (path->attr && path->attr->ecommunity) {
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
s = ecommunity_ecom2str(attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
if (!s)
@@ -318,7 +318,7 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
vty_out(vty, "\tNH %-16s\n", inet_ntoa(attr->nexthop));
XFREE(MTYPE_ECOMMUNITY_STR, s);
}
- peer_uptime(binfo->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL);
+ peer_uptime(path->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL);
if (display == NLRI_STRING_FORMAT_LARGE) {
vty_out(vty, "\treceived for %8s\n", timebuf);
} else if (json_paths) {
@@ -329,7 +329,8 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
json_object_array_add(json_paths, json_time_path);
}
if (display == NLRI_STRING_FORMAT_LARGE) {
- struct bgp_info_extra *extra = bgp_info_extra_get(binfo);
+ struct bgp_path_info_extra *extra =
+ bgp_path_info_extra_get(path);
if (extra->bgp_fs_pbr) {
struct listnode *node;
@@ -368,7 +369,7 @@ int bgp_show_table_flowspec(struct vty *vty, struct bgp *bgp, afi_t afi,
void *output_arg, bool use_json, int is_last,
unsigned long *output_cum, unsigned long *total_cum)
{
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_node *rn;
unsigned long total_count = 0;
json_object *json_paths = NULL;
@@ -384,12 +385,10 @@ int bgp_show_table_flowspec(struct vty *vty, struct bgp *bgp, afi_t afi,
json_paths = json_object_new_array();
display = NLRI_STRING_FORMAT_JSON;
}
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
total_count++;
- route_vty_out_flowspec(vty, &rn->p,
- ri, display,
+ route_vty_out_flowspec(vty, &rn->p, pi, display,
json_paths);
-
}
if (use_json) {
vty_out(vty, "%s\n",
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index ba059d66e6..dcaaea6868 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -94,18 +94,18 @@ int bgp_parse_fec_update(void)
return 1;
}
-mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_info *ri,
+mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *to, afi_t afi, safi_t safi)
{
struct peer *from;
mpls_label_t remote_label;
int reflect;
- if (!rn || !ri || !to)
+ if (!rn || !pi || !to)
return MPLS_INVALID_LABEL;
- remote_label = ri->extra ? ri->extra->label[0] : MPLS_INVALID_LABEL;
- from = ri->peer;
+ remote_label = pi->extra ? pi->extra->label[0] : MPLS_INVALID_LABEL;
+ from = pi->peer;
reflect =
((from->sort == BGP_PEER_IBGP) && (to->sort == BGP_PEER_IBGP));
@@ -120,7 +120,8 @@ mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_info *ri,
return rn->local_label;
}
-void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_info *ri, int reg)
+void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_path_info *pi,
+ int reg)
{
struct stream *s;
struct prefix *p;
@@ -142,11 +143,11 @@ void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_info *ri, int reg)
stream_putw(s, PREFIX_FAMILY(p));
stream_put_prefix(s, p);
if (reg) {
- assert(ri);
- if (ri->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) {
- if (ri->attr->label_index != BGP_INVALID_LABEL_INDEX) {
+ assert(pi);
+ if (pi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) {
+ if (pi->attr->label_index != BGP_INVALID_LABEL_INDEX) {
flags |= ZEBRA_FEC_REGISTER_LABEL_INDEX;
- stream_putl(s, ri->attr->label_index);
+ stream_putl(s, pi->attr->label_index);
}
}
SET_FLAG(rn->flags, BGP_NODE_REGISTERED_FOR_LABEL);
diff --git a/bgpd/bgp_label.h b/bgpd/bgp_label.h
index 2b2525dd0e..b0fc07e547 100644
--- a/bgpd/bgp_label.h
+++ b/bgpd/bgp_label.h
@@ -27,13 +27,13 @@
#define BGP_PREVENT_VRF_2_VRF_LEAK 0xFFFFFFFE
struct bgp_node;
-struct bgp_info;
+struct bgp_path_info;
struct peer;
-extern void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_info *ri,
- int reg);
+extern void bgp_reg_dereg_for_label(struct bgp_node *rn,
+ struct bgp_path_info *pi, int reg);
extern int bgp_parse_fec_update(void);
-extern mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_info *ri,
+extern mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *to, afi_t afi, safi_t safi);
extern int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
@@ -85,9 +85,9 @@ static inline void bgp_unset_valid_label(mpls_label_t *label)
}
static inline void bgp_register_for_label(struct bgp_node *rn,
- struct bgp_info *ri)
+ struct bgp_path_info *pi)
{
- bgp_reg_dereg_for_label(rn, ri, 1);
+ bgp_reg_dereg_for_label(rn, pi, 1);
}
static inline void bgp_unregister_for_label(struct bgp_node *rn)
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index 333d09806e..b868dba97f 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -113,45 +113,47 @@ static int bgp_interface_same(struct interface *ifp1, struct interface *ifp2)
/*
- * bgp_info_nexthop_cmp
+ * bgp_path_info_nexthop_cmp
*
* Compare the nexthops of two paths. Return value is less than, equal to,
- * or greater than zero if bi1 is respectively less than, equal to,
- * or greater than bi2.
+ * or greater than zero if bpi1 is respectively less than, equal to,
+ * or greater than bpi2.
*/
-int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2)
+int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1,
+ struct bgp_path_info *bpi2)
{
int compare;
struct in6_addr addr1, addr2;
- compare = IPV4_ADDR_CMP(&bi1->attr->nexthop, &bi2->attr->nexthop);
+ compare = IPV4_ADDR_CMP(&bpi1->attr->nexthop, &bpi2->attr->nexthop);
if (!compare) {
- if (bi1->attr->mp_nexthop_len == bi2->attr->mp_nexthop_len) {
- switch (bi1->attr->mp_nexthop_len) {
+ if (bpi1->attr->mp_nexthop_len == bpi2->attr->mp_nexthop_len) {
+ switch (bpi1->attr->mp_nexthop_len) {
case BGP_ATTR_NHLEN_IPV4:
case BGP_ATTR_NHLEN_VPNV4:
compare = IPV4_ADDR_CMP(
- &bi1->attr->mp_nexthop_global_in,
- &bi2->attr->mp_nexthop_global_in);
+ &bpi1->attr->mp_nexthop_global_in,
+ &bpi2->attr->mp_nexthop_global_in);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL:
compare = IPV6_ADDR_CMP(
- &bi1->attr->mp_nexthop_global,
- &bi2->attr->mp_nexthop_global);
+ &bpi1->attr->mp_nexthop_global,
+ &bpi2->attr->mp_nexthop_global);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
- addr1 = (bi1->attr->mp_nexthop_prefer_global)
- ? bi1->attr->mp_nexthop_global
- : bi1->attr->mp_nexthop_local;
- addr2 = (bi2->attr->mp_nexthop_prefer_global)
- ? bi2->attr->mp_nexthop_global
- : bi2->attr->mp_nexthop_local;
-
- if (!bi1->attr->mp_nexthop_prefer_global
- && !bi2->attr->mp_nexthop_prefer_global)
+ addr1 = (bpi1->attr->mp_nexthop_prefer_global)
+ ? bpi1->attr->mp_nexthop_global
+ : bpi1->attr->mp_nexthop_local;
+ addr2 = (bpi2->attr->mp_nexthop_prefer_global)
+ ? bpi2->attr->mp_nexthop_global
+ : bpi2->attr->mp_nexthop_local;
+
+ if (!bpi1->attr->mp_nexthop_prefer_global
+ && !bpi2->attr->mp_nexthop_prefer_global)
compare = !bgp_interface_same(
- bi1->peer->ifp, bi2->peer->ifp);
+ bpi1->peer->ifp,
+ bpi2->peer->ifp);
if (!compare)
compare = IPV6_ADDR_CMP(&addr1, &addr2);
@@ -163,14 +165,15 @@ int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2)
* link-local
* nexthops but another IPv6 peer only sends you global
*/
- else if (bi1->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL
- || bi1->attr->mp_nexthop_len
+ else if (bpi1->attr->mp_nexthop_len
+ == BGP_ATTR_NHLEN_IPV6_GLOBAL
+ || bpi1->attr->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
- compare = IPV6_ADDR_CMP(&bi1->attr->mp_nexthop_global,
- &bi2->attr->mp_nexthop_global);
+ compare = IPV6_ADDR_CMP(&bpi1->attr->mp_nexthop_global,
+ &bpi2->attr->mp_nexthop_global);
if (!compare) {
- if (bi1->attr->mp_nexthop_len
- < bi2->attr->mp_nexthop_len)
+ if (bpi1->attr->mp_nexthop_len
+ < bpi2->attr->mp_nexthop_len)
compare = -1;
else
compare = 1;
@@ -182,7 +185,7 @@ int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2)
}
/*
- * bgp_info_mpath_cmp
+ * bgp_path_info_mpath_cmp
*
* This function determines our multipath list ordering. By ordering
* the list we can deterministically select which paths are included
@@ -193,26 +196,26 @@ int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2)
* The order of paths is determined first by received nexthop, and then
* by peer address if the nexthops are the same.
*/
-static int bgp_info_mpath_cmp(void *val1, void *val2)
+static int bgp_path_info_mpath_cmp(void *val1, void *val2)
{
- struct bgp_info *bi1, *bi2;
+ struct bgp_path_info *bpi1, *bpi2;
int compare;
- bi1 = val1;
- bi2 = val2;
+ bpi1 = val1;
+ bpi2 = val2;
- compare = bgp_info_nexthop_cmp(bi1, bi2);
+ compare = bgp_path_info_nexthop_cmp(bpi1, bpi2);
if (!compare) {
- if (!bi1->peer->su_remote && !bi2->peer->su_remote)
+ if (!bpi1->peer->su_remote && !bpi2->peer->su_remote)
compare = 0;
- else if (!bi1->peer->su_remote)
+ else if (!bpi1->peer->su_remote)
compare = 1;
- else if (!bi2->peer->su_remote)
+ else if (!bpi2->peer->su_remote)
compare = -1;
else
- compare = sockunion_cmp(bi1->peer->su_remote,
- bi2->peer->su_remote);
+ compare = sockunion_cmp(bpi1->peer->su_remote,
+ bpi2->peer->su_remote);
}
return compare;
@@ -228,7 +231,7 @@ void bgp_mp_list_init(struct list *mp_list)
{
assert(mp_list);
memset(mp_list, 0, sizeof(struct list));
- mp_list->cmp = bgp_info_mpath_cmp;
+ mp_list->cmp = bgp_path_info_mpath_cmp;
}
/*
@@ -247,31 +250,31 @@ void bgp_mp_list_clear(struct list *mp_list)
*
* Adds a multipath entry to the mp_list
*/
-void bgp_mp_list_add(struct list *mp_list, struct bgp_info *mpinfo)
+void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo)
{
assert(mp_list && mpinfo);
listnode_add_sort(mp_list, mpinfo);
}
/*
- * bgp_info_mpath_new
+ * bgp_path_info_mpath_new
*
- * Allocate and zero memory for a new bgp_info_mpath element
+ * Allocate and zero memory for a new bgp_path_info_mpath element
*/
-static struct bgp_info_mpath *bgp_info_mpath_new(void)
+static struct bgp_path_info_mpath *bgp_path_info_mpath_new(void)
{
- struct bgp_info_mpath *new_mpath;
- new_mpath =
- XCALLOC(MTYPE_BGP_MPATH_INFO, sizeof(struct bgp_info_mpath));
+ struct bgp_path_info_mpath *new_mpath;
+ new_mpath = XCALLOC(MTYPE_BGP_MPATH_INFO,
+ sizeof(struct bgp_path_info_mpath));
return new_mpath;
}
/*
- * bgp_info_mpath_free
+ * bgp_path_info_mpath_free
*
- * Release resources for a bgp_info_mpath element and zero out pointer
+ * Release resources for a bgp_path_info_mpath element and zero out pointer
*/
-void bgp_info_mpath_free(struct bgp_info_mpath **mpath)
+void bgp_path_info_mpath_free(struct bgp_path_info_mpath **mpath)
{
if (mpath && *mpath) {
if ((*mpath)->mp_attr)
@@ -282,37 +285,38 @@ void bgp_info_mpath_free(struct bgp_info_mpath **mpath)
}
/*
- * bgp_info_mpath_get
+ * bgp_path_info_mpath_get
*
- * Fetch the mpath element for the given bgp_info. Used for
+ * Fetch the mpath element for the given bgp_path_info. Used for
* doing lazy allocation.
*/
-static struct bgp_info_mpath *bgp_info_mpath_get(struct bgp_info *binfo)
+static struct bgp_path_info_mpath *
+bgp_path_info_mpath_get(struct bgp_path_info *path)
{
- struct bgp_info_mpath *mpath;
- if (!binfo->mpath) {
- mpath = bgp_info_mpath_new();
+ struct bgp_path_info_mpath *mpath;
+ if (!path->mpath) {
+ mpath = bgp_path_info_mpath_new();
if (!mpath)
return NULL;
- binfo->mpath = mpath;
- mpath->mp_info = binfo;
+ path->mpath = mpath;
+ mpath->mp_info = path;
}
- return binfo->mpath;
+ return path->mpath;
}
/*
- * bgp_info_mpath_enqueue
+ * bgp_path_info_mpath_enqueue
*
* Enqueue a path onto the multipath list given the previous multipath
* list entry
*/
-static void bgp_info_mpath_enqueue(struct bgp_info *prev_info,
- struct bgp_info *binfo)
+static void bgp_path_info_mpath_enqueue(struct bgp_path_info *prev_info,
+ struct bgp_path_info *path)
{
- struct bgp_info_mpath *prev, *mpath;
+ struct bgp_path_info_mpath *prev, *mpath;
- prev = bgp_info_mpath_get(prev_info);
- mpath = bgp_info_mpath_get(binfo);
+ prev = bgp_path_info_mpath_get(prev_info);
+ mpath = bgp_path_info_mpath_get(path);
if (!prev || !mpath)
return;
@@ -322,17 +326,17 @@ static void bgp_info_mpath_enqueue(struct bgp_info *prev_info,
prev->mp_next->mp_prev = mpath;
prev->mp_next = mpath;
- SET_FLAG(binfo->flags, BGP_INFO_MULTIPATH);
+ SET_FLAG(path->flags, BGP_PATH_MULTIPATH);
}
/*
- * bgp_info_mpath_dequeue
+ * bgp_path_info_mpath_dequeue
*
* Remove a path from the multipath list
*/
-void bgp_info_mpath_dequeue(struct bgp_info *binfo)
+void bgp_path_info_mpath_dequeue(struct bgp_path_info *path)
{
- struct bgp_info_mpath *mpath = binfo->mpath;
+ struct bgp_path_info_mpath *mpath = path->mpath;
if (!mpath)
return;
if (mpath->mp_prev)
@@ -340,101 +344,105 @@ void bgp_info_mpath_dequeue(struct bgp_info *binfo)
if (mpath->mp_next)
mpath->mp_next->mp_prev = mpath->mp_prev;
mpath->mp_next = mpath->mp_prev = NULL;
- UNSET_FLAG(binfo->flags, BGP_INFO_MULTIPATH);
+ UNSET_FLAG(path->flags, BGP_PATH_MULTIPATH);
}
/*
- * bgp_info_mpath_next
+ * bgp_path_info_mpath_next
*
- * Given a bgp_info, return the next multipath entry
+ * Given a bgp_path_info, return the next multipath entry
*/
-struct bgp_info *bgp_info_mpath_next(struct bgp_info *binfo)
+struct bgp_path_info *bgp_path_info_mpath_next(struct bgp_path_info *path)
{
- if (!binfo->mpath || !binfo->mpath->mp_next)
+ if (!path->mpath || !path->mpath->mp_next)
return NULL;
- return binfo->mpath->mp_next->mp_info;
+ return path->mpath->mp_next->mp_info;
}
/*
- * bgp_info_mpath_first
+ * bgp_path_info_mpath_first
*
- * Given bestpath bgp_info, return the first multipath entry.
+ * Given bestpath bgp_path_info, return the first multipath entry.
*/
-struct bgp_info *bgp_info_mpath_first(struct bgp_info *binfo)
+struct bgp_path_info *bgp_path_info_mpath_first(struct bgp_path_info *path)
{
- return bgp_info_mpath_next(binfo);
+ return bgp_path_info_mpath_next(path);
}
/*
- * bgp_info_mpath_count
+ * bgp_path_info_mpath_count
*
- * Given the bestpath bgp_info, return the number of multipath entries
+ * Given the bestpath bgp_path_info, return the number of multipath entries
*/
-uint32_t bgp_info_mpath_count(struct bgp_info *binfo)
+uint32_t bgp_path_info_mpath_count(struct bgp_path_info *path)
{
- if (!binfo->mpath)
+ if (!path->mpath)
return 0;
- return binfo->mpath->mp_count;
+ return path->mpath->mp_count;
}
/*
- * bgp_info_mpath_count_set
+ * bgp_path_info_mpath_count_set
*
* Sets the count of multipaths into bestpath's mpath element
*/
-static void bgp_info_mpath_count_set(struct bgp_info *binfo, uint32_t count)
+static void bgp_path_info_mpath_count_set(struct bgp_path_info *path,
+ uint32_t count)
{
- struct bgp_info_mpath *mpath;
- if (!count && !binfo->mpath)
+ struct bgp_path_info_mpath *mpath;
+ if (!count && !path->mpath)
return;
- mpath = bgp_info_mpath_get(binfo);
+ mpath = bgp_path_info_mpath_get(path);
if (!mpath)
return;
mpath->mp_count = count;
}
/*
- * bgp_info_mpath_attr
+ * bgp_path_info_mpath_attr
*
- * Given bestpath bgp_info, return aggregated attribute set used
+ * Given bestpath bgp_path_info, return aggregated attribute set used
* for advertising the multipath route
*/
-struct attr *bgp_info_mpath_attr(struct bgp_info *binfo)
+struct attr *bgp_path_info_mpath_attr(struct bgp_path_info *path)
{
- if (!binfo->mpath)
+ if (!path->mpath)
return NULL;
- return binfo->mpath->mp_attr;
+ return path->mpath->mp_attr;
}
/*
- * bgp_info_mpath_attr_set
+ * bgp_path_info_mpath_attr_set
*
* Sets the aggregated attribute into bestpath's mpath element
*/
-static void bgp_info_mpath_attr_set(struct bgp_info *binfo, struct attr *attr)
+static void bgp_path_info_mpath_attr_set(struct bgp_path_info *path,
+ struct attr *attr)
{
- struct bgp_info_mpath *mpath;
- if (!attr && !binfo->mpath)
+ struct bgp_path_info_mpath *mpath;
+ if (!attr && !path->mpath)
return;
- mpath = bgp_info_mpath_get(binfo);
+ mpath = bgp_path_info_mpath_get(path);
if (!mpath)
return;
mpath->mp_attr = attr;
}
/*
- * bgp_info_mpath_update
+ * bgp_path_info_mpath_update
*
* Compare and sync up the multipath list with the mp_list generated by
* bgp_best_selection
*/
-void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
- struct bgp_info *old_best, struct list *mp_list,
- struct bgp_maxpaths_cfg *mpath_cfg)
+void bgp_path_info_mpath_update(struct bgp_node *rn,
+ struct bgp_path_info *new_best,
+ struct bgp_path_info *old_best,
+ struct list *mp_list,
+ struct bgp_maxpaths_cfg *mpath_cfg)
{
uint16_t maxpaths, mpath_count, old_mpath_count;
struct listnode *mp_node, *mp_next_node;
- struct bgp_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath;
+ struct bgp_path_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath;
int mpath_changed, debug;
char pfx_buf[PREFIX2STR_BUFFER], nh_buf[2][INET6_ADDRSTRLEN];
char path_buf[PATH_ADDPATH_STR_BUFFER];
@@ -454,17 +462,17 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
if (new_best) {
mpath_count++;
if (new_best != old_best)
- bgp_info_mpath_dequeue(new_best);
+ bgp_path_info_mpath_dequeue(new_best);
maxpaths = (new_best->peer->sort == BGP_PEER_IBGP)
? mpath_cfg->maxpaths_ibgp
: mpath_cfg->maxpaths_ebgp;
}
if (old_best) {
- cur_mpath = bgp_info_mpath_first(old_best);
- old_mpath_count = bgp_info_mpath_count(old_best);
- bgp_info_mpath_count_set(old_best, 0);
- bgp_info_mpath_dequeue(old_best);
+ cur_mpath = bgp_path_info_mpath_first(old_best);
+ old_mpath_count = bgp_path_info_mpath_count(old_best);
+ bgp_path_info_mpath_count_set(old_best, 0);
+ bgp_path_info_mpath_dequeue(old_best);
}
if (debug)
@@ -485,7 +493,7 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
* to skip over it
*/
while (mp_node || cur_mpath) {
- struct bgp_info *tmp_info;
+ struct bgp_path_info *tmp_info;
/*
* We can bail out of this loop if all existing paths on the
@@ -496,7 +504,8 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
break;
mp_next_node = mp_node ? listnextnode(mp_node) : NULL;
- next_mpath = cur_mpath ? bgp_info_mpath_next(cur_mpath) : NULL;
+ next_mpath =
+ cur_mpath ? bgp_path_info_mpath_next(cur_mpath) : NULL;
tmp_info = mp_node ? listgetdata(mp_node) : NULL;
if (debug)
@@ -512,14 +521,16 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
*/
if (mp_node && (listgetdata(mp_node) == cur_mpath)) {
list_delete_node(mp_list, mp_node);
- bgp_info_mpath_dequeue(cur_mpath);
+ bgp_path_info_mpath_dequeue(cur_mpath);
if ((mpath_count < maxpaths)
- && bgp_info_nexthop_cmp(prev_mpath, cur_mpath)) {
- bgp_info_mpath_enqueue(prev_mpath, cur_mpath);
+ && bgp_path_info_nexthop_cmp(prev_mpath,
+ cur_mpath)) {
+ bgp_path_info_mpath_enqueue(prev_mpath,
+ cur_mpath);
prev_mpath = cur_mpath;
mpath_count++;
if (debug) {
- bgp_info_path_with_addpath_rx_str(
+ bgp_path_info_path_with_addpath_rx_str(
cur_mpath, path_buf);
zlog_debug(
"%s: %s is still multipath, cur count %d",
@@ -528,7 +539,7 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
} else {
mpath_changed = 1;
if (debug) {
- bgp_info_path_with_addpath_rx_str(
+ bgp_path_info_path_with_addpath_rx_str(
cur_mpath, path_buf);
zlog_debug(
"%s: remove mpath %s nexthop %s, cur count %d",
@@ -548,7 +559,8 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
if (cur_mpath
&& (!mp_node
- || (bgp_info_mpath_cmp(cur_mpath, listgetdata(mp_node))
+ || (bgp_path_info_mpath_cmp(cur_mpath,
+ listgetdata(mp_node))
< 0))) {
/*
* If here, we have an old multipath and either the
@@ -557,11 +569,11 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
* multipath, so we need to purge this path from the
* multipath list
*/
- bgp_info_mpath_dequeue(cur_mpath);
+ bgp_path_info_mpath_dequeue(cur_mpath);
mpath_changed = 1;
if (debug) {
- bgp_info_path_with_addpath_rx_str(cur_mpath,
- path_buf);
+ bgp_path_info_path_with_addpath_rx_str(
+ cur_mpath, path_buf);
zlog_debug(
"%s: remove mpath %s nexthop %s, cur count %d",
pfx_buf, path_buf,
@@ -595,17 +607,19 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
assert(new_mpath);
assert(prev_mpath);
if ((mpath_count < maxpaths) && (new_mpath != new_best)
- && bgp_info_nexthop_cmp(prev_mpath, new_mpath)) {
+ && bgp_path_info_nexthop_cmp(prev_mpath,
+ new_mpath)) {
if (new_mpath == next_mpath)
- bgp_info_mpath_next(new_mpath);
- bgp_info_mpath_dequeue(new_mpath);
+ bgp_path_info_mpath_next(new_mpath);
+ bgp_path_info_mpath_dequeue(new_mpath);
- bgp_info_mpath_enqueue(prev_mpath, new_mpath);
+ bgp_path_info_mpath_enqueue(prev_mpath,
+ new_mpath);
prev_mpath = new_mpath;
mpath_changed = 1;
mpath_count++;
if (debug) {
- bgp_info_path_with_addpath_rx_str(
+ bgp_path_info_path_with_addpath_rx_str(
new_mpath, path_buf);
zlog_debug(
"%s: add mpath %s nexthop %s, cur count %d",
@@ -629,39 +643,39 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best,
pfx_buf, mpath_count,
mpath_changed ? "YES" : "NO");
- bgp_info_mpath_count_set(new_best, mpath_count - 1);
+ bgp_path_info_mpath_count_set(new_best, mpath_count - 1);
if (mpath_changed
- || (bgp_info_mpath_count(new_best) != old_mpath_count))
- SET_FLAG(new_best->flags, BGP_INFO_MULTIPATH_CHG);
+ || (bgp_path_info_mpath_count(new_best) != old_mpath_count))
+ SET_FLAG(new_best->flags, BGP_PATH_MULTIPATH_CHG);
}
}
/*
* bgp_mp_dmed_deselect
*
- * Clean up multipath information for BGP_INFO_DMED_SELECTED path that
+ * Clean up multipath information for BGP_PATH_DMED_SELECTED path that
* is not selected as best path
*/
-void bgp_mp_dmed_deselect(struct bgp_info *dmed_best)
+void bgp_mp_dmed_deselect(struct bgp_path_info *dmed_best)
{
- struct bgp_info *mpinfo, *mpnext;
+ struct bgp_path_info *mpinfo, *mpnext;
if (!dmed_best)
return;
- for (mpinfo = bgp_info_mpath_first(dmed_best); mpinfo;
+ for (mpinfo = bgp_path_info_mpath_first(dmed_best); mpinfo;
mpinfo = mpnext) {
- mpnext = bgp_info_mpath_next(mpinfo);
- bgp_info_mpath_dequeue(mpinfo);
+ mpnext = bgp_path_info_mpath_next(mpinfo);
+ bgp_path_info_mpath_dequeue(mpinfo);
}
- bgp_info_mpath_count_set(dmed_best, 0);
- UNSET_FLAG(dmed_best->flags, BGP_INFO_MULTIPATH_CHG);
- assert(bgp_info_mpath_first(dmed_best) == 0);
+ bgp_path_info_mpath_count_set(dmed_best, 0);
+ UNSET_FLAG(dmed_best->flags, BGP_PATH_MULTIPATH_CHG);
+ assert(bgp_path_info_mpath_first(dmed_best) == 0);
}
/*
- * bgp_info_mpath_aggregate_update
+ * bgp_path_info_mpath_aggregate_update
*
* Set the multipath aggregate attribute. We need to see if the
* aggregate has changed and then set the ATTR_CHANGED flag on the
@@ -672,10 +686,10 @@ void bgp_mp_dmed_deselect(struct bgp_info *dmed_best)
* is no change in multipath selection and no attribute change in
* any multipath.
*/
-void bgp_info_mpath_aggregate_update(struct bgp_info *new_best,
- struct bgp_info *old_best)
+void bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,
+ struct bgp_path_info *old_best)
{
- struct bgp_info *mpinfo;
+ struct bgp_path_info *mpinfo;
struct aspath *aspath;
struct aspath *asmerge;
struct attr *new_attr, *old_attr;
@@ -686,19 +700,19 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best,
struct attr attr = {0};
if (old_best && (old_best != new_best)
- && (old_attr = bgp_info_mpath_attr(old_best))) {
+ && (old_attr = bgp_path_info_mpath_attr(old_best))) {
bgp_attr_unintern(&old_attr);
- bgp_info_mpath_attr_set(old_best, NULL);
+ bgp_path_info_mpath_attr_set(old_best, NULL);
}
if (!new_best)
return;
- if (!bgp_info_mpath_count(new_best)) {
- if ((new_attr = bgp_info_mpath_attr(new_best))) {
+ if (!bgp_path_info_mpath_count(new_best)) {
+ if ((new_attr = bgp_path_info_mpath_attr(new_best))) {
bgp_attr_unintern(&new_attr);
- bgp_info_mpath_attr_set(new_best, NULL);
- SET_FLAG(new_best->flags, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_mpath_attr_set(new_best, NULL);
+ SET_FLAG(new_best->flags, BGP_PATH_ATTR_CHANGED);
}
return;
}
@@ -718,8 +732,8 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best,
lcomm = (attr.lcommunity) ? lcommunity_dup(attr.lcommunity)
: NULL;
- for (mpinfo = bgp_info_mpath_first(new_best); mpinfo;
- mpinfo = bgp_info_mpath_next(mpinfo)) {
+ for (mpinfo = bgp_path_info_mpath_first(new_best); mpinfo;
+ mpinfo = bgp_path_info_mpath_next(mpinfo)) {
asmerge =
aspath_aggregate(aspath, mpinfo->attr->aspath);
aspath_free(aspath);
@@ -789,11 +803,11 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best,
new_attr = bgp_attr_intern(&attr);
- if (new_attr != bgp_info_mpath_attr(new_best)) {
- if ((old_attr = bgp_info_mpath_attr(new_best)))
+ if (new_attr != bgp_path_info_mpath_attr(new_best)) {
+ if ((old_attr = bgp_path_info_mpath_attr(new_best)))
bgp_attr_unintern(&old_attr);
- bgp_info_mpath_attr_set(new_best, new_attr);
- SET_FLAG(new_best->flags, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_mpath_attr_set(new_best, new_attr);
+ SET_FLAG(new_best->flags, BGP_PATH_ATTR_CHANGED);
} else
bgp_attr_unintern(&new_attr);
}
diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h
index 1fa11d3d0e..d15f3c9035 100644
--- a/bgpd/bgp_mpath.h
+++ b/bgpd/bgp_mpath.h
@@ -22,18 +22,18 @@
#ifndef _QUAGGA_BGP_MPATH_H
#define _QUAGGA_BGP_MPATH_H
-/* Supplemental information linked to bgp_info for keeping track of
+/* Supplemental information linked to bgp_path_info for keeping track of
* multipath selections, lazily allocated to save memory
*/
-struct bgp_info_mpath {
+struct bgp_path_info_mpath {
/* Points to the first multipath (on bestpath) or the next multipath */
- struct bgp_info_mpath *mp_next;
+ struct bgp_path_info_mpath *mp_next;
/* Points to the previous multipath or NULL on bestpath */
- struct bgp_info_mpath *mp_prev;
+ struct bgp_path_info_mpath *mp_prev;
- /* Points to bgp_info associated with this multipath info */
- struct bgp_info *mp_info;
+ /* Points to bgp_path_info associated with this multipath info */
+ struct bgp_path_info *mp_info;
/* When attached to best path, the number of selected multipaths */
uint32_t mp_count;
@@ -50,27 +50,33 @@ extern int bgp_maximum_paths_unset(struct bgp *, afi_t, safi_t, int);
/* Functions used by bgp_best_selection to record current
* multipath selections
*/
-extern int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2);
+extern int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1,
+ struct bgp_path_info *bpi2);
extern void bgp_mp_list_init(struct list *);
extern void bgp_mp_list_clear(struct list *);
-extern void bgp_mp_list_add(struct list *, struct bgp_info *);
-extern void bgp_mp_dmed_deselect(struct bgp_info *);
-extern void bgp_info_mpath_update(struct bgp_node *, struct bgp_info *,
- struct bgp_info *, struct list *,
- struct bgp_maxpaths_cfg *);
-extern void bgp_info_mpath_aggregate_update(struct bgp_info *,
- struct bgp_info *);
+extern void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo);
+extern void bgp_mp_dmed_deselect(struct bgp_path_info *dmed_best);
+extern void bgp_path_info_mpath_update(struct bgp_node *rn,
+ struct bgp_path_info *new_best,
+ struct bgp_path_info *old_best,
+ struct list *mp_list,
+ struct bgp_maxpaths_cfg *mpath_cfg);
+extern void
+bgp_path_info_mpath_aggregate_update(struct bgp_path_info *new_best,
+ struct bgp_path_info *old_best);
-/* Unlink and free multipath information associated with a bgp_info */
-extern void bgp_info_mpath_dequeue(struct bgp_info *);
-extern void bgp_info_mpath_free(struct bgp_info_mpath **);
+/* Unlink and free multipath information associated with a bgp_path_info */
+extern void bgp_path_info_mpath_dequeue(struct bgp_path_info *path);
+extern void bgp_path_info_mpath_free(struct bgp_path_info_mpath **mpath);
/* Walk list of multipaths associated with a best path */
-extern struct bgp_info *bgp_info_mpath_first(struct bgp_info *);
-extern struct bgp_info *bgp_info_mpath_next(struct bgp_info *);
+extern struct bgp_path_info *
+bgp_path_info_mpath_first(struct bgp_path_info *path);
+extern struct bgp_path_info *
+bgp_path_info_mpath_next(struct bgp_path_info *path);
/* Accessors for multipath information */
-extern uint32_t bgp_info_mpath_count(struct bgp_info *);
-extern struct attr *bgp_info_mpath_attr(struct bgp_info *);
+extern uint32_t bgp_path_info_mpath_count(struct bgp_path_info *path);
+extern struct attr *bgp_path_info_mpath_attr(struct bgp_path_info *path);
#endif /* _QUAGGA_BGP_MPATH_H */
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 276945cbf6..385716970b 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -402,22 +402,23 @@ static int ecom_intersect(struct ecommunity *e1, struct ecommunity *e2)
return 0;
}
-static bool labels_same(struct bgp_info *bi, mpls_label_t *label, uint32_t n)
+static bool labels_same(struct bgp_path_info *bpi, mpls_label_t *label,
+ uint32_t n)
{
uint32_t i;
- if (!bi->extra) {
+ if (!bpi->extra) {
if (!n)
return true;
else
return false;
}
- if (n != bi->extra->num_labels)
+ if (n != bpi->extra->num_labels)
return false;
for (i = 0; i < n; ++i) {
- if (label[i] != bi->extra->label[i])
+ if (label[i] != bpi->extra->label[i])
return false;
}
return true;
@@ -426,22 +427,21 @@ static bool labels_same(struct bgp_info *bi, mpls_label_t *label, uint32_t n)
/*
* make encoded route labels match specified encoded label set
*/
-static void setlabels(
- struct bgp_info *bi,
- mpls_label_t *label, /* array of labels */
- uint32_t num_labels)
+static void setlabels(struct bgp_path_info *bpi,
+ mpls_label_t *label, /* array of labels */
+ uint32_t num_labels)
{
if (num_labels)
assert(label);
assert(num_labels <= BGP_MAX_LABELS);
if (!num_labels) {
- if (bi->extra)
- bi->extra->num_labels = 0;
+ if (bpi->extra)
+ bpi->extra->num_labels = 0;
return;
}
- struct bgp_info_extra *extra = bgp_info_extra_get(bi);
+ struct bgp_path_info_extra *extra = bgp_path_info_extra_get(bpi);
uint32_t i;
for (i = 0; i < num_labels; ++i) {
@@ -454,35 +454,27 @@ static void setlabels(
}
/*
- * returns pointer to new bgp_info upon success
+ * returns pointer to new bgp_path_info upon success
*/
-static struct bgp_info *
-leak_update(
- struct bgp *bgp, /* destination bgp instance */
- struct bgp_node *bn,
- struct attr *new_attr, /* already interned */
- afi_t afi,
- safi_t safi,
- struct bgp_info *source_bi,
- mpls_label_t *label,
- uint32_t num_labels,
- void *parent,
- struct bgp *bgp_orig,
- struct prefix *nexthop_orig,
- int nexthop_self_flag,
- int debug)
+static struct bgp_path_info *
+leak_update(struct bgp *bgp, /* destination bgp instance */
+ struct bgp_node *bn, struct attr *new_attr, /* already interned */
+ afi_t afi, safi_t safi, struct bgp_path_info *source_bpi,
+ mpls_label_t *label, uint32_t num_labels, void *parent,
+ struct bgp *bgp_orig, struct prefix *nexthop_orig,
+ int nexthop_self_flag, int debug)
{
struct prefix *p = &bn->p;
- struct bgp_info *bi;
- struct bgp_info *bi_ultimate;
- struct bgp_info *new;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info *bpi_ultimate;
+ struct bgp_path_info *new;
char buf_prefix[PREFIX_STRLEN];
if (debug) {
prefix2str(&bn->p, buf_prefix, sizeof(buf_prefix));
zlog_debug("%s: entry: leak-to=%s, p=%s, type=%d, sub_type=%d",
- __func__, bgp->name_pretty, buf_prefix,
- source_bi->type, source_bi->sub_type);
+ __func__, bgp->name_pretty, buf_prefix,
+ source_bpi->type, source_bpi->sub_type);
}
/*
@@ -494,31 +486,30 @@ leak_update(
* should have nexthop tracking, we must find the ultimate
* parent so we can check its sub_type.
*
- * As of now, source_bi may at most be a second-generation route
+ * As of now, source_bpi may at most be a second-generation route
* (only one hop back to ultimate parent for vrf-vpn-vrf scheme).
* Using a loop here supports more complex intra-bgp import-export
* schemes that could be implemented in the future.
*
*/
- for (bi_ultimate = source_bi;
- bi_ultimate->extra && bi_ultimate->extra->parent;
- bi_ultimate = bi_ultimate->extra->parent)
- ;
+ for (bpi_ultimate = source_bpi;
+ bpi_ultimate->extra && bpi_ultimate->extra->parent;
+ bpi_ultimate = bpi_ultimate->extra->parent)
+ ;
/*
* match parent
*/
- for (bi = bn->info; bi; bi = bi->next) {
- if (bi->extra && bi->extra->parent == parent)
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
+ if (bpi->extra && bpi->extra->parent == parent)
break;
}
- if (bi) {
- bool labelssame = labels_same(bi, label, num_labels);
+ if (bpi) {
+ bool labelssame = labels_same(bpi, label, num_labels);
- if (attrhash_cmp(bi->attr, new_attr)
- && labelssame
- && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ if (attrhash_cmp(bpi->attr, new_attr) && labelssame
+ && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
bgp_attr_unintern(&new_attr);
if (debug)
@@ -530,43 +521,42 @@ leak_update(
}
/* attr is changed */
- bgp_info_set_flag(bn, bi, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(bn, bpi, BGP_PATH_ATTR_CHANGED);
/* Rewrite BGP route information. */
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
- bgp_info_restore(bn, bi);
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(bn, bpi);
else
- bgp_aggregate_decrement(bgp, p, bi, afi, safi);
- bgp_attr_unintern(&bi->attr);
- bi->attr = new_attr;
- bi->uptime = bgp_clock();
+ bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
+ bgp_attr_unintern(&bpi->attr);
+ bpi->attr = new_attr;
+ bpi->uptime = bgp_clock();
/*
* rewrite labels
*/
if (!labelssame)
- setlabels(bi, label, num_labels);
+ setlabels(bpi, label, num_labels);
if (nexthop_self_flag)
- bgp_info_set_flag(bn, bi, BGP_INFO_ANNC_NH_SELF);
+ bgp_path_info_set_flag(bn, bpi, BGP_PATH_ANNC_NH_SELF);
struct bgp *bgp_nexthop = bgp;
int nh_valid;
- if (bi->extra && bi->extra->bgp_orig)
- bgp_nexthop = bi->extra->bgp_orig;
+ if (bpi->extra && bpi->extra->bgp_orig)
+ bgp_nexthop = bpi->extra->bgp_orig;
/* No nexthop tracking for redistributed routes */
- if (bi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
+ if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
nh_valid = 1;
else
/*
* TBD do we need to do anything about the
* 'connected' parameter?
*/
- nh_valid = bgp_find_or_add_nexthop(
- bgp, bgp_nexthop,
- afi, bi, NULL, 0);
+ nh_valid = bgp_find_or_add_nexthop(bgp, bgp_nexthop,
+ afi, bpi, NULL, 0);
if (debug)
zlog_debug("%s: nexthop is %svalid (in vrf %s)",
@@ -574,10 +564,10 @@ leak_update(
bgp_nexthop->name_pretty);
if (nh_valid)
- bgp_info_set_flag(bn, bi, BGP_INFO_VALID);
+ bgp_path_info_set_flag(bn, bpi, BGP_PATH_VALID);
/* Process change. */
- bgp_aggregate_increment(bgp, p, bi, afi, safi);
+ bgp_aggregate_increment(bgp, p, bpi, afi, safi);
bgp_process(bgp, bn, afi, safi);
bgp_unlock_node(bn);
@@ -585,22 +575,22 @@ leak_update(
zlog_debug("%s: ->%s: %s Found route, changed attr",
__func__, bgp->name_pretty, buf_prefix);
- return bi;
+ return bpi;
}
new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_IMPORTED, 0,
bgp->peer_self, new_attr, bn);
if (nexthop_self_flag)
- bgp_info_set_flag(bn, new, BGP_INFO_ANNC_NH_SELF);
+ bgp_path_info_set_flag(bn, new, BGP_PATH_ANNC_NH_SELF);
- bgp_info_extra_get(new);
+ bgp_path_info_extra_get(new);
if (num_labels)
setlabels(new, label, num_labels);
- new->extra->parent = bgp_info_lock(parent);
- bgp_lock_node((struct bgp_node *)((struct bgp_info *)parent)->net);
+ new->extra->parent = bgp_path_info_lock(parent);
+ bgp_lock_node((struct bgp_node *)((struct bgp_path_info *)parent)->net);
if (bgp_orig)
new->extra->bgp_orig = bgp_lock(bgp_orig);
if (nexthop_orig)
@@ -620,7 +610,7 @@ leak_update(
* their originating protocols will do the tracking and
* withdraw those routes if the nexthops become unreachable
*/
- if (bi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
+ if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
nh_valid = 1;
else
/*
@@ -635,10 +625,10 @@ leak_update(
__func__, (nh_valid ? "" : "not "),
bgp_nexthop->name_pretty);
if (nh_valid)
- bgp_info_set_flag(bn, new, BGP_INFO_VALID);
+ bgp_path_info_set_flag(bn, new, BGP_PATH_VALID);
bgp_aggregate_increment(bgp, p, new, afi, safi);
- bgp_info_add(bn, new);
+ bgp_path_info_add(bn, new);
bgp_unlock_node(bn);
bgp_process(bgp, bn, afi, safi);
@@ -651,12 +641,12 @@ leak_update(
}
/* cf vnc_import_bgp_add_route_mode_nvegroup() and add_vnc_route() */
-void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
- struct bgp *bgp_vrf, /* from */
- struct bgp_info *info_vrf) /* route */
+void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
+ struct bgp *bgp_vrf, /* from */
+ struct bgp_path_info *path_vrf) /* route */
{
int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF);
- struct prefix *p = &info_vrf->net->p;
+ struct prefix *p = &path_vrf->net->p;
afi_t afi = family2afi(p->family);
struct attr static_attr = {0};
struct attr *new_attr = NULL;
@@ -670,12 +660,12 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
if (debug)
zlog_debug("%s: from vrf %s", __func__, bgp_vrf->name_pretty);
- if (debug && info_vrf->attr->ecommunity) {
- char *s = ecommunity_ecom2str(info_vrf->attr->ecommunity,
+ if (debug && path_vrf->attr->ecommunity) {
+ char *s = ecommunity_ecom2str(path_vrf->attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- zlog_debug("%s: %s info_vrf->type=%d, EC{%s}", __func__,
- bgp_vrf->name, info_vrf->type, s);
+ zlog_debug("%s: %s path_vrf->type=%d, EC{%s}", __func__,
+ bgp_vrf->name, path_vrf->type, s);
XFREE(MTYPE_ECOMMUNITY_STR, s);
}
@@ -689,7 +679,7 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
}
/* loop check - should not be an imported route. */
- if (info_vrf->extra && info_vrf->extra->bgp_orig)
+ if (path_vrf->extra && path_vrf->extra->bgp_orig)
return;
@@ -700,13 +690,13 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
return;
}
- bgp_attr_dup(&static_attr, info_vrf->attr); /* shallow copy */
+ bgp_attr_dup(&static_attr, path_vrf->attr); /* shallow copy */
/*
* route map handling
*/
if (bgp_vrf->vpn_policy[afi].rmap[BGP_VPN_POLICY_DIR_TOVPN]) {
- struct bgp_info info;
+ struct bgp_path_info info;
route_map_result_t ret;
memset(&info, 0, sizeof(info));
@@ -818,8 +808,8 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
* IPv4 nexthops as the attr has been copied
* otherwise.
*/
- if (afi == AFI_IP &&
- !BGP_ATTR_NEXTHOP_AFI_IP6(info_vrf->attr)) {
+ if (afi == AFI_IP
+ && !BGP_ATTR_NEXTHOP_AFI_IP6(path_vrf->attr)) {
static_attr.mp_nexthop_global_in.s_addr =
static_attr.nexthop.s_addr;
static_attr.mp_nexthop_len = 4;
@@ -859,10 +849,10 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
bn = bgp_afi_node_get(bgp_vpn->rib[afi][safi], afi, safi, p,
&(bgp_vrf->vpn_policy[afi].tovpn_rd));
- struct bgp_info *new_info;
+ struct bgp_path_info *new_info;
- new_info = leak_update(bgp_vpn, bn, new_attr, afi, safi, info_vrf,
- &label, 1, info_vrf, bgp_vrf, NULL,
+ new_info = leak_update(bgp_vpn, bn, new_attr, afi, safi, path_vrf,
+ &label, 1, path_vrf, bgp_vrf, NULL,
nexthop_self_flag, debug);
/*
@@ -878,15 +868,15 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */
vpn_leak_to_vrf_update(bgp_vrf, new_info);
}
-void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, /* to */
- struct bgp *bgp_vrf, /* from */
- struct bgp_info *info_vrf) /* route */
+void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, /* to */
+ struct bgp *bgp_vrf, /* from */
+ struct bgp_path_info *path_vrf) /* route */
{
int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF);
- struct prefix *p = &info_vrf->net->p;
+ struct prefix *p = &path_vrf->net->p;
afi_t afi = family2afi(p->family);
safi_t safi = SAFI_MPLS_VPN;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct bgp_node *bn;
const char *debugmsg;
char buf_prefix[PREFIX_STRLEN];
@@ -896,16 +886,16 @@ void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, /* to */
zlog_debug(
"%s: entry: leak-from=%s, p=%s, type=%d, sub_type=%d",
__func__, bgp_vrf->name_pretty, buf_prefix,
- info_vrf->type, info_vrf->sub_type);
+ path_vrf->type, path_vrf->sub_type);
}
- if (info_vrf->sub_type != BGP_ROUTE_NORMAL
- && info_vrf->sub_type != BGP_ROUTE_STATIC
- && info_vrf->sub_type != BGP_ROUTE_REDISTRIBUTE) {
+ if (path_vrf->sub_type != BGP_ROUTE_NORMAL
+ && path_vrf->sub_type != BGP_ROUTE_STATIC
+ && path_vrf->sub_type != BGP_ROUTE_REDISTRIBUTE) {
if (debug)
zlog_debug("%s: wrong sub_type %d", __func__,
- info_vrf->sub_type);
+ path_vrf->sub_type);
return;
}
if (!bgp_vpn)
@@ -924,27 +914,27 @@ void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, /* to */
}
if (debug)
- zlog_debug("%s: withdrawing (info_vrf=%p)", __func__, info_vrf);
+ zlog_debug("%s: withdrawing (path_vrf=%p)", __func__, path_vrf);
bn = bgp_afi_node_get(bgp_vpn->rib[afi][safi], afi, safi, p,
&(bgp_vrf->vpn_policy[afi].tovpn_rd));
/*
* vrf -> vpn
- * match original bi imported from
+ * match original bpi imported from
*/
- for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
- if (bi->extra && bi->extra->parent == info_vrf) {
+ for (bpi = (bn ? bn->info : NULL); bpi; bpi = bpi->next) {
+ if (bpi->extra && bpi->extra->parent == path_vrf) {
break;
}
}
- if (bi) {
+ if (bpi) {
/* withdraw from looped vrfs as well */
- vpn_leak_to_vrf_withdraw(bgp_vpn, bi);
+ vpn_leak_to_vrf_withdraw(bgp_vpn, bpi);
- bgp_aggregate_decrement(bgp_vpn, p, bi, afi, safi);
- bgp_info_delete(bn, bi);
+ bgp_aggregate_decrement(bgp_vpn, p, bpi, afi, safi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp_vpn, bn, afi, safi);
}
bgp_unlock_node(bn);
@@ -959,14 +949,14 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn, /* to */
safi_t safi = SAFI_MPLS_VPN;
/*
- * Walk vpn table, delete bi with bgp_orig == bgp_vrf
+ * Walk vpn table, delete bpi with bgp_orig == bgp_vrf
*/
for (prn = bgp_table_top(bgp_vpn->rib[afi][safi]); prn;
prn = bgp_route_next(prn)) {
struct bgp_table *table;
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
/* This is the per-RD table of prefixes */
table = prn->info;
@@ -984,24 +974,24 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn, /* to */
prefix2str(&bn->p, buf, sizeof(buf)));
}
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
if (debug)
zlog_debug("%s: type %d, sub_type %d",
- __func__, bi->type,
- bi->sub_type);
- if (bi->sub_type != BGP_ROUTE_IMPORTED)
+ __func__, bpi->type,
+ bpi->sub_type);
+ if (bpi->sub_type != BGP_ROUTE_IMPORTED)
continue;
- if (!bi->extra)
+ if (!bpi->extra)
continue;
- if ((struct bgp *)bi->extra->bgp_orig
+ if ((struct bgp *)bpi->extra->bgp_orig
== bgp_vrf) {
/* delete route */
if (debug)
zlog_debug("%s: deleting it\n",
__func__);
bgp_aggregate_decrement(bgp_vpn, &bn->p,
- bi, afi, safi);
- bgp_info_delete(bn, bi);
+ bpi, afi, safi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp_vpn, bn, afi, safi);
}
}
@@ -1014,7 +1004,7 @@ void vpn_leak_from_vrf_update_all(struct bgp *bgp_vpn, /* to */
afi_t afi)
{
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF);
if (debug)
@@ -1027,21 +1017,22 @@ void vpn_leak_from_vrf_update_all(struct bgp *bgp_vpn, /* to */
if (debug)
zlog_debug("%s: node=%p", __func__, bn);
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
if (debug)
zlog_debug(
"%s: calling vpn_leak_from_vrf_update",
__func__);
- vpn_leak_from_vrf_update(bgp_vpn, bgp_vrf, bi);
+ vpn_leak_from_vrf_update(bgp_vpn, bgp_vrf, bpi);
}
}
}
-static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
- struct bgp *bgp_vpn, /* from */
- struct bgp_info *info_vpn) /* route */
+static void
+vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
+ struct bgp *bgp_vpn, /* from */
+ struct bgp_path_info *path_vpn) /* route */
{
- struct prefix *p = &info_vpn->net->p;
+ struct prefix *p = &path_vpn->net->p;
afi_t afi = family2afi(p->family);
struct attr static_attr = {0};
@@ -1053,7 +1044,7 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
mpls_label_t *pLabels = NULL;
uint32_t num_labels = 0;
int nexthop_self_flag = 1;
- struct bgp_info *bi_ultimate = NULL;
+ struct bgp_path_info *bpi_ultimate = NULL;
int origin_local = 0;
struct bgp *src_vrf;
@@ -1068,7 +1059,7 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
/* Check for intersection of route targets */
if (!ecom_intersect(
bgp_vrf->vpn_policy[afi].rtlist[BGP_VPN_POLICY_DIR_FROMVPN],
- info_vpn->attr->ecommunity)) {
+ path_vpn->attr->ecommunity)) {
return;
}
@@ -1077,7 +1068,7 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
zlog_debug("%s: updating to vrf %s", __func__,
bgp_vrf->name_pretty);
- bgp_attr_dup(&static_attr, info_vpn->attr); /* shallow copy */
+ bgp_attr_dup(&static_attr, path_vpn->attr); /* shallow copy */
/*
* Nexthop: stash and clear
@@ -1086,15 +1077,17 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
* Stash it for later label resolution by vrf ingress path and then
* overwrite with 0, i.e., "me", for the sake of vrf advertisement.
*/
- uint8_t nhfamily = NEXTHOP_FAMILY(info_vpn->attr->mp_nexthop_len);
+ uint8_t nhfamily = NEXTHOP_FAMILY(path_vpn->attr->mp_nexthop_len);
+ if (nhfamily != AF_UNSPEC)
+ static_attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
memset(&nexthop_orig, 0, sizeof(nexthop_orig));
nexthop_orig.family = nhfamily;
switch (nhfamily) {
case AF_INET:
/* save */
- nexthop_orig.u.prefix4 = info_vpn->attr->mp_nexthop_global_in;
+ nexthop_orig.u.prefix4 = path_vpn->attr->mp_nexthop_global_in;
nexthop_orig.prefixlen = 32;
if (CHECK_FLAG(bgp_vrf->af_flags[afi][safi],
@@ -1103,15 +1096,14 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
nexthop_orig.u.prefix4.s_addr;
static_attr.mp_nexthop_global_in =
- info_vpn->attr->mp_nexthop_global_in;
+ path_vpn->attr->mp_nexthop_global_in;
static_attr.mp_nexthop_len =
- info_vpn->attr->mp_nexthop_len;
+ path_vpn->attr->mp_nexthop_len;
}
- static_attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
break;
case AF_INET6:
/* save */
- nexthop_orig.u.prefix6 = info_vpn->attr->mp_nexthop_global;
+ nexthop_orig.u.prefix6 = path_vpn->attr->mp_nexthop_global;
nexthop_orig.prefixlen = 128;
if (CHECK_FLAG(bgp_vrf->af_flags[afi][safi],
@@ -1125,7 +1117,7 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
* route map handling
*/
if (bgp_vrf->vpn_policy[afi].rmap[BGP_VPN_POLICY_DIR_FROMVPN]) {
- struct bgp_info info;
+ struct bgp_path_info info;
route_map_result_t ret;
memset(&info, 0, sizeof(info));
@@ -1173,30 +1165,30 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
if (!CHECK_FLAG(bgp_vrf->af_flags[afi][safi],
BGP_CONFIG_VRF_TO_VRF_IMPORT)) {
/* work back to original route */
- for (bi_ultimate = info_vpn;
- bi_ultimate->extra && bi_ultimate->extra->parent;
- bi_ultimate = bi_ultimate->extra->parent)
+ for (bpi_ultimate = path_vpn;
+ bpi_ultimate->extra && bpi_ultimate->extra->parent;
+ bpi_ultimate = bpi_ultimate->extra->parent)
;
/*
* if original route was unicast,
* then it did not arrive over vpn
*/
- if (bi_ultimate->net) {
+ if (bpi_ultimate->net) {
struct bgp_table *table;
- table = bgp_node_table(bi_ultimate->net);
+ table = bgp_node_table(bpi_ultimate->net);
if (table && (table->safi == SAFI_UNICAST))
origin_local = 1;
}
/* copy labels */
- if (!origin_local &&
- info_vpn->extra && info_vpn->extra->num_labels) {
- num_labels = info_vpn->extra->num_labels;
+ if (!origin_local && path_vpn->extra
+ && path_vpn->extra->num_labels) {
+ num_labels = path_vpn->extra->num_labels;
if (num_labels > BGP_MAX_LABELS)
num_labels = BGP_MAX_LABELS;
- pLabels = info_vpn->extra->label;
+ pLabels = path_vpn->extra->label;
}
}
@@ -1211,19 +1203,18 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */
* For VRF-2-VRF route-leaking,
* the source will be the originating VRF.
*/
- if (info_vpn->extra && info_vpn->extra->bgp_orig)
- src_vrf = info_vpn->extra->bgp_orig;
+ if (path_vpn->extra && path_vpn->extra->bgp_orig)
+ src_vrf = path_vpn->extra->bgp_orig;
else
src_vrf = bgp_vpn;
- leak_update(bgp_vrf, bn, new_attr, afi, safi, info_vpn,
- pLabels, num_labels,
- info_vpn, /* parent */
- src_vrf, &nexthop_orig, nexthop_self_flag, debug);
+ leak_update(bgp_vrf, bn, new_attr, afi, safi, path_vpn, pLabels,
+ num_labels, path_vpn, /* parent */
+ src_vrf, &nexthop_orig, nexthop_self_flag, debug);
}
-void vpn_leak_to_vrf_update(struct bgp *bgp_vpn, /* from */
- struct bgp_info *info_vpn) /* route */
+void vpn_leak_to_vrf_update(struct bgp *bgp_vpn, /* from */
+ struct bgp_path_info *path_vpn) /* route */
{
struct listnode *mnode, *mnnode;
struct bgp *bgp;
@@ -1231,20 +1222,20 @@ void vpn_leak_to_vrf_update(struct bgp *bgp_vpn, /* from */
int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
if (debug)
- zlog_debug("%s: start (info_vpn=%p)", __func__, info_vpn);
+ zlog_debug("%s: start (path_vpn=%p)", __func__, path_vpn);
/* Loop over VRFs */
for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) {
- if (!info_vpn->extra
- || info_vpn->extra->bgp_orig != bgp) { /* no loop */
- vpn_leak_to_vrf_update_onevrf(bgp, bgp_vpn, info_vpn);
+ if (!path_vpn->extra
+ || path_vpn->extra->bgp_orig != bgp) { /* no loop */
+ vpn_leak_to_vrf_update_onevrf(bgp, bgp_vpn, path_vpn);
}
}
}
-void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */
- struct bgp_info *info_vpn) /* route */
+void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */
+ struct bgp_path_info *path_vpn) /* route */
{
struct prefix *p;
afi_t afi;
@@ -1252,38 +1243,38 @@ void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */
struct bgp *bgp;
struct listnode *mnode, *mnnode;
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
const char *debugmsg;
char buf_prefix[PREFIX_STRLEN];
int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
if (debug) {
- prefix2str(&info_vpn->net->p, buf_prefix, sizeof(buf_prefix));
- zlog_debug("%s: entry: p=%s, type=%d, sub_type=%d",
- __func__, buf_prefix,
- info_vpn->type, info_vpn->sub_type);
+ prefix2str(&path_vpn->net->p, buf_prefix, sizeof(buf_prefix));
+ zlog_debug("%s: entry: p=%s, type=%d, sub_type=%d", __func__,
+ buf_prefix, path_vpn->type, path_vpn->sub_type);
}
if (debug)
- zlog_debug("%s: start (info_vpn=%p)", __func__, info_vpn);
+ zlog_debug("%s: start (path_vpn=%p)", __func__, path_vpn);
- if (!info_vpn->net) {
+ if (!path_vpn->net) {
#if ENABLE_BGP_VNC
- /* BGP_ROUTE_RFP routes do not have info_vpn->net set (yet) */
- if (info_vpn->type == ZEBRA_ROUTE_BGP &&
- info_vpn->sub_type == BGP_ROUTE_RFP) {
+ /* BGP_ROUTE_RFP routes do not have path_vpn->net set (yet) */
+ if (path_vpn->type == ZEBRA_ROUTE_BGP
+ && path_vpn->sub_type == BGP_ROUTE_RFP) {
return;
}
#endif
if (debug)
- zlog_debug("%s: info_vpn->net unexpectedly NULL, no prefix, bailing",
+ zlog_debug(
+ "%s: path_vpn->net unexpectedly NULL, no prefix, bailing",
__func__);
return;
}
- p = &info_vpn->net->p;
+ p = &path_vpn->net->p;
afi = family2afi(p->family);
/* Loop over VRFs */
@@ -1298,7 +1289,7 @@ void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */
/* Check for intersection of route targets */
if (!ecom_intersect(bgp->vpn_policy[afi]
.rtlist[BGP_VPN_POLICY_DIR_FROMVPN],
- info_vpn->attr->ecommunity)) {
+ path_vpn->attr->ecommunity)) {
continue;
}
@@ -1308,19 +1299,20 @@ void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */
bgp->name_pretty);
bn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL);
- for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
- if (bi->extra
- && (struct bgp_info *)bi->extra->parent
- == info_vpn) {
+ for (bpi = (bn ? bn->info : NULL); bpi; bpi = bpi->next) {
+ if (bpi->extra
+ && (struct bgp_path_info *)bpi->extra->parent
+ == path_vpn) {
break;
}
}
- if (bi) {
+ if (bpi) {
if (debug)
- zlog_debug("%s: deleting bi %p", __func__, bi);
- bgp_aggregate_decrement(bgp, p, bi, afi, safi);
- bgp_info_delete(bn, bi);
+ zlog_debug("%s: deleting bpi %p", __func__,
+ bpi);
+ bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp, bn, afi, safi);
}
bgp_unlock_node(bn);
@@ -1331,25 +1323,25 @@ void vpn_leak_to_vrf_withdraw_all(struct bgp *bgp_vrf, /* to */
afi_t afi)
{
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
safi_t safi = SAFI_UNICAST;
int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
if (debug)
zlog_debug("%s: entry", __func__);
/*
- * Walk vrf table, delete bi with bgp_orig in a different vrf
+ * Walk vrf table, delete bpi with bgp_orig in a different vrf
*/
for (bn = bgp_table_top(bgp_vrf->rib[afi][safi]); bn;
bn = bgp_route_next(bn)) {
- for (bi = bn->info; bi; bi = bi->next) {
- if (bi->extra && bi->extra->bgp_orig != bgp_vrf) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
+ if (bpi->extra && bpi->extra->bgp_orig != bgp_vrf) {
/* delete route */
- bgp_aggregate_decrement(bgp_vrf, &bn->p, bi,
+ bgp_aggregate_decrement(bgp_vrf, &bn->p, bpi,
afi, safi);
- bgp_info_delete(bn, bi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp_vrf, bn, afi, safi);
}
}
@@ -1374,7 +1366,7 @@ void vpn_leak_to_vrf_update_all(struct bgp *bgp_vrf, /* to */
struct bgp_table *table;
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
memset(&prd, 0, sizeof(prd));
prd.family = AF_UNSPEC;
@@ -1389,13 +1381,14 @@ void vpn_leak_to_vrf_update_all(struct bgp *bgp_vrf, /* to */
for (bn = bgp_table_top(table); bn; bn = bgp_route_next(bn)) {
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
- if (bi->extra && bi->extra->bgp_orig == bgp_vrf)
+ if (bpi->extra
+ && bpi->extra->bgp_orig == bgp_vrf)
continue;
vpn_leak_to_vrf_update_onevrf(bgp_vrf, bgp_vpn,
- bi);
+ bpi);
}
}
}
diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h
index 61b87392a2..5b989e1853 100644
--- a/bgpd/bgp_mplsvpn.h
+++ b/bgpd/bgp_mplsvpn.h
@@ -53,10 +53,10 @@ extern int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd,
int tags, bool use_json);
extern void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, struct bgp *bgp_vrf,
- struct bgp_info *info_vrf);
+ struct bgp_path_info *path_vrf);
extern void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn, struct bgp *bgp_vrf,
- struct bgp_info *info_vrf);
+ struct bgp_path_info *path_vrf);
extern void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn,
struct bgp *bgp_vrf, afi_t afi);
@@ -70,10 +70,10 @@ extern void vpn_leak_to_vrf_update_all(struct bgp *bgp_vrf, struct bgp *bgp_vpn,
afi_t afi);
extern void vpn_leak_to_vrf_update(struct bgp *bgp_vpn,
- struct bgp_info *info_vpn);
+ struct bgp_path_info *path_vpn);
extern void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn,
- struct bgp_info *info_vpn);
+ struct bgp_path_info *path_vpn);
extern void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi);
extern void vpn_leak_zebra_vrf_label_withdraw(struct bgp *bgp, afi_t afi);
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index ce7f5b40f5..45c596254f 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -47,6 +47,8 @@
#include "zebra/rib.h"
#include "zebra/zserv.h" /* For ZEBRA_SERV_PATH. */
+DEFINE_MTYPE_STATIC(BGPD, MARTIAN_STRING, "BGP Martian Address Intf String");
+
char *bnc_str(struct bgp_nexthop_cache *bnc, char *buf, int size)
{
prefix2str(&(bnc->node->p), buf, size);
@@ -205,7 +207,7 @@ static void bgp_address_hash_string_del(void *val)
{
char *data = val;
- XFREE(MTYPE_TMP, data);
+ XFREE(MTYPE_MARTIAN_STRING, data);
}
static void *bgp_address_hash_alloc(void *p)
@@ -278,7 +280,7 @@ static void bgp_address_add(struct bgp *bgp, struct connected *ifc,
break;
}
if (!node) {
- name = XSTRDUP(MTYPE_TMP, ifc->ifp->name);
+ name = XSTRDUP(MTYPE_MARTIAN_STRING, ifc->ifp->name);
listnode_add(addr->ifp_name_list, name);
}
}
@@ -303,8 +305,10 @@ static void bgp_address_del(struct bgp *bgp, struct connected *ifc,
break;
}
- if (node)
+ if (node) {
list_delete_node(addr->ifp_name_list, node);
+ XFREE(MTYPE_MARTIAN_STRING, name);
+ }
if (addr->ifp_name_list->count == 0) {
hash_release(bgp->address_hash, addr);
diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h
index 1cb05bc853..f06fae5706 100644
--- a/bgpd/bgp_nexthop.h
+++ b/bgpd/bgp_nexthop.h
@@ -63,7 +63,7 @@ struct bgp_nexthop_cache {
struct bgp_node *node;
void *nht_info; /* In BGP, peer session */
- LIST_HEAD(path_list, bgp_info) paths;
+ LIST_HEAD(path_list, bgp_path_info) paths;
unsigned int path_count;
struct bgp *bgp;
};
@@ -74,8 +74,6 @@ struct tip_addr {
int refcnt;
};
-extern int bgp_nexthop_lookup(afi_t, struct peer *peer, struct bgp_info *,
- int *, int *);
extern void bgp_connected_add(struct bgp *bgp, struct connected *c);
extern void bgp_connected_delete(struct bgp *bgp, struct connected *c);
extern int bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop,
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index dd1ffe9f3b..5203e6eefd 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -50,9 +50,9 @@ static void register_zebra_rnh(struct bgp_nexthop_cache *bnc,
static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc,
int is_bgp_static_route);
static void evaluate_paths(struct bgp_nexthop_cache *bnc);
-static int make_prefix(int afi, struct bgp_info *ri, struct prefix *p);
-static void path_nh_map(struct bgp_info *path, struct bgp_nexthop_cache *bnc,
- int keep);
+static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p);
+static void path_nh_map(struct bgp_path_info *path,
+ struct bgp_nexthop_cache *bnc, int keep);
static int bgp_isvalid_nexthop(struct bgp_nexthop_cache *bnc)
{
@@ -66,7 +66,7 @@ static int bgp_isvalid_labeled_nexthop(struct bgp_nexthop_cache *bnc)
|| (bnc && CHECK_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID)));
}
-int bgp_find_nexthop(struct bgp_info *path, int connected)
+int bgp_find_nexthop(struct bgp_path_info *path, int connected)
{
struct bgp_nexthop_cache *bnc = path->nexthop;
@@ -104,7 +104,7 @@ static void bgp_unlink_nexthop_check(struct bgp_nexthop_cache *bnc)
}
}
-void bgp_unlink_nexthop(struct bgp_info *path)
+void bgp_unlink_nexthop(struct bgp_path_info *path)
{
struct bgp_nexthop_cache *bnc = path->nexthop;
@@ -143,7 +143,7 @@ void bgp_unlink_nexthop_by_peer(struct peer *peer)
* we need both the bgp_route and bgp_nexthop pointers.
*/
int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
- afi_t afi, struct bgp_info *ri,
+ afi_t afi, struct bgp_path_info *pi,
struct peer *peer, int connected)
{
struct bgp_node *rn;
@@ -151,9 +151,9 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
struct prefix p;
int is_bgp_static_route = 0;
- if (ri) {
- is_bgp_static_route = ((ri->type == ZEBRA_ROUTE_BGP)
- && (ri->sub_type == BGP_ROUTE_STATIC))
+ if (pi) {
+ is_bgp_static_route = ((pi->type == ZEBRA_ROUTE_BGP)
+ && (pi->sub_type == BGP_ROUTE_STATIC))
? 1
: 0;
@@ -161,19 +161,14 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
to derive
address-family from the next-hop. */
if (!is_bgp_static_route)
- afi = BGP_ATTR_NEXTHOP_AFI_IP6(ri->attr) ? AFI_IP6
+ afi = BGP_ATTR_NEXTHOP_AFI_IP6(pi->attr) ? AFI_IP6
: AFI_IP;
/* This will return TRUE if the global IPv6 NH is a link local
* addr */
- if (make_prefix(afi, ri, &p) < 0)
+ if (make_prefix(afi, pi, &p) < 0)
return 1;
} else if (peer) {
- /* Don't register link local NH */
- if (afi == AFI_IP6
- && IN6_IS_ADDR_LINKLOCAL(&peer->su.sin6.sin6_addr))
- return 1;
-
if (!sockunion2hostprefix(&peer->su, &p)) {
if (BGP_DEBUG(nht, NHT)) {
zlog_debug(
@@ -251,19 +246,19 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
bnc->flags |= BGP_NEXTHOP_VALID;
} else if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
register_zebra_rnh(bnc, is_bgp_static_route);
- if (ri && ri->nexthop != bnc) {
+ if (pi && pi->nexthop != bnc) {
/* Unlink from existing nexthop cache, if any. This will also
* free
* the nexthop cache entry, if appropriate.
*/
- bgp_unlink_nexthop(ri);
+ bgp_unlink_nexthop(pi);
- path_nh_map(ri, bnc, 1); /* updates NHT ri list reference */
+ path_nh_map(pi, bnc, 1); /* updates NHT pi list reference */
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID) && bnc->metric)
- (bgp_info_extra_get(ri))->igpmetric = bnc->metric;
- else if (ri->extra)
- ri->extra->igpmetric = 0;
+ (bgp_path_info_extra_get(pi))->igpmetric = bnc->metric;
+ else if (pi->extra)
+ pi->extra->igpmetric = 0;
} else if (peer)
bnc->nht_info = (void *)peer; /* NHT peer reference */
@@ -287,10 +282,6 @@ void bgp_delete_connected_nexthop(afi_t afi, struct peer *peer)
if (!peer)
return;
- /* We don't register link local address for NHT */
- if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL(&peer->su.sin6.sin6_addr))
- return;
-
if (!sockunion2hostprefix(&peer->su, &p))
return;
@@ -437,8 +428,9 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
* we receive from bgp. This is to allow us
* to work with v4 routing over v6 nexthops
*/
- if (peer &&
- CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE)
+ if (peer && !peer->ifp
+ && CHECK_FLAG(peer->flags,
+ PEER_FLAG_CAPABILITY_ENHE)
&& nhr.prefix.family == AF_INET6) {
struct interface *ifp;
@@ -535,11 +527,11 @@ void bgp_cleanup_nexthops(struct bgp *bgp)
* make_prefix - make a prefix structure from the path (essentially
* path's node.
*/
-static int make_prefix(int afi, struct bgp_info *ri, struct prefix *p)
+static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p)
{
- int is_bgp_static = ((ri->type == ZEBRA_ROUTE_BGP)
- && (ri->sub_type == BGP_ROUTE_STATIC))
+ int is_bgp_static = ((pi->type == ZEBRA_ROUTE_BGP)
+ && (pi->sub_type == BGP_ROUTE_STATIC))
? 1
: 0;
@@ -548,26 +540,21 @@ static int make_prefix(int afi, struct bgp_info *ri, struct prefix *p)
case AFI_IP:
p->family = AF_INET;
if (is_bgp_static) {
- p->u.prefix4 = ri->net->p.u.prefix4;
- p->prefixlen = ri->net->p.prefixlen;
+ p->u.prefix4 = pi->net->p.u.prefix4;
+ p->prefixlen = pi->net->p.prefixlen;
} else {
- p->u.prefix4 = ri->attr->nexthop;
+ p->u.prefix4 = pi->attr->nexthop;
p->prefixlen = IPV4_MAX_BITLEN;
}
break;
case AFI_IP6:
- /* We don't register link local NH */
- if (ri->attr->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL
- || IN6_IS_ADDR_LINKLOCAL(&ri->attr->mp_nexthop_global))
- return -1;
-
p->family = AF_INET6;
if (is_bgp_static) {
- p->u.prefix6 = ri->net->p.u.prefix6;
- p->prefixlen = ri->net->p.prefixlen;
+ p->u.prefix6 = pi->net->p.u.prefix6;
+ p->prefixlen = pi->net->p.prefixlen;
} else {
- p->u.prefix6 = ri->attr->mp_nexthop_global;
+ p->u.prefix6 = pi->attr->mp_nexthop_global;
p->prefixlen = IPV6_MAX_BITLEN;
}
break;
@@ -686,7 +673,7 @@ static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc,
static void evaluate_paths(struct bgp_nexthop_cache *bnc)
{
struct bgp_node *rn;
- struct bgp_info *path;
+ struct bgp_path_info *path;
int afi;
struct peer *peer = (struct peer *)bnc->nht_info;
struct bgp_table *table;
@@ -753,14 +740,16 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
(bnc_is_valid_nexthop ? "" : "not "));
}
- if ((CHECK_FLAG(path->flags, BGP_INFO_VALID) ? 1 : 0)
+ if ((CHECK_FLAG(path->flags, BGP_PATH_VALID) ? 1 : 0)
!= bnc_is_valid_nexthop) {
- if (CHECK_FLAG(path->flags, BGP_INFO_VALID)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_VALID)) {
bgp_aggregate_decrement(bgp_path, &rn->p,
path, afi, safi);
- bgp_info_unset_flag(rn, path, BGP_INFO_VALID);
+ bgp_path_info_unset_flag(rn, path,
+ BGP_PATH_VALID);
} else {
- bgp_info_set_flag(rn, path, BGP_INFO_VALID);
+ bgp_path_info_set_flag(rn, path,
+ BGP_PATH_VALID);
bgp_aggregate_increment(bgp_path, &rn->p,
path, afi, safi);
}
@@ -769,13 +758,14 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
/* Copy the metric to the path. Will be used for bestpath
* computation */
if (bgp_isvalid_nexthop(bnc) && bnc->metric)
- (bgp_info_extra_get(path))->igpmetric = bnc->metric;
+ (bgp_path_info_extra_get(path))->igpmetric =
+ bnc->metric;
else if (path->extra)
path->extra->igpmetric = 0;
if (CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_METRIC_CHANGED)
|| CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED))
- SET_FLAG(path->flags, BGP_INFO_IGP_CHANGED);
+ SET_FLAG(path->flags, BGP_PATH_IGP_CHANGED);
bgp_process(bgp_path, rn, afi, safi);
}
@@ -799,8 +789,8 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
* make - if set, make the association. if unset, just break the existing
* association.
*/
-static void path_nh_map(struct bgp_info *path, struct bgp_nexthop_cache *bnc,
- int make)
+static void path_nh_map(struct bgp_path_info *path,
+ struct bgp_nexthop_cache *bnc, int make)
{
if (path->nexthop) {
LIST_REMOVE(path, nh_thread);
diff --git a/bgpd/bgp_nht.h b/bgpd/bgp_nht.h
index a821a42c20..7b29fa818f 100644
--- a/bgpd/bgp_nht.h
+++ b/bgpd/bgp_nht.h
@@ -32,7 +32,7 @@ extern void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id);
* p - path for which the nexthop object is being looked up
* connected - True if NH MUST be a connected route
*/
-extern int bgp_find_nexthop(struct bgp_info *p, int connected);
+extern int bgp_find_nexthop(struct bgp_path_info *p, int connected);
/**
* bgp_find_or_add_nexthop() - lookup the nexthop cache table for the bnc
@@ -47,16 +47,17 @@ extern int bgp_find_nexthop(struct bgp_info *p, int connected);
* connected - True if NH MUST be a connected route
*/
extern int bgp_find_or_add_nexthop(struct bgp *bgp_route,
- struct bgp *bgp_nexthop, afi_t a, struct bgp_info *p,
- struct peer *peer, int connected);
+ struct bgp *bgp_nexthop, afi_t a,
+ struct bgp_path_info *p, struct peer *peer,
+ int connected);
/**
* bgp_unlink_nexthop() - Unlink the nexthop object from the path structure.
* ARGUMENTS:
* p - path structure.
*/
-extern void bgp_unlink_nexthop(struct bgp_info *p);
-void bgp_unlink_nexthop_by_peer(struct peer *);
+extern void bgp_unlink_nexthop(struct bgp_path_info *p);
+void bgp_unlink_nexthop_by_peer(struct peer *peer);
/**
* bgp_delete_connected_nexthop() - Reset the 'peer' pointer for a connected
diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c
index a74b584e90..263a3ebf4d 100644
--- a/bgpd/bgp_pbr.c
+++ b/bgpd/bgp_pbr.c
@@ -227,7 +227,7 @@ struct bgp_pbr_or_filter {
};
static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
- struct bgp_info *binfo,
+ struct bgp_path_info *path,
struct bgp_pbr_filter *bpf,
struct nexthop *nh,
float *rate);
@@ -627,7 +627,7 @@ static int bgp_pbr_validate_policy_route(struct bgp_pbr_entry_main *api)
/* return -1 if build or validation failed */
static int bgp_pbr_build_and_validate_entry(struct prefix *p,
- struct bgp_info *info,
+ struct bgp_path_info *path,
struct bgp_pbr_entry_main *api)
{
int ret;
@@ -645,8 +645,8 @@ static int bgp_pbr_build_and_validate_entry(struct prefix *p,
if (ret < 0)
return -1;
/* extract actiosn from flowspec ecom list */
- if (info && info->attr && info->attr->ecommunity) {
- ecom = info->attr->ecommunity;
+ if (path && path->attr && path->attr->ecommunity) {
+ ecom = path->attr->ecommunity;
for (i = 0; i < ecom->size; i++) {
ecom_eval = (struct ecommunity_val *)
(ecom->val + (i * ECOMMUNITY_SIZE));
@@ -690,7 +690,7 @@ static int bgp_pbr_build_and_validate_entry(struct prefix *p,
(char)ECOMMUNITY_REDIRECT_IP_NH)) {
api_action->action = ACTION_REDIRECT_IP;
api_action->u.zr.redirect_ip_v4.s_addr =
- info->attr->nexthop.s_addr;
+ path->attr->nexthop.s_addr;
api_action->u.zr.duplicate = ecom_eval->val[7];
} else {
if (ecom_eval->val[0] !=
@@ -1223,16 +1223,16 @@ static void bgp_pbr_flush_entry(struct bgp *bgp, struct bgp_pbr_action *bpa,
bgp_send_pbr_ipset_entry_match(bpme, false);
bpme->installed = false;
bpme->backpointer = NULL;
- if (bpme->bgp_info) {
- struct bgp_info *bgp_info;
- struct bgp_info_extra *extra;
+ if (bpme->path) {
+ struct bgp_path_info *path;
+ struct bgp_path_info_extra *extra;
- /* unlink bgp_info to bpme */
- bgp_info = (struct bgp_info *)bpme->bgp_info;
- extra = bgp_info_extra_get(bgp_info);
+ /* unlink bgp_path_info to bpme */
+ path = (struct bgp_path_info *)bpme->path;
+ extra = bgp_path_info_extra_get(path);
if (extra->bgp_fs_pbr)
listnode_delete(extra->bgp_fs_pbr, bpme);
- bpme->bgp_info = NULL;
+ bpme->path = NULL;
}
}
hash_release(bpm->entry_hash, bpme);
@@ -1304,9 +1304,8 @@ static int bgp_pbr_get_remaining_entry(struct hash_backet *backet, void *arg)
return HASHWALK_ABORT;
}
-static void bgp_pbr_policyroute_remove_from_zebra_unit(struct bgp *bgp,
- struct bgp_info *binfo,
- struct bgp_pbr_filter *bpf)
+static void bgp_pbr_policyroute_remove_from_zebra_unit(
+ struct bgp *bgp, struct bgp_path_info *path, struct bgp_pbr_filter *bpf)
{
struct bgp_pbr_match temp;
struct bgp_pbr_match_entry temp2;
@@ -1438,13 +1437,10 @@ static uint8_t bgp_pbr_next_type_entry(uint8_t type_entry)
return 0;
}
-static void bgp_pbr_icmp_action(struct bgp *bgp,
- struct bgp_info *binfo,
- struct bgp_pbr_filter *bpf,
- struct bgp_pbr_or_filter *bpof,
- bool add,
- struct nexthop *nh,
- float *rate)
+static void bgp_pbr_icmp_action(struct bgp *bgp, struct bgp_path_info *path,
+ struct bgp_pbr_filter *bpf,
+ struct bgp_pbr_or_filter *bpof, bool add,
+ struct nexthop *nh, float *rate)
{
struct bgp_pbr_range_port srcp, dstp;
struct bgp_pbr_val_mask *icmp_type, *icmp_code;
@@ -1466,11 +1462,11 @@ static void bgp_pbr_icmp_action(struct bgp *bgp,
for (ALL_LIST_ELEMENTS_RO(bpof->icmp_code, cnode, icmp_code)) {
dstp.min_port = icmp_code->val;
if (add)
- bgp_pbr_policyroute_add_to_zebra_unit(bgp, binfo,
- bpf, nh, rate);
+ bgp_pbr_policyroute_add_to_zebra_unit(
+ bgp, path, bpf, nh, rate);
else
bgp_pbr_policyroute_remove_from_zebra_unit(
- bgp, binfo, bpf);
+ bgp, path, bpf);
}
return;
}
@@ -1487,31 +1483,27 @@ static void bgp_pbr_icmp_action(struct bgp *bgp,
dstp.max_port = 255;
if (add)
bgp_pbr_policyroute_add_to_zebra_unit(
- bgp, binfo,
- bpf, nh, rate);
+ bgp, path, bpf, nh, rate);
else
- bgp_pbr_policyroute_remove_from_zebra_unit(bgp,
- binfo, bpf);
+ bgp_pbr_policyroute_remove_from_zebra_unit(
+ bgp, path, bpf);
continue;
}
for (ALL_LIST_ELEMENTS_RO(bpof->icmp_code, cnode, icmp_code)) {
dstp.min_port = icmp_code->val;
if (add)
bgp_pbr_policyroute_add_to_zebra_unit(
- bgp, binfo,
- bpf, nh, rate);
+ bgp, path, bpf, nh, rate);
else
bgp_pbr_policyroute_remove_from_zebra_unit(
- bgp, binfo, bpf);
+ bgp, path, bpf);
}
}
}
-static void bgp_pbr_policyroute_remove_from_zebra_recursive(struct bgp *bgp,
- struct bgp_info *binfo,
- struct bgp_pbr_filter *bpf,
- struct bgp_pbr_or_filter *bpof,
- uint8_t type_entry)
+static void bgp_pbr_policyroute_remove_from_zebra_recursive(
+ struct bgp *bgp, struct bgp_path_info *path, struct bgp_pbr_filter *bpf,
+ struct bgp_pbr_or_filter *bpof, uint8_t type_entry)
{
struct listnode *node, *nnode;
struct bgp_pbr_val_mask *valmask;
@@ -1520,8 +1512,8 @@ static void bgp_pbr_policyroute_remove_from_zebra_recursive(struct bgp *bgp,
struct bgp_pbr_val_mask **target_val;
if (type_entry == 0)
- return bgp_pbr_policyroute_remove_from_zebra_unit(bgp,
- binfo, bpf);
+ return bgp_pbr_policyroute_remove_from_zebra_unit(bgp, path,
+ bpf);
next_type_entry = bgp_pbr_next_type_entry(type_entry);
if (type_entry == FLOWSPEC_TCP_FLAGS && bpof->tcpflags) {
orig_list = bpof->tcpflags;
@@ -1538,53 +1530,43 @@ static void bgp_pbr_policyroute_remove_from_zebra_recursive(struct bgp *bgp,
} else if (type_entry == FLOWSPEC_ICMP_TYPE &&
(bpof->icmp_type || bpof->icmp_code)) {
/* enumerate list for icmp - must be last one */
- bgp_pbr_icmp_action(bgp, binfo, bpf, bpof, false, NULL, NULL);
+ bgp_pbr_icmp_action(bgp, path, bpf, bpof, false, NULL, NULL);
return;
} else {
- return bgp_pbr_policyroute_remove_from_zebra_recursive(bgp,
- binfo,
- bpf, bpof,
- next_type_entry);
+ return bgp_pbr_policyroute_remove_from_zebra_recursive(
+ bgp, path, bpf, bpof, next_type_entry);
}
for (ALL_LIST_ELEMENTS(orig_list, node, nnode, valmask)) {
*target_val = valmask;
- bgp_pbr_policyroute_remove_from_zebra_recursive(bgp, binfo,
- bpf, bpof,
- next_type_entry);
+ bgp_pbr_policyroute_remove_from_zebra_recursive(
+ bgp, path, bpf, bpof, next_type_entry);
}
}
-static void bgp_pbr_policyroute_remove_from_zebra(struct bgp *bgp,
- struct bgp_info *binfo,
- struct bgp_pbr_filter *bpf,
- struct bgp_pbr_or_filter *bpof)
+static void bgp_pbr_policyroute_remove_from_zebra(
+ struct bgp *bgp, struct bgp_path_info *path, struct bgp_pbr_filter *bpf,
+ struct bgp_pbr_or_filter *bpof)
{
if (!bpof)
- return bgp_pbr_policyroute_remove_from_zebra_unit(bgp,
- binfo,
+ return bgp_pbr_policyroute_remove_from_zebra_unit(bgp, path,
bpf);
if (bpof->tcpflags)
- bgp_pbr_policyroute_remove_from_zebra_recursive(bgp, binfo,
- bpf, bpof,
- FLOWSPEC_TCP_FLAGS);
+ bgp_pbr_policyroute_remove_from_zebra_recursive(
+ bgp, path, bpf, bpof, FLOWSPEC_TCP_FLAGS);
else if (bpof->dscp)
- bgp_pbr_policyroute_remove_from_zebra_recursive(bgp, binfo,
- bpf, bpof,
- FLOWSPEC_DSCP);
+ bgp_pbr_policyroute_remove_from_zebra_recursive(
+ bgp, path, bpf, bpof, FLOWSPEC_DSCP);
else if (bpof->pkt_len)
- bgp_pbr_policyroute_remove_from_zebra_recursive(bgp, binfo,
- bpf, bpof,
- FLOWSPEC_PKT_LEN);
+ bgp_pbr_policyroute_remove_from_zebra_recursive(
+ bgp, path, bpf, bpof, FLOWSPEC_PKT_LEN);
else if (bpof->fragment)
- bgp_pbr_policyroute_remove_from_zebra_recursive(bgp, binfo,
- bpf, bpof,
- FLOWSPEC_FRAGMENT);
+ bgp_pbr_policyroute_remove_from_zebra_recursive(
+ bgp, path, bpf, bpof, FLOWSPEC_FRAGMENT);
else if (bpof->icmp_type || bpof->icmp_code)
- bgp_pbr_policyroute_remove_from_zebra_recursive(bgp, binfo,
- bpf, bpof,
- FLOWSPEC_ICMP_TYPE);
+ bgp_pbr_policyroute_remove_from_zebra_recursive(
+ bgp, path, bpf, bpof, FLOWSPEC_ICMP_TYPE);
else
- bgp_pbr_policyroute_remove_from_zebra_unit(bgp, binfo, bpf);
+ bgp_pbr_policyroute_remove_from_zebra_unit(bgp, path, bpf);
/* flush bpof */
if (bpof->tcpflags)
list_delete_all_node(bpof->tcpflags);
@@ -1692,10 +1674,10 @@ static void bgp_pbr_dump_entry(struct bgp_pbr_filter *bpf, bool add)
}
static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
- struct bgp_info *binfo,
- struct bgp_pbr_filter *bpf,
- struct nexthop *nh,
- float *rate)
+ struct bgp_path_info *path,
+ struct bgp_pbr_filter *bpf,
+ struct nexthop *nh,
+ float *rate)
{
struct bgp_pbr_match temp;
struct bgp_pbr_match_entry temp2;
@@ -1848,19 +1830,21 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
bpme->installed = false;
bpme->install_in_progress = false;
/* link bgp info to bpme */
- bpme->bgp_info = (void *)binfo;
+ bpme->path = (void *)path;
} else
bpme_found = true;
/* already installed */
if (bpme_found) {
- struct bgp_info_extra *extra = bgp_info_extra_get(binfo);
+ struct bgp_path_info_extra *extra =
+ bgp_path_info_extra_get(path);
if (extra && extra->bgp_fs_pbr &&
listnode_lookup(extra->bgp_fs_pbr, bpme)) {
if (BGP_DEBUG(pbr, PBR_ERROR))
- zlog_err("%s: entry %p/%p already installed in bgp pbr",
- __func__, binfo, bpme);
+ zlog_err(
+ "%s: entry %p/%p already installed in bgp pbr",
+ __func__, path, bpme);
return;
}
}
@@ -1911,13 +1895,10 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
}
-static void bgp_pbr_policyroute_add_to_zebra_recursive(struct bgp *bgp,
- struct bgp_info *binfo,
- struct bgp_pbr_filter *bpf,
- struct bgp_pbr_or_filter *bpof,
- struct nexthop *nh,
- float *rate,
- uint8_t type_entry)
+static void bgp_pbr_policyroute_add_to_zebra_recursive(
+ struct bgp *bgp, struct bgp_path_info *path, struct bgp_pbr_filter *bpf,
+ struct bgp_pbr_or_filter *bpof, struct nexthop *nh, float *rate,
+ uint8_t type_entry)
{
struct listnode *node, *nnode;
struct bgp_pbr_val_mask *valmask;
@@ -1926,8 +1907,8 @@ static void bgp_pbr_policyroute_add_to_zebra_recursive(struct bgp *bgp,
struct bgp_pbr_val_mask **target_val;
if (type_entry == 0)
- return bgp_pbr_policyroute_add_to_zebra_unit(bgp, binfo, bpf,
- nh, rate);
+ return bgp_pbr_policyroute_add_to_zebra_unit(bgp, path, bpf, nh,
+ rate);
next_type_entry = bgp_pbr_next_type_entry(type_entry);
if (type_entry == FLOWSPEC_TCP_FLAGS && bpof->tcpflags) {
orig_list = bpof->tcpflags;
@@ -1944,59 +1925,45 @@ static void bgp_pbr_policyroute_add_to_zebra_recursive(struct bgp *bgp,
} else if (type_entry == FLOWSPEC_ICMP_TYPE &&
(bpof->icmp_type || bpof->icmp_code)) {
/* enumerate list for icmp - must be last one */
- bgp_pbr_icmp_action(bgp, binfo, bpf, bpof, true, nh, rate);
+ bgp_pbr_icmp_action(bgp, path, bpf, bpof, true, nh, rate);
return;
} else {
- return bgp_pbr_policyroute_add_to_zebra_recursive(bgp, binfo,
- bpf, bpof, nh, rate,
- next_type_entry);
+ return bgp_pbr_policyroute_add_to_zebra_recursive(
+ bgp, path, bpf, bpof, nh, rate, next_type_entry);
}
for (ALL_LIST_ELEMENTS(orig_list, node, nnode, valmask)) {
*target_val = valmask;
- bgp_pbr_policyroute_add_to_zebra_recursive(bgp, binfo,
- bpf, bpof,
- nh, rate,
- next_type_entry);
+ bgp_pbr_policyroute_add_to_zebra_recursive(
+ bgp, path, bpf, bpof, nh, rate, next_type_entry);
}
}
static void bgp_pbr_policyroute_add_to_zebra(struct bgp *bgp,
- struct bgp_info *binfo,
- struct bgp_pbr_filter *bpf,
- struct bgp_pbr_or_filter *bpof,
- struct nexthop *nh,
- float *rate)
+ struct bgp_path_info *path,
+ struct bgp_pbr_filter *bpf,
+ struct bgp_pbr_or_filter *bpof,
+ struct nexthop *nh, float *rate)
{
if (!bpof)
- return bgp_pbr_policyroute_add_to_zebra_unit(bgp, binfo,
- bpf, nh, rate);
+ return bgp_pbr_policyroute_add_to_zebra_unit(bgp, path, bpf, nh,
+ rate);
if (bpof->tcpflags)
- bgp_pbr_policyroute_add_to_zebra_recursive(bgp, binfo,
- bpf, bpof,
- nh, rate,
- FLOWSPEC_TCP_FLAGS);
+ bgp_pbr_policyroute_add_to_zebra_recursive(
+ bgp, path, bpf, bpof, nh, rate, FLOWSPEC_TCP_FLAGS);
else if (bpof->dscp)
- bgp_pbr_policyroute_add_to_zebra_recursive(bgp, binfo,
- bpf, bpof,
- nh, rate,
- FLOWSPEC_DSCP);
+ bgp_pbr_policyroute_add_to_zebra_recursive(
+ bgp, path, bpf, bpof, nh, rate, FLOWSPEC_DSCP);
else if (bpof->pkt_len)
- bgp_pbr_policyroute_add_to_zebra_recursive(bgp, binfo,
- bpf, bpof,
- nh, rate,
- FLOWSPEC_PKT_LEN);
+ bgp_pbr_policyroute_add_to_zebra_recursive(
+ bgp, path, bpf, bpof, nh, rate, FLOWSPEC_PKT_LEN);
else if (bpof->fragment)
- bgp_pbr_policyroute_add_to_zebra_recursive(bgp, binfo,
- bpf, bpof,
- nh, rate,
- FLOWSPEC_FRAGMENT);
+ bgp_pbr_policyroute_add_to_zebra_recursive(
+ bgp, path, bpf, bpof, nh, rate, FLOWSPEC_FRAGMENT);
else if (bpof->icmp_type || bpof->icmp_code)
- bgp_pbr_policyroute_add_to_zebra_recursive(bgp, binfo,
- bpf, bpof, nh, rate,
- FLOWSPEC_ICMP_TYPE);
+ bgp_pbr_policyroute_add_to_zebra_recursive(
+ bgp, path, bpf, bpof, nh, rate, FLOWSPEC_ICMP_TYPE);
else
- bgp_pbr_policyroute_add_to_zebra_unit(bgp, binfo, bpf,
- nh, rate);
+ bgp_pbr_policyroute_add_to_zebra_unit(bgp, path, bpf, nh, rate);
/* flush bpof */
if (bpof->tcpflags)
list_delete_all_node(bpof->tcpflags);
@@ -2012,10 +1979,8 @@ static void bgp_pbr_policyroute_add_to_zebra(struct bgp *bgp,
list_delete_all_node(bpof->icmp_code);
}
-static void bgp_pbr_handle_entry(struct bgp *bgp,
- struct bgp_info *binfo,
- struct bgp_pbr_entry_main *api,
- bool add)
+static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *path,
+ struct bgp_pbr_entry_main *api, bool add)
{
struct nexthop nh;
int i = 0;
@@ -2151,9 +2116,8 @@ static void bgp_pbr_handle_entry(struct bgp *bgp,
bpf.src_port = srcp;
bpf.dst_port = dstp;
if (!add)
- return bgp_pbr_policyroute_remove_from_zebra(bgp,
- binfo,
- &bpf, &bpof);
+ return bgp_pbr_policyroute_remove_from_zebra(bgp, path, &bpf,
+ &bpof);
/* no action for add = true */
for (i = 0; i < api->action_num; i++) {
switch (api->actions[i].action) {
@@ -2162,9 +2126,8 @@ static void bgp_pbr_handle_entry(struct bgp *bgp,
if (api->actions[i].u.r.rate == 0) {
nh.vrf_id = api->vrf_id;
nh.type = NEXTHOP_TYPE_BLACKHOLE;
- bgp_pbr_policyroute_add_to_zebra(bgp, binfo,
- &bpf, &bpof,
- &nh, &rate);
+ bgp_pbr_policyroute_add_to_zebra(
+ bgp, path, &bpf, &bpof, &nh, &rate);
} else {
/* update rate. can be reentrant */
rate = api->actions[i].u.r.rate;
@@ -2204,8 +2167,7 @@ static void bgp_pbr_handle_entry(struct bgp *bgp,
nh.gate.ipv4.s_addr =
api->actions[i].u.zr.redirect_ip_v4.s_addr;
nh.vrf_id = api->vrf_id;
- bgp_pbr_policyroute_add_to_zebra(bgp, binfo,
- &bpf, &bpof,
+ bgp_pbr_policyroute_add_to_zebra(bgp, path, &bpf, &bpof,
&nh, &rate);
/* XXX combination with REDIRECT_VRF
* + REDIRECT_NH_IP not done
@@ -2215,8 +2177,7 @@ static void bgp_pbr_handle_entry(struct bgp *bgp,
case ACTION_REDIRECT:
nh.vrf_id = api->actions[i].u.redirect_vrf;
nh.type = NEXTHOP_TYPE_IPV4;
- bgp_pbr_policyroute_add_to_zebra(bgp, binfo,
- &bpf, &bpof,
+ bgp_pbr_policyroute_add_to_zebra(bgp, path, &bpf, &bpof,
&nh, &rate);
continue_loop = 0;
break;
@@ -2236,8 +2197,8 @@ static void bgp_pbr_handle_entry(struct bgp *bgp,
}
void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p,
- struct bgp_info *info, afi_t afi, safi_t safi,
- bool nlri_update)
+ struct bgp_path_info *info, afi_t afi, safi_t safi,
+ bool nlri_update)
{
struct bgp_pbr_entry_main api;
diff --git a/bgpd/bgp_pbr.h b/bgpd/bgp_pbr.h
index e853784afd..d15cb39c32 100644
--- a/bgpd/bgp_pbr.h
+++ b/bgpd/bgp_pbr.h
@@ -219,7 +219,7 @@ struct bgp_pbr_match_entry {
uint16_t dst_port_max;
uint8_t proto;
- void *bgp_info;
+ void *path;
bool installed;
bool install_in_progress;
@@ -279,11 +279,10 @@ extern int bgp_pbr_match_hash_equal(const void *arg1,
void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api);
struct bgp_node;
-struct bgp_info;
+struct bgp_path_info;
extern void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p,
- struct bgp_info *new_select,
- afi_t afi, safi_t safi,
- bool nlri_update);
+ struct bgp_path_info *new_select, afi_t afi,
+ safi_t safi, bool nlri_update);
/* bgp pbr utilities */
extern struct bgp_pbr_interface *pbr_interface_lookup(const char *name);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 49c547c5bf..91f3eaa30d 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -164,19 +164,20 @@ struct bgp_node *bgp_afi_node_lookup(struct bgp_table *table, afi_t afi,
return rn;
}
-/* Allocate bgp_info_extra */
-static struct bgp_info_extra *bgp_info_extra_new(void)
+/* Allocate bgp_path_info_extra */
+static struct bgp_path_info_extra *bgp_path_info_extra_new(void)
{
- struct bgp_info_extra *new;
- new = XCALLOC(MTYPE_BGP_ROUTE_EXTRA, sizeof(struct bgp_info_extra));
+ struct bgp_path_info_extra *new;
+ new = XCALLOC(MTYPE_BGP_ROUTE_EXTRA,
+ sizeof(struct bgp_path_info_extra));
new->label[0] = MPLS_INVALID_LABEL;
new->num_labels = 0;
return new;
}
-static void bgp_info_extra_free(struct bgp_info_extra **extra)
+static void bgp_path_info_extra_free(struct bgp_path_info_extra **extra)
{
- struct bgp_info_extra *e;
+ struct bgp_path_info_extra *e;
if (!extra || !*extra)
return;
@@ -187,27 +188,27 @@ static void bgp_info_extra_free(struct bgp_info_extra **extra)
e->damp_info = NULL;
if (e->parent) {
- struct bgp_info *bi = (struct bgp_info *)e->parent;
+ struct bgp_path_info *bpi = (struct bgp_path_info *)e->parent;
- if (bi->net) {
+ if (bpi->net) {
/* FIXME: since multiple e may have the same e->parent
* and e->parent->net is holding a refcount for each
* of them, we need to do some fudging here.
*
- * WARNING: if bi->net->lock drops to 0, bi may be
- * freed as well (because bi->net was holding the
- * last reference to bi) => write after free!
+ * WARNING: if bpi->net->lock drops to 0, bpi may be
+ * freed as well (because bpi->net was holding the
+ * last reference to bpi) => write after free!
*/
unsigned refcount;
- bi = bgp_info_lock(bi);
- refcount = bi->net->lock - 1;
- bgp_unlock_node((struct bgp_node *)bi->net);
+ bpi = bgp_path_info_lock(bpi);
+ refcount = bpi->net->lock - 1;
+ bgp_unlock_node((struct bgp_node *)bpi->net);
if (!refcount)
- bi->net = NULL;
- bgp_info_unlock(bi);
+ bpi->net = NULL;
+ bgp_path_info_unlock(bpi);
}
- bgp_info_unlock(e->parent);
+ bgp_path_info_unlock(e->parent);
e->parent = NULL;
}
@@ -221,182 +222,184 @@ static void bgp_info_extra_free(struct bgp_info_extra **extra)
*extra = NULL;
}
-/* Get bgp_info extra information for the given bgp_info, lazy allocated
- * if required.
+/* Get bgp_path_info extra information for the given bgp_path_info, lazy
+ * allocated if required.
*/
-struct bgp_info_extra *bgp_info_extra_get(struct bgp_info *ri)
+struct bgp_path_info_extra *bgp_path_info_extra_get(struct bgp_path_info *pi)
{
- if (!ri->extra)
- ri->extra = bgp_info_extra_new();
- return ri->extra;
+ if (!pi->extra)
+ pi->extra = bgp_path_info_extra_new();
+ return pi->extra;
}
/* Allocate new bgp info structure. */
-struct bgp_info *bgp_info_new(void)
+struct bgp_path_info *bgp_path_info_new(void)
{
- return XCALLOC(MTYPE_BGP_ROUTE, sizeof(struct bgp_info));
+ return XCALLOC(MTYPE_BGP_ROUTE, sizeof(struct bgp_path_info));
}
/* Free bgp route information. */
-static void bgp_info_free(struct bgp_info *binfo)
+static void bgp_path_info_free(struct bgp_path_info *path)
{
- if (binfo->attr)
- bgp_attr_unintern(&binfo->attr);
+ if (path->attr)
+ bgp_attr_unintern(&path->attr);
- bgp_unlink_nexthop(binfo);
- bgp_info_extra_free(&binfo->extra);
- bgp_info_mpath_free(&binfo->mpath);
+ bgp_unlink_nexthop(path);
+ bgp_path_info_extra_free(&path->extra);
+ bgp_path_info_mpath_free(&path->mpath);
- peer_unlock(binfo->peer); /* bgp_info peer reference */
+ peer_unlock(path->peer); /* bgp_path_info peer reference */
- XFREE(MTYPE_BGP_ROUTE, binfo);
+ XFREE(MTYPE_BGP_ROUTE, path);
}
-struct bgp_info *bgp_info_lock(struct bgp_info *binfo)
+struct bgp_path_info *bgp_path_info_lock(struct bgp_path_info *path)
{
- binfo->lock++;
- return binfo;
+ path->lock++;
+ return path;
}
-struct bgp_info *bgp_info_unlock(struct bgp_info *binfo)
+struct bgp_path_info *bgp_path_info_unlock(struct bgp_path_info *path)
{
- assert(binfo && binfo->lock > 0);
- binfo->lock--;
+ assert(path && path->lock > 0);
+ path->lock--;
- if (binfo->lock == 0) {
+ if (path->lock == 0) {
#if 0
zlog_debug ("%s: unlocked and freeing", __func__);
zlog_backtrace (LOG_DEBUG);
#endif
- bgp_info_free(binfo);
+ bgp_path_info_free(path);
return NULL;
}
#if 0
- if (binfo->lock == 1)
+ if (path->lock == 1)
{
zlog_debug ("%s: unlocked to 1", __func__);
zlog_backtrace (LOG_DEBUG);
}
#endif
- return binfo;
+ return path;
}
-void bgp_info_add(struct bgp_node *rn, struct bgp_info *ri)
+void bgp_path_info_add(struct bgp_node *rn, struct bgp_path_info *pi)
{
- struct bgp_info *top;
+ struct bgp_path_info *top;
top = rn->info;
- ri->next = rn->info;
- ri->prev = NULL;
+ pi->next = rn->info;
+ pi->prev = NULL;
if (top)
- top->prev = ri;
- rn->info = ri;
+ top->prev = pi;
+ rn->info = pi;
- bgp_info_lock(ri);
+ bgp_path_info_lock(pi);
bgp_lock_node(rn);
- peer_lock(ri->peer); /* bgp_info peer reference */
+ peer_lock(pi->peer); /* bgp_path_info peer reference */
}
/* Do the actual removal of info from RIB, for use by bgp_process
completion callback *only* */
-void bgp_info_reap(struct bgp_node *rn, struct bgp_info *ri)
+void bgp_path_info_reap(struct bgp_node *rn, struct bgp_path_info *pi)
{
- if (ri->next)
- ri->next->prev = ri->prev;
- if (ri->prev)
- ri->prev->next = ri->next;
+ if (pi->next)
+ pi->next->prev = pi->prev;
+ if (pi->prev)
+ pi->prev->next = pi->next;
else
- rn->info = ri->next;
+ rn->info = pi->next;
- bgp_info_mpath_dequeue(ri);
- bgp_info_unlock(ri);
+ bgp_path_info_mpath_dequeue(pi);
+ bgp_path_info_unlock(pi);
bgp_unlock_node(rn);
}
-void bgp_info_delete(struct bgp_node *rn, struct bgp_info *ri)
+void bgp_path_info_delete(struct bgp_node *rn, struct bgp_path_info *pi)
{
- bgp_info_set_flag(rn, ri, BGP_INFO_REMOVED);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_REMOVED);
/* set of previous already took care of pcount */
- UNSET_FLAG(ri->flags, BGP_INFO_VALID);
+ UNSET_FLAG(pi->flags, BGP_PATH_VALID);
}
-/* undo the effects of a previous call to bgp_info_delete; typically
+/* undo the effects of a previous call to bgp_path_info_delete; typically
called when a route is deleted and then quickly re-added before the
deletion has been processed */
-void bgp_info_restore(struct bgp_node *rn, struct bgp_info *ri)
+void bgp_path_info_restore(struct bgp_node *rn, struct bgp_path_info *pi)
{
- bgp_info_unset_flag(rn, ri, BGP_INFO_REMOVED);
+ bgp_path_info_unset_flag(rn, pi, BGP_PATH_REMOVED);
/* unset of previous already took care of pcount */
- SET_FLAG(ri->flags, BGP_INFO_VALID);
+ SET_FLAG(pi->flags, BGP_PATH_VALID);
}
/* Adjust pcount as required */
-static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_info *ri)
+static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_path_info *pi)
{
struct bgp_table *table;
assert(rn && bgp_node_table(rn));
- assert(ri && ri->peer && ri->peer->bgp);
+ assert(pi && pi->peer && pi->peer->bgp);
table = bgp_node_table(rn);
- if (ri->peer == ri->peer->bgp->peer_self)
+ if (pi->peer == pi->peer->bgp->peer_self)
return;
- if (!BGP_INFO_COUNTABLE(ri)
- && CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
+ if (!BGP_PATH_COUNTABLE(pi)
+ && CHECK_FLAG(pi->flags, BGP_PATH_COUNTED)) {
- UNSET_FLAG(ri->flags, BGP_INFO_COUNTED);
+ UNSET_FLAG(pi->flags, BGP_PATH_COUNTED);
/* slight hack, but more robust against errors. */
- if (ri->peer->pcount[table->afi][table->safi])
- ri->peer->pcount[table->afi][table->safi]--;
+ if (pi->peer->pcount[table->afi][table->safi])
+ pi->peer->pcount[table->afi][table->safi]--;
else
flog_err(EC_LIB_DEVELOPMENT,
"Asked to decrement 0 prefix count for peer");
- } else if (BGP_INFO_COUNTABLE(ri)
- && !CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
- SET_FLAG(ri->flags, BGP_INFO_COUNTED);
- ri->peer->pcount[table->afi][table->safi]++;
+ } else if (BGP_PATH_COUNTABLE(pi)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_COUNTED)) {
+ SET_FLAG(pi->flags, BGP_PATH_COUNTED);
+ pi->peer->pcount[table->afi][table->safi]++;
}
}
-static int bgp_label_index_differs(struct bgp_info *ri1, struct bgp_info *ri2)
+static int bgp_label_index_differs(struct bgp_path_info *pi1,
+ struct bgp_path_info *pi2)
{
- return (!(ri1->attr->label_index == ri2->attr->label_index));
+ return (!(pi1->attr->label_index == pi2->attr->label_index));
}
-/* Set/unset bgp_info flags, adjusting any other state as needed.
+/* Set/unset bgp_path_info flags, adjusting any other state as needed.
* This is here primarily to keep prefix-count in check.
*/
-void bgp_info_set_flag(struct bgp_node *rn, struct bgp_info *ri, uint32_t flag)
+void bgp_path_info_set_flag(struct bgp_node *rn, struct bgp_path_info *pi,
+ uint32_t flag)
{
- SET_FLAG(ri->flags, flag);
+ SET_FLAG(pi->flags, flag);
/* early bath if we know it's not a flag that changes countability state
*/
if (!CHECK_FLAG(flag,
- BGP_INFO_VALID | BGP_INFO_HISTORY | BGP_INFO_REMOVED))
+ BGP_PATH_VALID | BGP_PATH_HISTORY | BGP_PATH_REMOVED))
return;
- bgp_pcount_adjust(rn, ri);
+ bgp_pcount_adjust(rn, pi);
}
-void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_info *ri,
- uint32_t flag)
+void bgp_path_info_unset_flag(struct bgp_node *rn, struct bgp_path_info *pi,
+ uint32_t flag)
{
- UNSET_FLAG(ri->flags, flag);
+ UNSET_FLAG(pi->flags, flag);
/* early bath if we know it's not a flag that changes countability state
*/
if (!CHECK_FLAG(flag,
- BGP_INFO_VALID | BGP_INFO_HISTORY | BGP_INFO_REMOVED))
+ BGP_PATH_VALID | BGP_PATH_HISTORY | BGP_PATH_REMOVED))
return;
- bgp_pcount_adjust(rn, ri);
+ bgp_pcount_adjust(rn, pi);
}
/* Get MED value. If MED value is missing and "bgp bestpath
@@ -413,21 +416,21 @@ static uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp)
}
}
-void bgp_info_path_with_addpath_rx_str(struct bgp_info *ri, char *buf)
+void bgp_path_info_path_with_addpath_rx_str(struct bgp_path_info *pi, char *buf)
{
- if (ri->addpath_rx_id)
- sprintf(buf, "path %s (addpath rxid %d)", ri->peer->host,
- ri->addpath_rx_id);
+ if (pi->addpath_rx_id)
+ sprintf(buf, "path %s (addpath rxid %d)", pi->peer->host,
+ pi->addpath_rx_id);
else
- sprintf(buf, "path %s", ri->peer->host);
+ sprintf(buf, "path %s", pi->peer->host);
}
/* Compare two bgp route entity. If 'new' is preferable over 'exist' return 1.
*/
-static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
- struct bgp_info *exist, int *paths_eq,
- struct bgp_maxpaths_cfg *mpath_cfg, int debug,
- char *pfx_buf, afi_t afi, safi_t safi)
+static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
+ struct bgp_path_info *exist, int *paths_eq,
+ struct bgp_maxpaths_cfg *mpath_cfg, int debug,
+ char *pfx_buf, afi_t afi, safi_t safi)
{
struct attr *newattr, *existattr;
bgp_peer_sort_t new_sort;
@@ -461,7 +464,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
}
if (debug)
- bgp_info_path_with_addpath_rx_str(new, new_buf);
+ bgp_path_info_path_with_addpath_rx_str(new, new_buf);
if (exist == NULL) {
if (debug)
@@ -471,7 +474,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
}
if (debug) {
- bgp_info_path_with_addpath_rx_str(exist, exist_buf);
+ bgp_path_info_path_with_addpath_rx_str(exist, exist_buf);
zlog_debug("%s: Comparing %s flags 0x%x with %s flags 0x%x",
pfx_buf, new_buf, new->flags, exist_buf,
exist->flags);
@@ -499,9 +502,10 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
prefix2str(&new->net->p, pfx_buf,
sizeof(*pfx_buf)
* PREFIX2STR_BUFFER);
- bgp_info_path_with_addpath_rx_str(new, new_buf);
- bgp_info_path_with_addpath_rx_str(exist,
- exist_buf);
+ bgp_path_info_path_with_addpath_rx_str(new,
+ new_buf);
+ bgp_path_info_path_with_addpath_rx_str(
+ exist, exist_buf);
}
if (newattr->sticky && !existattr->sticky) {
@@ -896,7 +900,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
preferred route based on the additional decision criteria below. */
if (!bgp_flag_check(bgp, BGP_FLAG_COMPARE_ROUTER_ID)
&& new_sort == BGP_PEER_EBGP && exist_sort == BGP_PEER_EBGP) {
- if (CHECK_FLAG(new->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(new->flags, BGP_PATH_SELECTED)) {
if (debug)
zlog_debug(
"%s: %s wins over %s due to oldest external",
@@ -904,7 +908,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
return 1;
}
- if (CHECK_FLAG(exist->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(exist->flags, BGP_PATH_SELECTED)) {
if (debug)
zlog_debug(
"%s: %s loses to %s due to oldest external",
@@ -969,7 +973,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
/* Do this only if neither path is "stale" as stale paths do not have
* valid peer information (as the connection may or may not be up).
*/
- if (CHECK_FLAG(exist->flags, BGP_INFO_STALE)) {
+ if (CHECK_FLAG(exist->flags, BGP_PATH_STALE)) {
if (debug)
zlog_debug(
"%s: %s wins over %s due to latter path being STALE",
@@ -977,7 +981,7 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
return 1;
}
- if (CHECK_FLAG(new->flags, BGP_INFO_STALE)) {
+ if (CHECK_FLAG(new->flags, BGP_PATH_STALE)) {
if (debug)
zlog_debug(
"%s: %s loses to %s due to former path being STALE",
@@ -1020,14 +1024,14 @@ static int bgp_info_cmp(struct bgp *bgp, struct bgp_info *new,
* is preferred, or 0 if they are the same (usually will only occur if
* multipath is enabled
* This version is compatible with */
-int bgp_info_cmp_compatible(struct bgp *bgp, struct bgp_info *new,
- struct bgp_info *exist, char *pfx_buf, afi_t afi,
- safi_t safi)
+int bgp_path_info_cmp_compatible(struct bgp *bgp, struct bgp_path_info *new,
+ struct bgp_path_info *exist, char *pfx_buf,
+ afi_t afi, safi_t safi)
{
int paths_eq;
int ret;
- ret = bgp_info_cmp(bgp, new, exist, &paths_eq, NULL, 0, pfx_buf, afi,
- safi);
+ ret = bgp_path_info_cmp(bgp, new, exist, &paths_eq, NULL, 0, pfx_buf,
+ afi, safi);
if (paths_eq)
ret = 0;
@@ -1164,7 +1168,7 @@ static int bgp_input_modifier(struct peer *peer, struct prefix *p,
const char *rmap_name)
{
struct bgp_filter *filter;
- struct bgp_info info;
+ struct bgp_path_info rmap_path;
route_map_result_t ret;
struct route_map *rmap = NULL;
@@ -1190,15 +1194,15 @@ static int bgp_input_modifier(struct peer *peer, struct prefix *p,
/* Route map apply. */
if (rmap) {
- memset(&info, 0, sizeof(struct bgp_info));
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
/* Duplicate current value to new strucutre for modification. */
- info.peer = peer;
- info.attr = attr;
+ rmap_path.peer = peer;
+ rmap_path.attr = attr;
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN);
/* Apply BGP route map to the attribute. */
- ret = route_map_apply(rmap, p, RMAP_BGP, &info);
+ ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path);
peer->rmap_type = 0;
@@ -1212,7 +1216,7 @@ static int bgp_output_modifier(struct peer *peer, struct prefix *p,
struct attr *attr, afi_t afi, safi_t safi,
const char *rmap_name)
{
- struct bgp_info info;
+ struct bgp_path_info rmap_path;
route_map_result_t ret;
struct route_map *rmap = NULL;
uint8_t rmap_type;
@@ -1239,17 +1243,17 @@ static int bgp_output_modifier(struct peer *peer, struct prefix *p,
if (rmap == NULL)
return RMAP_DENY;
- memset(&info, 0, sizeof(struct bgp_info));
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
/* Route map apply. */
/* Duplicate current value to new strucutre for modification. */
- info.peer = peer;
- info.attr = attr;
+ rmap_path.peer = peer;
+ rmap_path.attr = attr;
rmap_type = peer->rmap_type;
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT);
/* Apply BGP route map to the attribute. */
- ret = route_map_apply(rmap, p, RMAP_BGP, &info);
+ ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path);
peer->rmap_type = rmap_type;
@@ -1372,7 +1376,7 @@ static void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr)
memset(&attr->mp_nexthop_global_in, 0, BGP_ATTR_NHLEN_IPV4);
}
-int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
+int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
struct update_subgroup *subgrp, struct prefix *p,
struct attr *attr)
{
@@ -1381,7 +1385,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
struct peer *peer;
struct peer *onlypeer;
struct bgp *bgp;
- struct attr *riattr;
+ struct attr *piattr;
char buf[PREFIX_STRLEN];
int ret;
int transparent;
@@ -1400,15 +1404,16 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
if (CHECK_FLAG(peer->flags, PEER_FLAG_LONESOUL))
onlypeer = SUBGRP_PFIRST(subgrp)->peer;
- from = ri->peer;
+ from = pi->peer;
filter = &peer->filter[afi][safi];
bgp = SUBGRP_INST(subgrp);
- riattr = bgp_info_mpath_count(ri) ? bgp_info_mpath_attr(ri) : ri->attr;
+ piattr = bgp_path_info_mpath_count(pi) ? bgp_path_info_mpath_attr(pi)
+ : pi->attr;
#if ENABLE_BGP_VNC
if (((afi == AFI_IP) || (afi == AFI_IP6)) && (safi == SAFI_MPLS_VPN)
- && ((ri->type == ZEBRA_ROUTE_BGP_DIRECT)
- || (ri->type == ZEBRA_ROUTE_BGP_DIRECT_EXT))) {
+ && ((pi->type == ZEBRA_ROUTE_BGP_DIRECT)
+ || (pi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT))) {
/*
* direct and direct_ext type routes originate internally even
@@ -1424,8 +1429,8 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
if (((afi == AFI_IP) || (afi == AFI_IP6))
&& ((safi == SAFI_MPLS_VPN) || (safi == SAFI_UNICAST))
- && (ri->type == ZEBRA_ROUTE_BGP)
- && (ri->sub_type == BGP_ROUTE_IMPORTED)) {
+ && (pi->type == ZEBRA_ROUTE_BGP)
+ && (pi->sub_type == BGP_ROUTE_IMPORTED)) {
/* Applies to routes leaked vpn->vrf and vrf->vpn */
@@ -1433,24 +1438,24 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
}
/* With addpath we may be asked to TX all kinds of paths so make sure
- * ri is valid */
- if (!CHECK_FLAG(ri->flags, BGP_INFO_VALID)
- || CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)
- || CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) {
+ * pi is valid */
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID)
+ || CHECK_FLAG(pi->flags, BGP_PATH_HISTORY)
+ || CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
return 0;
}
/* If this is not the bestpath then check to see if there is an enabled
* addpath
* feature that requires us to advertise it */
- if (!CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) {
- if (!bgp_addpath_tx_path(peer, afi, safi, ri)) {
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
+ if (!bgp_addpath_tx_path(peer, afi, safi, pi)) {
return 0;
}
}
/* Aggregate-address suppress check. */
- if (ri->extra && ri->extra->suppress)
+ if (pi->extra && pi->extra->suppress)
if (!UNSUPPRESS_MAP_NAME(filter)) {
return 0;
}
@@ -1461,13 +1466,13 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
* off box as that the RT and RD created are localy
* significant and globaly useless.
*/
- if (safi == SAFI_MPLS_VPN && ri->extra && ri->extra->num_labels
- && ri->extra->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
+ if (safi == SAFI_MPLS_VPN && pi->extra && pi->extra->num_labels
+ && pi->extra->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
return 0;
/* If it's labeled safi, make sure the route has a valid label. */
if (safi == SAFI_LABELED_UNICAST) {
- mpls_label_t label = bgp_adv_label(rn, ri, peer, afi, safi);
+ mpls_label_t label = bgp_adv_label(rn, pi, peer, afi, safi);
if (!bgp_is_valid_label(&label)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug("u%" PRIu64 ":s%" PRIu64
@@ -1503,7 +1508,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
transparent = 0;
/* If community is not disabled check the no-export and local. */
- if (!transparent && bgp_community_filter(peer, riattr)) {
+ if (!transparent && bgp_community_filter(peer, piattr)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
"subgrpannouncecheck: community filter check fail");
@@ -1512,8 +1517,8 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
/* If the attribute has originator-id and it is same as remote
peer's id. */
- if (onlypeer && riattr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)
- && (IPV4_ADDR_SAME(&onlypeer->remote_id, &riattr->originator_id))) {
+ if (onlypeer && piattr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)
+ && (IPV4_ADDR_SAME(&onlypeer->remote_id, &piattr->originator_id))) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
"%s [Update:SEND] %s originator-id is same as "
@@ -1543,7 +1548,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
}
/* Output filter check. */
- if (bgp_output_filter(peer, p, riattr, afi, safi) == FILTER_DENY) {
+ if (bgp_output_filter(peer, p, piattr, afi, safi) == FILTER_DENY) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug("%s [Update:SEND] %s is filtered",
peer->host, prefix2str(p, buf, sizeof(buf)));
@@ -1552,7 +1557,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
#ifdef BGP_SEND_ASPATH_CHECK
/* AS path loop check. */
- if (onlypeer && aspath_loop_check(riattr->aspath, onlypeer->as)) {
+ if (onlypeer && aspath_loop_check(piattr->aspath, onlypeer->as)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
"%s [Update:SEND] suppress announcement to peer AS %u "
@@ -1564,7 +1569,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
/* If we're a CONFED we need to loop check the CONFED ID too */
if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) {
- if (aspath_loop_check(riattr->aspath, bgp->confed_id)) {
+ if (aspath_loop_check(piattr->aspath, bgp->confed_id)) {
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
"%s [Update:SEND] suppress announcement to peer AS %u"
@@ -1604,7 +1609,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
}
/* For modify attribute, copy it to temporary structure. */
- bgp_attr_dup(attr, riattr);
+ bgp_attr_dup(attr, piattr);
/* If local-preference is not set. */
if ((peer->sort == BGP_PEER_IBGP || peer->sort == BGP_PEER_CONFED)
@@ -1694,19 +1699,19 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
bgp_peer_as_override(bgp, afi, safi, peer, attr);
/* Route map & unsuppress-map apply. */
- if (ROUTE_MAP_OUT_NAME(filter) || (ri->extra && ri->extra->suppress)) {
- struct bgp_info info;
- struct bgp_info_extra dummy_info_extra;
+ if (ROUTE_MAP_OUT_NAME(filter) || (pi->extra && pi->extra->suppress)) {
+ struct bgp_path_info rmap_path;
+ struct bgp_path_info_extra dummy_rmap_path_extra;
struct attr dummy_attr;
- memset(&info, 0, sizeof(struct bgp_info));
- info.peer = peer;
- info.attr = attr;
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ rmap_path.peer = peer;
+ rmap_path.attr = attr;
- if (ri->extra) {
- memcpy(&dummy_info_extra, ri->extra,
- sizeof(struct bgp_info_extra));
- info.extra = &dummy_info_extra;
+ if (pi->extra) {
+ memcpy(&dummy_rmap_path_extra, pi->extra,
+ sizeof(struct bgp_path_info_extra));
+ rmap_path.extra = &dummy_rmap_path_extra;
}
/* don't confuse inbound and outbound setting */
@@ -1720,17 +1725,17 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
&& !bgp_flag_check(bgp,
BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
bgp_attr_dup(&dummy_attr, attr);
- info.attr = &dummy_attr;
+ rmap_path.attr = &dummy_attr;
}
SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT);
- if (ri->extra && ri->extra->suppress)
+ if (pi->extra && pi->extra->suppress)
ret = route_map_apply(UNSUPPRESS_MAP(filter), p,
- RMAP_BGP, &info);
+ RMAP_BGP, &rmap_path);
else
ret = route_map_apply(ROUTE_MAP_OUT(filter), p,
- RMAP_BGP, &info);
+ RMAP_BGP, &rmap_path);
peer->rmap_type = 0;
@@ -1769,7 +1774,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
* it is configured as 'peer-address'.
*/
if (!bgp_rmap_nhop_changed(attr->rmap_change_flags,
- riattr->rmap_change_flags)
+ piattr->rmap_change_flags)
&& !transparent
&& !CHECK_FLAG(peer->af_flags[afi][safi],
PEER_FLAG_NEXTHOP_UNCHANGED)) {
@@ -1794,14 +1799,14 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
* Note: 3rd party nexthop currently implemented for
* IPv4 only.
*/
- if (!bgp_subgrp_multiaccess_check_v4(riattr->nexthop,
+ if (!bgp_subgrp_multiaccess_check_v4(piattr->nexthop,
subgrp))
subgroup_announce_reset_nhop(
(peer_cap_enhe(peer, afi, safi)
? AF_INET6
: p->family),
attr);
- } else if (CHECK_FLAG(ri->flags, BGP_INFO_ANNC_NH_SELF)) {
+ } else if (CHECK_FLAG(pi->flags, BGP_PATH_ANNC_NH_SELF)) {
/*
* This flag is used for leaked vpn-vrf routes
*/
@@ -1812,7 +1817,7 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
zlog_debug(
- "%s: BGP_INFO_ANNC_NH_SELF, family=%s",
+ "%s: BGP_PATH_ANNC_NH_SELF, family=%s",
__func__, family2str(family));
subgroup_announce_reset_nhop(family, attr);
}
@@ -1836,14 +1841,15 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
struct bgp_maxpaths_cfg *mpath_cfg,
- struct bgp_info_pair *result, afi_t afi, safi_t safi)
-{
- struct bgp_info *new_select;
- struct bgp_info *old_select;
- struct bgp_info *ri;
- struct bgp_info *ri1;
- struct bgp_info *ri2;
- struct bgp_info *nextri = NULL;
+ struct bgp_path_info_pair *result, afi_t afi,
+ safi_t safi)
+{
+ struct bgp_path_info *new_select;
+ struct bgp_path_info *old_select;
+ struct bgp_path_info *pi;
+ struct bgp_path_info *pi1;
+ struct bgp_path_info *pi2;
+ struct bgp_path_info *nextpi = NULL;
int paths_eq, do_mpath, debug;
struct list mp_list;
char pfx_buf[PREFIX2STR_BUFFER];
@@ -1862,66 +1868,66 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
new_select = NULL;
if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) {
- /* Clear BGP_INFO_DMED_SELECTED for all paths */
- for (ri1 = rn->info; ri1; ri1 = ri1->next)
- bgp_info_unset_flag(rn, ri1, BGP_INFO_DMED_SELECTED);
+ /* Clear BGP_PATH_DMED_SELECTED for all paths */
+ for (pi1 = rn->info; pi1; pi1 = pi1->next)
+ bgp_path_info_unset_flag(rn, pi1,
+ BGP_PATH_DMED_SELECTED);
- for (ri1 = rn->info; ri1; ri1 = ri1->next) {
- if (CHECK_FLAG(ri1->flags, BGP_INFO_DMED_CHECK))
+ for (pi1 = rn->info; pi1; pi1 = pi1->next) {
+ if (CHECK_FLAG(pi1->flags, BGP_PATH_DMED_CHECK))
continue;
- if (BGP_INFO_HOLDDOWN(ri1))
+ if (BGP_PATH_HOLDDOWN(pi1))
continue;
- if (ri1->peer && ri1->peer != bgp->peer_self)
- if (ri1->peer->status != Established)
+ if (pi1->peer && pi1->peer != bgp->peer_self)
+ if (pi1->peer->status != Established)
continue;
- new_select = ri1;
- if (ri1->next) {
- for (ri2 = ri1->next; ri2; ri2 = ri2->next) {
- if (CHECK_FLAG(ri2->flags,
- BGP_INFO_DMED_CHECK))
+ new_select = pi1;
+ if (pi1->next) {
+ for (pi2 = pi1->next; pi2; pi2 = pi2->next) {
+ if (CHECK_FLAG(pi2->flags,
+ BGP_PATH_DMED_CHECK))
continue;
- if (BGP_INFO_HOLDDOWN(ri2))
+ if (BGP_PATH_HOLDDOWN(pi2))
continue;
- if (ri2->peer
- && ri2->peer != bgp->peer_self
+ if (pi2->peer
+ && pi2->peer != bgp->peer_self
&& !CHECK_FLAG(
- ri2->peer->sflags,
+ pi2->peer->sflags,
PEER_STATUS_NSF_WAIT))
- if (ri2->peer->status
+ if (pi2->peer->status
!= Established)
continue;
- if (aspath_cmp_left(ri1->attr->aspath,
- ri2->attr->aspath)
- || aspath_cmp_left_confed(
- ri1->attr->aspath,
- ri2->attr->aspath)) {
- if (bgp_info_cmp(bgp, ri2,
- new_select,
- &paths_eq,
- mpath_cfg,
- debug, pfx_buf,
- afi, safi)) {
- bgp_info_unset_flag(
- rn, new_select,
- BGP_INFO_DMED_SELECTED);
- new_select = ri2;
- }
+ if (!aspath_cmp_left(pi1->attr->aspath,
+ pi2->attr->aspath)
+ && !aspath_cmp_left_confed(
+ pi1->attr->aspath,
+ pi2->attr->aspath))
+ continue;
- bgp_info_set_flag(
- rn, ri2,
- BGP_INFO_DMED_CHECK);
+ if (bgp_path_info_cmp(
+ bgp, pi2, new_select,
+ &paths_eq, mpath_cfg, debug,
+ pfx_buf, afi, safi)) {
+ bgp_path_info_unset_flag(
+ rn, new_select,
+ BGP_PATH_DMED_SELECTED);
+ new_select = pi2;
}
+
+ bgp_path_info_set_flag(
+ rn, pi2, BGP_PATH_DMED_CHECK);
}
}
- bgp_info_set_flag(rn, new_select, BGP_INFO_DMED_CHECK);
- bgp_info_set_flag(rn, new_select,
- BGP_INFO_DMED_SELECTED);
+ bgp_path_info_set_flag(rn, new_select,
+ BGP_PATH_DMED_CHECK);
+ bgp_path_info_set_flag(rn, new_select,
+ BGP_PATH_DMED_SELECTED);
if (debug) {
- bgp_info_path_with_addpath_rx_str(new_select,
- path_buf);
+ bgp_path_info_path_with_addpath_rx_str(
+ new_select, path_buf);
zlog_debug("%s: %s is the bestpath from AS %u",
pfx_buf, path_buf,
aspath_get_first_as(
@@ -1933,51 +1939,51 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
/* Check old selected route and new selected route. */
old_select = NULL;
new_select = NULL;
- for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
- ri = nextri) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED))
- old_select = ri;
+ for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
+ pi = nextpi) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))
+ old_select = pi;
- if (BGP_INFO_HOLDDOWN(ri)) {
+ if (BGP_PATH_HOLDDOWN(pi)) {
/* reap REMOVED routes, if needs be
* selected route must stay for a while longer though
*/
- if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)
- && (ri != old_select))
- bgp_info_reap(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
+ && (pi != old_select))
+ bgp_path_info_reap(rn, pi);
if (debug)
- zlog_debug("%s: ri %p in holddown", __func__,
- ri);
+ zlog_debug("%s: pi %p in holddown", __func__,
+ pi);
continue;
}
- if (ri->peer && ri->peer != bgp->peer_self
- && !CHECK_FLAG(ri->peer->sflags, PEER_STATUS_NSF_WAIT))
- if (ri->peer->status != Established) {
+ if (pi->peer && pi->peer != bgp->peer_self
+ && !CHECK_FLAG(pi->peer->sflags, PEER_STATUS_NSF_WAIT))
+ if (pi->peer->status != Established) {
if (debug)
zlog_debug(
- "%s: ri %p non self peer %s not estab state",
- __func__, ri, ri->peer->host);
+ "%s: pi %p non self peer %s not estab state",
+ __func__, pi, pi->peer->host);
continue;
}
if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)
- && (!CHECK_FLAG(ri->flags, BGP_INFO_DMED_SELECTED))) {
- bgp_info_unset_flag(rn, ri, BGP_INFO_DMED_CHECK);
+ && (!CHECK_FLAG(pi->flags, BGP_PATH_DMED_SELECTED))) {
+ bgp_path_info_unset_flag(rn, pi, BGP_PATH_DMED_CHECK);
if (debug)
- zlog_debug("%s: ri %p dmed", __func__, ri);
+ zlog_debug("%s: pi %p dmed", __func__, pi);
continue;
}
- bgp_info_unset_flag(rn, ri, BGP_INFO_DMED_CHECK);
+ bgp_path_info_unset_flag(rn, pi, BGP_PATH_DMED_CHECK);
- if (bgp_info_cmp(bgp, ri, new_select, &paths_eq, mpath_cfg,
- debug, pfx_buf, afi, safi)) {
- new_select = ri;
+ if (bgp_path_info_cmp(bgp, pi, new_select, &paths_eq, mpath_cfg,
+ debug, pfx_buf, afi, safi)) {
+ new_select = pi;
}
}
@@ -1987,7 +1993,8 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
*/
if (debug) {
if (new_select)
- bgp_info_path_with_addpath_rx_str(new_select, path_buf);
+ bgp_path_info_path_with_addpath_rx_str(new_select,
+ path_buf);
else
sprintf(path_buf, "NONE");
zlog_debug(
@@ -1997,31 +2004,32 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
}
if (do_mpath && new_select) {
- for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1);
- ri = nextri) {
+ for (pi = rn->info; (pi != NULL) && (nextpi = pi->next, 1);
+ pi = nextpi) {
if (debug)
- bgp_info_path_with_addpath_rx_str(ri, path_buf);
+ bgp_path_info_path_with_addpath_rx_str(
+ pi, path_buf);
- if (ri == new_select) {
+ if (pi == new_select) {
if (debug)
zlog_debug(
"%s: %s is the bestpath, add to the multipath list",
pfx_buf, path_buf);
- bgp_mp_list_add(&mp_list, ri);
+ bgp_mp_list_add(&mp_list, pi);
continue;
}
- if (BGP_INFO_HOLDDOWN(ri))
+ if (BGP_PATH_HOLDDOWN(pi))
continue;
- if (ri->peer && ri->peer != bgp->peer_self
- && !CHECK_FLAG(ri->peer->sflags,
+ if (pi->peer && pi->peer != bgp->peer_self
+ && !CHECK_FLAG(pi->peer->sflags,
PEER_STATUS_NSF_WAIT))
- if (ri->peer->status != Established)
+ if (pi->peer->status != Established)
continue;
- if (!bgp_info_nexthop_cmp(ri, new_select)) {
+ if (!bgp_path_info_nexthop_cmp(pi, new_select)) {
if (debug)
zlog_debug(
"%s: %s has the same nexthop as the bestpath, skip it",
@@ -2029,21 +2037,22 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
continue;
}
- bgp_info_cmp(bgp, ri, new_select, &paths_eq, mpath_cfg,
- debug, pfx_buf, afi, safi);
+ bgp_path_info_cmp(bgp, pi, new_select, &paths_eq,
+ mpath_cfg, debug, pfx_buf, afi, safi);
if (paths_eq) {
if (debug)
zlog_debug(
"%s: %s is equivalent to the bestpath, add to the multipath list",
pfx_buf, path_buf);
- bgp_mp_list_add(&mp_list, ri);
+ bgp_mp_list_add(&mp_list, pi);
}
}
}
- bgp_info_mpath_update(rn, new_select, old_select, &mp_list, mpath_cfg);
- bgp_info_mpath_aggregate_update(new_select, old_select);
+ bgp_path_info_mpath_update(rn, new_select, old_select, &mp_list,
+ mpath_cfg);
+ bgp_path_info_mpath_aggregate_update(new_select, old_select);
bgp_mp_list_clear(&mp_list);
result->old = old_select;
@@ -2057,7 +2066,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
* for advertisement to the subgroup.
*/
int subgroup_process_announce_selected(struct update_subgroup *subgrp,
- struct bgp_info *selected,
+ struct bgp_path_info *selected,
struct bgp_node *rn,
uint32_t addpath_tx_id)
{
@@ -2112,13 +2121,13 @@ int subgroup_process_announce_selected(struct update_subgroup *subgrp,
*/
void bgp_zebra_clear_route_change_flags(struct bgp_node *rn)
{
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
- for (ri = rn->info; ri; ri = ri->next) {
- if (BGP_INFO_HOLDDOWN(ri))
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (BGP_PATH_HOLDDOWN(pi))
continue;
- UNSET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED);
- UNSET_FLAG(ri->flags, BGP_INFO_ATTR_CHANGED);
+ UNSET_FLAG(pi->flags, BGP_PATH_IGP_CHANGED);
+ UNSET_FLAG(pi->flags, BGP_PATH_ATTR_CHANGED);
}
}
@@ -2127,9 +2136,10 @@ void bgp_zebra_clear_route_change_flags(struct bgp_node *rn)
* if the route selection returns the same best route as earlier - to
* determine if we need to update zebra or not.
*/
-int bgp_zebra_has_route_changed(struct bgp_node *rn, struct bgp_info *selected)
+int bgp_zebra_has_route_changed(struct bgp_node *rn,
+ struct bgp_path_info *selected)
{
- struct bgp_info *mpinfo;
+ struct bgp_path_info *mpinfo;
/* If this is multipath, check all selected paths for any nexthop
* change or attribute change. Some attribute changes (e.g., community)
@@ -2137,17 +2147,17 @@ int bgp_zebra_has_route_changed(struct bgp_node *rn, struct bgp_info *selected)
* we handle the case of BGP nexthop change. This is the behavior
* when the best path has an attribute change anyway.
*/
- if (CHECK_FLAG(selected->flags, BGP_INFO_IGP_CHANGED)
- || CHECK_FLAG(selected->flags, BGP_INFO_MULTIPATH_CHG))
+ if (CHECK_FLAG(selected->flags, BGP_PATH_IGP_CHANGED)
+ || CHECK_FLAG(selected->flags, BGP_PATH_MULTIPATH_CHG))
return 1;
/*
* If this is multipath, check all selected paths for any nexthop change
*/
- for (mpinfo = bgp_info_mpath_first(selected); mpinfo;
- mpinfo = bgp_info_mpath_next(mpinfo)) {
- if (CHECK_FLAG(mpinfo->flags, BGP_INFO_IGP_CHANGED)
- || CHECK_FLAG(mpinfo->flags, BGP_INFO_ATTR_CHANGED))
+ for (mpinfo = bgp_path_info_mpath_first(selected); mpinfo;
+ mpinfo = bgp_path_info_mpath_next(mpinfo)) {
+ if (CHECK_FLAG(mpinfo->flags, BGP_PATH_IGP_CHANGED)
+ || CHECK_FLAG(mpinfo->flags, BGP_PATH_ATTR_CHANGED))
return 1;
}
@@ -2185,9 +2195,9 @@ struct bgp_process_queue {
static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
afi_t afi, safi_t safi)
{
- struct bgp_info *new_select;
- struct bgp_info *old_select;
- struct bgp_info_pair old_and_new;
+ struct bgp_path_info *new_select;
+ struct bgp_path_info *old_select;
+ struct bgp_path_info_pair old_and_new;
char pfx_buf[PREFIX2STR_BUFFER];
int debug = 0;
@@ -2269,7 +2279,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
*/
if (old_select && old_select == new_select
&& !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR)
- && !CHECK_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED)
+ && !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
&& !bgp->addpath_tx_used[afi][safi]) {
if (bgp_zebra_has_route_changed(rn, old_select)) {
#if ENABLE_BGP_VNC
@@ -2288,12 +2298,12 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
bgp, afi, safi);
}
}
- UNSET_FLAG(old_select->flags, BGP_INFO_MULTIPATH_CHG);
+ UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG);
bgp_zebra_clear_route_change_flags(rn);
/* If there is a change of interest to peers, reannounce the
* route. */
- if (CHECK_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED)
+ if (CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
|| CHECK_FLAG(rn->flags, BGP_NODE_LABEL_CHANGED)) {
group_announce_route(bgp, afi, safi, rn, new_select);
@@ -2304,7 +2314,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
SAFI_LABELED_UNICAST, rn,
new_select);
- UNSET_FLAG(old_select->flags, BGP_INFO_ATTR_CHANGED);
+ UNSET_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED);
UNSET_FLAG(rn->flags, BGP_NODE_LABEL_CHANGED);
}
@@ -2331,13 +2341,13 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
}
if (old_select)
- bgp_info_unset_flag(rn, old_select, BGP_INFO_SELECTED);
+ bgp_path_info_unset_flag(rn, old_select, BGP_PATH_SELECTED);
if (new_select) {
if (debug)
zlog_debug("%s: setting SELECTED flag", __func__);
- bgp_info_set_flag(rn, new_select, BGP_INFO_SELECTED);
- bgp_info_unset_flag(rn, new_select, BGP_INFO_ATTR_CHANGED);
- UNSET_FLAG(new_select->flags, BGP_INFO_MULTIPATH_CHG);
+ bgp_path_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
+ bgp_path_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
+ UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG);
}
#if ENABLE_BGP_VNC
@@ -2424,9 +2434,9 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
/* Clear any route change flags. */
bgp_zebra_clear_route_change_flags(rn);
- /* Reap old select bgp_info, if it has been removed */
- if (old_select && CHECK_FLAG(old_select->flags, BGP_INFO_REMOVED))
- bgp_info_reap(rn, old_select);
+ /* Reap old select bgp_path_info, if it has been removed */
+ if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED))
+ bgp_path_info_reap(rn, old_select);
UNSET_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED);
return;
@@ -2669,29 +2679,29 @@ int bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
/* Unconditionally remove the route from the RIB, without taking
* damping into consideration (eg, because the session went down)
*/
-void bgp_rib_remove(struct bgp_node *rn, struct bgp_info *ri, struct peer *peer,
- afi_t afi, safi_t safi)
+void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *pi,
+ struct peer *peer, afi_t afi, safi_t safi)
{
- bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi, safi);
+ bgp_aggregate_decrement(peer->bgp, &rn->p, pi, afi, safi);
- if (!CHECK_FLAG(ri->flags, BGP_INFO_HISTORY))
- bgp_info_delete(rn, ri); /* keep historical info */
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_HISTORY))
+ bgp_path_info_delete(rn, pi); /* keep historical info */
bgp_process(peer->bgp, rn, afi, safi);
}
-static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_info *ri,
+static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *peer, afi_t afi, safi_t safi,
struct prefix_rd *prd)
{
/* apply dampening, if result is suppressed, we'll be retaining
- * the bgp_info in the RIB for historical reference.
+ * the bgp_path_info in the RIB for historical reference.
*/
if (CHECK_FLAG(peer->bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
&& peer->sort == BGP_PEER_EBGP)
- if ((bgp_damp_withdraw(ri, rn, afi, safi, 0))
+ if ((bgp_damp_withdraw(pi, rn, afi, safi, 0))
== BGP_DAMP_SUPPRESSED) {
- bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi,
+ bgp_aggregate_decrement(peer->bgp, &rn->p, pi, afi,
safi);
return;
}
@@ -2707,35 +2717,35 @@ static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_info *ri,
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
- peer->bgp, prd, table, &rn->p, ri);
+ peer->bgp, prd, table, &rn->p, pi);
}
bgp_unlock_node(prn);
}
if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
- vnc_import_bgp_del_route(peer->bgp, &rn->p, ri);
+ vnc_import_bgp_del_route(peer->bgp, &rn->p, pi);
vnc_import_bgp_exterior_del_route(peer->bgp, &rn->p,
- ri);
+ pi);
}
}
#endif
/* If this is an EVPN route, process for un-import. */
if (safi == SAFI_EVPN)
- bgp_evpn_unimport_route(peer->bgp, afi, safi, &rn->p, ri);
+ bgp_evpn_unimport_route(peer->bgp, afi, safi, &rn->p, pi);
- bgp_rib_remove(rn, ri, peer, afi, safi);
+ bgp_rib_remove(rn, pi, peer, afi, safi);
}
-struct bgp_info *info_make(int type, int sub_type, unsigned short instance,
- struct peer *peer, struct attr *attr,
- struct bgp_node *rn)
+struct bgp_path_info *info_make(int type, int sub_type, unsigned short instance,
+ struct peer *peer, struct attr *attr,
+ struct bgp_node *rn)
{
- struct bgp_info *new;
+ struct bgp_path_info *new;
/* Make new BGP info. */
- new = XCALLOC(MTYPE_BGP_ROUTE, sizeof(struct bgp_info));
+ new = XCALLOC(MTYPE_BGP_ROUTE, sizeof(struct bgp_path_info));
new->type = type;
new->instance = instance;
new->sub_type = sub_type;
@@ -2769,12 +2779,12 @@ static void overlay_index_update(struct attr *attr,
}
}
-static bool overlay_index_equal(afi_t afi, struct bgp_info *info,
+static bool overlay_index_equal(afi_t afi, struct bgp_path_info *path,
struct eth_segment_id *eth_s_id,
union gw_addr *gw_ip)
{
- struct eth_segment_id *info_eth_s_id, *info_eth_s_id_remote;
- union gw_addr *info_gw_ip, *info_gw_ip_remote;
+ struct eth_segment_id *path_eth_s_id, *path_eth_s_id_remote;
+ union gw_addr *path_gw_ip, *path_gw_ip_remote;
union {
struct eth_segment_id esi;
union gw_addr ip;
@@ -2782,34 +2792,34 @@ static bool overlay_index_equal(afi_t afi, struct bgp_info *info,
if (afi != AFI_L2VPN)
return true;
- if (!info->attr) {
+ if (!path->attr) {
memset(&temp, 0, sizeof(temp));
- info_eth_s_id = &temp.esi;
- info_gw_ip = &temp.ip;
+ path_eth_s_id = &temp.esi;
+ path_gw_ip = &temp.ip;
if (eth_s_id == NULL && gw_ip == NULL)
return true;
} else {
- info_eth_s_id = &(info->attr->evpn_overlay.eth_s_id);
- info_gw_ip = &(info->attr->evpn_overlay.gw_ip);
+ path_eth_s_id = &(path->attr->evpn_overlay.eth_s_id);
+ path_gw_ip = &(path->attr->evpn_overlay.gw_ip);
}
if (gw_ip == NULL) {
memset(&temp, 0, sizeof(temp));
- info_gw_ip_remote = &temp.ip;
+ path_gw_ip_remote = &temp.ip;
} else
- info_gw_ip_remote = gw_ip;
+ path_gw_ip_remote = gw_ip;
if (eth_s_id == NULL) {
memset(&temp, 0, sizeof(temp));
- info_eth_s_id_remote = &temp.esi;
+ path_eth_s_id_remote = &temp.esi;
} else
- info_eth_s_id_remote = eth_s_id;
+ path_eth_s_id_remote = eth_s_id;
- if (!memcmp(info_gw_ip, info_gw_ip_remote, sizeof(union gw_addr)))
+ if (!memcmp(path_gw_ip, path_gw_ip_remote, sizeof(union gw_addr)))
return false;
- return !memcmp(info_eth_s_id, info_eth_s_id_remote,
+ return !memcmp(path_eth_s_id, path_eth_s_id_remote,
sizeof(struct eth_segment_id));
}
@@ -2878,9 +2888,9 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
struct bgp *bgp;
struct attr new_attr;
struct attr *attr_new;
- struct bgp_info *ri;
- struct bgp_info *new;
- struct bgp_info_extra *extra;
+ struct bgp_path_info *pi;
+ struct bgp_path_info *new;
+ struct bgp_path_info_extra *extra;
const char *reason;
char pfx_buf[BGP_PRD_PATH_STRLEN];
int connected = 0;
@@ -2911,10 +2921,10 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
bgp_adj_in_set(rn, peer, attr, addpath_id);
/* Check previously received route. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == peer && ri->type == type
- && ri->sub_type == sub_type
- && ri->addpath_rx_id == addpath_id)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == peer && pi->type == type
+ && pi->sub_type == sub_type
+ && pi->addpath_rx_id == addpath_id)
break;
/* AS path local-as loop check. */
@@ -3014,24 +3024,24 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
attr_new = bgp_attr_intern(&new_attr);
/* If the update is implicit withdraw. */
- if (ri) {
- ri->uptime = bgp_clock();
- same_attr = attrhash_cmp(ri->attr, attr_new);
+ if (pi) {
+ pi->uptime = bgp_clock();
+ same_attr = attrhash_cmp(pi->attr, attr_new);
/* Same attribute comes in. */
- if (!CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)
- && attrhash_cmp(ri->attr, attr_new)
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
+ && attrhash_cmp(pi->attr, attr_new)
&& (!has_valid_label
- || memcmp(&(bgp_info_extra_get(ri))->label, label,
+ || memcmp(&(bgp_path_info_extra_get(pi))->label, label,
num_labels * sizeof(mpls_label_t))
== 0)
&& (overlay_index_equal(
- afi, ri, evpn == NULL ? NULL : &evpn->eth_s_id,
+ afi, pi, evpn == NULL ? NULL : &evpn->eth_s_id,
evpn == NULL ? NULL : &evpn->gw_ip))) {
if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING)
&& peer->sort == BGP_PEER_EBGP
- && CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)) {
+ && CHECK_FLAG(pi->flags, BGP_PATH_HISTORY)) {
if (bgp_debug_update(peer, p, NULL, 1)) {
bgp_debug_rdpfxpath2str(
afi, safi, prd, p, label,
@@ -3042,9 +3052,9 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
pfx_buf);
}
- if (bgp_damp_update(ri, rn, afi, safi)
+ if (bgp_damp_update(pi, rn, afi, safi)
!= BGP_DAMP_SUPPRESSED) {
- bgp_aggregate_increment(bgp, p, ri, afi,
+ bgp_aggregate_increment(bgp, p, pi, afi,
safi);
bgp_process(bgp, rn, afi, safi);
}
@@ -3070,9 +3080,9 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
}
/* graceful restart STALE flag unset. */
- if (CHECK_FLAG(ri->flags, BGP_INFO_STALE)) {
- bgp_info_unset_flag(rn, ri,
- BGP_INFO_STALE);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_STALE)) {
+ bgp_path_info_unset_flag(
+ rn, pi, BGP_PATH_STALE);
bgp_process(bgp, rn, afi, safi);
}
}
@@ -3084,7 +3094,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
}
/* Withdraw/Announce before we fully processed the withdraw */
- if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
if (bgp_debug_update(peer, p, NULL, 1)) {
bgp_debug_rdpfxpath2str(
afi, safi, prd, p, label, num_labels,
@@ -3095,7 +3105,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
peer->host, pfx_buf);
}
- bgp_info_restore(rn, ri);
+ bgp_path_info_restore(rn, pi);
}
/* Received Logging. */
@@ -3108,16 +3118,16 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
}
/* graceful restart STALE flag unset. */
- if (CHECK_FLAG(ri->flags, BGP_INFO_STALE))
- bgp_info_unset_flag(rn, ri, BGP_INFO_STALE);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_STALE))
+ bgp_path_info_unset_flag(rn, pi, BGP_PATH_STALE);
/* The attribute is changed. */
- bgp_info_set_flag(rn, ri, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_ATTR_CHANGED);
/* implicit withdraw, decrement aggregate and pcount here.
* only if update is accepted, they'll increment below.
*/
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
/* Update bgp route dampening information. */
if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
@@ -3125,8 +3135,8 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
/* This is implicit withdraw so we should update
dampening
information. */
- if (!CHECK_FLAG(ri->flags, BGP_INFO_HISTORY))
- bgp_damp_withdraw(ri, rn, afi, safi, 1);
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_HISTORY))
+ bgp_damp_withdraw(pi, rn, afi, safi, 1);
}
#if ENABLE_BGP_VNC
if (safi == SAFI_MPLS_VPN) {
@@ -3139,19 +3149,19 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, ri);
+ bgp, prd, table, p, pi);
}
bgp_unlock_node(prn);
}
if ((afi == AFI_IP || afi == AFI_IP6)
&& (safi == SAFI_UNICAST)) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
/*
* Implicit withdraw case.
*/
++vnc_implicit_withdraw;
- vnc_import_bgp_del_route(bgp, p, ri);
- vnc_import_bgp_exterior_del_route(bgp, p, ri);
+ vnc_import_bgp_del_route(bgp, p, pi);
+ vnc_import_bgp_exterior_del_route(bgp, p, pi);
}
}
#endif
@@ -3164,35 +3174,35 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
* community.
*/
if (safi == SAFI_EVPN && !same_attr) {
- if ((ri->attr->flag
+ if ((pi->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES))
&& (attr_new->flag
& ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES))) {
int cmp;
- cmp = ecommunity_cmp(ri->attr->ecommunity,
+ cmp = ecommunity_cmp(pi->attr->ecommunity,
attr_new->ecommunity);
if (!cmp) {
if (bgp_debug_update(peer, p, NULL, 1))
zlog_debug(
"Change in EXT-COMM, existing %s new %s",
ecommunity_str(
- ri->attr->ecommunity),
+ pi->attr->ecommunity),
ecommunity_str(
attr_new->ecommunity));
bgp_evpn_unimport_route(bgp, afi, safi,
- p, ri);
+ p, pi);
}
}
}
/* Update to new attribute. */
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
/* Update MPLS label */
if (has_valid_label) {
- extra = bgp_info_extra_get(ri);
+ extra = bgp_path_info_extra_get(pi);
memcpy(&extra->label, label,
num_labels * sizeof(mpls_label_t));
extra->num_labels = num_labels;
@@ -3217,15 +3227,15 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
* changes) which
* trigger re-importation of the entire RIB.
*/
- vnc_import_bgp_add_route(bgp, p, ri);
- vnc_import_bgp_exterior_add_route(bgp, p, ri);
+ vnc_import_bgp_add_route(bgp, p, pi);
+ vnc_import_bgp_exterior_add_route(bgp, p, pi);
}
}
#endif
/* Update Overlay Index */
if (afi == AFI_L2VPN) {
overlay_index_update(
- ri->attr, evpn == NULL ? NULL : &evpn->eth_s_id,
+ pi->attr, evpn == NULL ? NULL : &evpn->eth_s_id,
evpn == NULL ? NULL : &evpn->gw_ip);
}
@@ -3233,7 +3243,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)
&& peer->sort == BGP_PEER_EBGP) {
/* Now we do normal update dampening. */
- ret = bgp_damp_update(ri, rn, afi, safi);
+ ret = bgp_damp_update(pi, rn, afi, safi);
if (ret == BGP_DAMP_SUPPRESSED) {
bgp_unlock_node(rn);
return 0;
@@ -3255,13 +3265,13 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
struct bgp *bgp_nexthop = bgp;
- if (ri->extra && ri->extra->bgp_orig)
- bgp_nexthop = ri->extra->bgp_orig;
+ if (pi->extra && pi->extra->bgp_orig)
+ bgp_nexthop = pi->extra->bgp_orig;
- if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi,
- ri, NULL, connected)
+ if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi, pi,
+ NULL, connected)
|| CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD))
- bgp_info_set_flag(rn, ri, BGP_INFO_VALID);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {
char buf1[INET6_ADDRSTRLEN];
@@ -3272,10 +3282,11 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
zlog_debug("%s(%s): NH unresolved",
__FUNCTION__, buf1);
}
- bgp_info_unset_flag(rn, ri, BGP_INFO_VALID);
+ bgp_path_info_unset_flag(rn, pi,
+ BGP_PATH_VALID);
}
} else
- bgp_info_set_flag(rn, ri, BGP_INFO_VALID);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_VALID);
#if ENABLE_BGP_VNC
if (safi == SAFI_MPLS_VPN) {
@@ -3288,7 +3299,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, ri);
+ bgp, prd, table, p, pi);
}
bgp_unlock_node(prn);
}
@@ -3307,10 +3318,10 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
* the attributes for the route in the VNI(s).
*/
if (safi == SAFI_EVPN && !same_attr)
- bgp_evpn_import_route(bgp, afi, safi, p, ri);
+ bgp_evpn_import_route(bgp, afi, safi, p, pi);
/* Process change. */
- bgp_aggregate_increment(bgp, p, ri, afi, safi);
+ bgp_aggregate_increment(bgp, p, pi, afi, safi);
bgp_process(bgp, rn, afi, safi);
bgp_unlock_node(rn);
@@ -3319,12 +3330,12 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF
|| bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_from_vrf_update(bgp_get_default(), bgp, ri);
+ vpn_leak_from_vrf_update(bgp_get_default(), bgp, pi);
}
if ((SAFI_MPLS_VPN == safi)
&& (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_to_vrf_update(bgp, ri);
+ vpn_leak_to_vrf_update(bgp, pi);
}
#if ENABLE_BGP_VNC
@@ -3362,7 +3373,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
/* Update MPLS label */
if (has_valid_label) {
- extra = bgp_info_extra_get(new);
+ extra = bgp_path_info_extra_get(new);
memcpy(&extra->label, label, num_labels * sizeof(mpls_label_t));
extra->num_labels = num_labels;
if (!(afi == AFI_L2VPN && safi == SAFI_EVPN))
@@ -3388,7 +3399,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
if (bgp_find_or_add_nexthop(bgp, bgp, afi, new, NULL, connected)
|| CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD))
- bgp_info_set_flag(rn, new, BGP_INFO_VALID);
+ bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {
char buf1[INET6_ADDRSTRLEN];
@@ -3398,10 +3409,10 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
zlog_debug("%s(%s): NH unresolved",
__FUNCTION__, buf1);
}
- bgp_info_unset_flag(rn, new, BGP_INFO_VALID);
+ bgp_path_info_unset_flag(rn, new, BGP_PATH_VALID);
}
} else
- bgp_info_set_flag(rn, new, BGP_INFO_VALID);
+ bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
/* Addpath ID */
new->addpath_rx_id = addpath_id;
@@ -3410,7 +3421,7 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id,
bgp_aggregate_increment(bgp, p, new, afi, safi);
/* Register new BGP information. */
- bgp_info_add(rn, new);
+ bgp_path_info_add(rn, new);
/* route_node_get lock */
bgp_unlock_node(rn);
@@ -3485,25 +3496,25 @@ filtered:
peer->host, pfx_buf, reason);
}
- if (ri) {
+ if (pi) {
/* If this is an EVPN route, un-import it as it is now filtered.
*/
if (safi == SAFI_EVPN)
- bgp_evpn_unimport_route(bgp, afi, safi, p, ri);
+ bgp_evpn_unimport_route(bgp, afi, safi, p, pi);
if (SAFI_UNICAST == safi
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF
|| bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, ri);
+ vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, pi);
}
if ((SAFI_MPLS_VPN == safi)
&& (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_to_vrf_withdraw(bgp, ri);
+ vpn_leak_to_vrf_withdraw(bgp, pi);
}
- bgp_rib_remove(rn, ri, peer, afi, safi);
+ bgp_rib_remove(rn, pi, peer, afi, safi);
}
bgp_unlock_node(rn);
@@ -3531,7 +3542,7 @@ int bgp_withdraw(struct peer *peer, struct prefix *p, uint32_t addpath_id,
struct bgp *bgp;
char pfx_buf[BGP_PRD_PATH_STRLEN];
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
#if ENABLE_BGP_VNC
if ((SAFI_MPLS_VPN == safi) || (SAFI_ENCAP == safi)) {
@@ -3573,10 +3584,10 @@ int bgp_withdraw(struct peer *peer, struct prefix *p, uint32_t addpath_id,
}
/* Lookup withdrawn route. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == peer && ri->type == type
- && ri->sub_type == sub_type
- && ri->addpath_rx_id == addpath_id)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == peer && pi->type == type
+ && pi->sub_type == sub_type
+ && pi->addpath_rx_id == addpath_id)
break;
/* Logging. */
@@ -3589,17 +3600,17 @@ int bgp_withdraw(struct peer *peer, struct prefix *p, uint32_t addpath_id,
}
/* Withdraw specified route from routing table. */
- if (ri && !CHECK_FLAG(ri->flags, BGP_INFO_HISTORY)) {
- bgp_rib_withdraw(rn, ri, peer, afi, safi, prd);
+ if (pi && !CHECK_FLAG(pi->flags, BGP_PATH_HISTORY)) {
+ bgp_rib_withdraw(rn, pi, peer, afi, safi, prd);
if (SAFI_UNICAST == safi
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF
|| bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, ri);
+ vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, pi);
}
if ((SAFI_MPLS_VPN == safi)
&& (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_to_vrf_withdraw(bgp, ri);
+ vpn_leak_to_vrf_withdraw(bgp, pi);
}
} else if (bgp_debug_update(peer, p, NULL, 1)) {
bgp_debug_rdpfxpath2str(afi, safi, prd, p, label, num_labels,
@@ -3727,14 +3738,14 @@ static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t safi,
if (ain->peer != peer)
continue;
- struct bgp_info *ri = rn->info;
+ struct bgp_path_info *pi = rn->info;
uint32_t num_labels = 0;
mpls_label_t *label_pnt = NULL;
- if (ri && ri->extra)
- num_labels = ri->extra->num_labels;
+ if (pi && pi->extra)
+ num_labels = pi->extra->num_labels;
if (num_labels)
- label_pnt = &ri->extra->label[0];
+ label_pnt = &pi->extra->label[0];
ret = bgp_update(peer, &rn->p, ain->addpath_rx_id,
ain->attr, afi, safi, ZEBRA_ROUTE_BGP,
@@ -3783,7 +3794,7 @@ static wq_item_status bgp_clear_route_node(struct work_queue *wq, void *data)
struct bgp_clear_node_queue *cnq = data;
struct bgp_node *rn = cnq->rn;
struct peer *peer = wq->spec.data;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp *bgp;
afi_t afi = bgp_node_table(rn)->afi;
safi_t safi = bgp_node_table(rn)->safi;
@@ -3794,35 +3805,35 @@ static wq_item_status bgp_clear_route_node(struct work_queue *wq, void *data)
/* It is possible that we have multiple paths for a prefix from a peer
* if that peer is using AddPath.
*/
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->peer != peer)
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->peer != peer)
continue;
/* graceful restart STALE flag set. */
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)
&& peer->nsf[afi][safi]
- && !CHECK_FLAG(ri->flags, BGP_INFO_STALE)
- && !CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
- bgp_info_set_flag(rn, ri, BGP_INFO_STALE);
+ && !CHECK_FLAG(pi->flags, BGP_PATH_STALE)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_UNUSEABLE))
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_STALE);
else {
/* If this is an EVPN route, process for
* un-import. */
if (safi == SAFI_EVPN)
- bgp_evpn_unimport_route(bgp, afi, safi,
- &rn->p, ri);
+ bgp_evpn_unimport_route(bgp, afi, safi, &rn->p,
+ pi);
/* Handle withdraw for VRF route-leaking and L3VPN */
if (SAFI_UNICAST == safi
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF ||
bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_withdraw(bgp_get_default(),
- bgp, ri);
+ bgp, pi);
}
if (SAFI_MPLS_VPN == safi &&
bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
- vpn_leak_to_vrf_withdraw(bgp, ri);
+ vpn_leak_to_vrf_withdraw(bgp, pi);
}
- bgp_rib_remove(rn, ri, peer, afi, safi);
+ bgp_rib_remove(rn, pi, peer, afi, safi);
}
}
return WQ_SUCCESS;
@@ -3882,7 +3893,7 @@ static void bgp_clear_route_table(struct peer *peer, afi_t afi, safi_t safi,
return;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- struct bgp_info *ri, *next;
+ struct bgp_path_info *pi, *next;
struct bgp_adj_in *ain;
struct bgp_adj_in *ain_next;
@@ -3933,13 +3944,13 @@ static void bgp_clear_route_table(struct peer *peer, afi_t afi, safi_t safi,
ain = ain_next;
}
- for (ri = rn->info; ri; ri = next) {
- next = ri->next;
- if (ri->peer != peer)
+ for (pi = rn->info; pi; pi = next) {
+ next = pi->next;
+ if (pi->peer != peer)
continue;
if (force)
- bgp_info_reap(rn, ri);
+ bgp_path_info_reap(rn, pi);
else {
struct bgp_clear_node_queue *cnq;
@@ -4043,7 +4054,7 @@ void bgp_clear_adj_in(struct peer *peer, afi_t afi, safi_t safi)
void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_table *table;
if (safi == SAFI_MPLS_VPN) {
@@ -4057,26 +4068,26 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi)
for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm))
- for (ri = rm->info; ri; ri = ri->next) {
- if (ri->peer != peer)
+ for (pi = rm->info; pi; pi = pi->next) {
+ if (pi->peer != peer)
continue;
- if (!CHECK_FLAG(ri->flags,
- BGP_INFO_STALE))
+ if (!CHECK_FLAG(pi->flags,
+ BGP_PATH_STALE))
break;
- bgp_rib_remove(rm, ri, peer, afi, safi);
+ bgp_rib_remove(rm, pi, peer, afi, safi);
break;
}
}
} else {
for (rn = bgp_table_top(peer->bgp->rib[afi][safi]); rn;
rn = bgp_route_next(rn))
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->peer != peer)
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->peer != peer)
continue;
- if (!CHECK_FLAG(ri->flags, BGP_INFO_STALE))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_STALE))
break;
- bgp_rib_remove(rn, ri, peer, afi, safi);
+ bgp_rib_remove(rn, pi, peer, afi, safi);
break;
}
}
@@ -4086,22 +4097,22 @@ static void bgp_cleanup_table(struct bgp *bgp, struct bgp_table *table,
safi_t safi)
{
struct bgp_node *rn;
- struct bgp_info *ri;
- struct bgp_info *next;
+ struct bgp_path_info *pi;
+ struct bgp_path_info *next;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
- for (ri = rn->info; ri; ri = next) {
- next = ri->next;
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)
- && ri->type == ZEBRA_ROUTE_BGP
- && (ri->sub_type == BGP_ROUTE_NORMAL
- || ri->sub_type == BGP_ROUTE_AGGREGATE
- || ri->sub_type == BGP_ROUTE_IMPORTED)) {
+ for (pi = rn->info; pi; pi = next) {
+ next = pi->next;
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)
+ && pi->type == ZEBRA_ROUTE_BGP
+ && (pi->sub_type == BGP_ROUTE_NORMAL
+ || pi->sub_type == BGP_ROUTE_AGGREGATE
+ || pi->sub_type == BGP_ROUTE_IMPORTED)) {
if (bgp_fibupd_safi(safi))
- bgp_zebra_withdraw(&rn->p, ri,
- bgp, safi);
- bgp_info_reap(rn, ri);
+ bgp_zebra_withdraw(&rn->p, pi, bgp,
+ safi);
+ bgp_path_info_reap(rn, pi);
}
}
}
@@ -4352,9 +4363,9 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
struct bgp_static *bgp_static, afi_t afi, safi_t safi)
{
struct bgp_node *rn;
- struct bgp_info *ri;
- struct bgp_info *new;
- struct bgp_info info;
+ struct bgp_path_info *pi;
+ struct bgp_path_info *new;
+ struct bgp_path_info rmap_path;
struct attr attr;
struct attr *attr_new;
int ret;
@@ -4387,13 +4398,14 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
if (bgp_static->rmap.name) {
struct attr attr_tmp = attr;
- memset(&info, 0, sizeof(struct bgp_info));
- info.peer = bgp->peer_self;
- info.attr = &attr_tmp;
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ rmap_path.peer = bgp->peer_self;
+ rmap_path.attr = &attr_tmp;
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK);
- ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP, &info);
+ ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP,
+ &rmap_path);
bgp->peer_self->rmap_type = 0;
@@ -4419,14 +4431,14 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
attr_new = bgp_attr_intern(&attr);
}
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
- if (ri) {
- if (attrhash_cmp(ri->attr, attr_new)
- && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)
+ if (pi) {
+ if (attrhash_cmp(pi->attr, attr_new)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
&& !bgp_flag_check(bgp, BGP_FLAG_FORCE_STATIC_PROCESS)) {
bgp_unlock_node(rn);
bgp_attr_unintern(&attr_new);
@@ -4434,39 +4446,39 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
return;
} else {
/* The attribute is changed. */
- bgp_info_set_flag(rn, ri, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_ATTR_CHANGED);
/* Rewrite BGP route information. */
- if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED))
- bgp_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
else
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
#if ENABLE_BGP_VNC
if ((afi == AFI_IP || afi == AFI_IP6)
&& (safi == SAFI_UNICAST)) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
/*
* Implicit withdraw case.
- * We have to do this before ri is
+ * We have to do this before pi is
* changed
*/
++vnc_implicit_withdraw;
- vnc_import_bgp_del_route(bgp, p, ri);
+ vnc_import_bgp_del_route(bgp, p, pi);
vnc_import_bgp_exterior_del_route(
- bgp, p, ri);
+ bgp, p, pi);
}
}
#endif
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
#if ENABLE_BGP_VNC
if ((afi == AFI_IP || afi == AFI_IP6)
&& (safi == SAFI_UNICAST)) {
if (vnc_implicit_withdraw) {
- vnc_import_bgp_add_route(bgp, p, ri);
+ vnc_import_bgp_add_route(bgp, p, pi);
vnc_import_bgp_exterior_add_route(
- bgp, p, ri);
+ bgp, p, pi);
}
}
#endif
@@ -4478,13 +4490,13 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
struct bgp *bgp_nexthop = bgp;
- if (ri->extra && ri->extra->bgp_orig)
- bgp_nexthop = ri->extra->bgp_orig;
+ if (pi->extra && pi->extra->bgp_orig)
+ bgp_nexthop = pi->extra->bgp_orig;
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop,
- afi, ri, NULL, 0))
- bgp_info_set_flag(rn, ri,
- BGP_INFO_VALID);
+ afi, pi, NULL, 0))
+ bgp_path_info_set_flag(rn, pi,
+ BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {
char buf1[INET6_ADDRSTRLEN];
@@ -4495,8 +4507,8 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
"%s(%s): Route not in table, not advertising",
__FUNCTION__, buf1);
}
- bgp_info_unset_flag(rn, ri,
- BGP_INFO_VALID);
+ bgp_path_info_unset_flag(
+ rn, pi, BGP_PATH_VALID);
}
} else {
/* Delete the NHT structure if any, if we're
@@ -4506,11 +4518,11 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
* from NHT to avoid overloading NHT and the
* process interaction
*/
- bgp_unlink_nexthop(ri);
- bgp_info_set_flag(rn, ri, BGP_INFO_VALID);
+ bgp_unlink_nexthop(pi);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_VALID);
}
/* Process change. */
- bgp_aggregate_increment(bgp, p, ri, afi, safi);
+ bgp_aggregate_increment(bgp, p, pi, afi, safi);
bgp_process(bgp, rn, afi, safi);
if (SAFI_UNICAST == safi
@@ -4518,7 +4530,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
|| bgp->inst_type
== BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_update(bgp_get_default(), bgp,
- ri);
+ pi);
}
bgp_unlock_node(rn);
@@ -4534,7 +4546,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)
&& (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST)) {
if (bgp_find_or_add_nexthop(bgp, bgp, afi, new, NULL, 0))
- bgp_info_set_flag(rn, new, BGP_INFO_VALID);
+ bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {
char buf1[INET6_ADDRSTRLEN];
@@ -4544,7 +4556,7 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
"%s(%s): Route not in table, not advertising",
__FUNCTION__, buf1);
}
- bgp_info_unset_flag(rn, new, BGP_INFO_VALID);
+ bgp_path_info_unset_flag(rn, new, BGP_PATH_VALID);
}
} else {
/* Delete the NHT structure if any, if we're toggling between
@@ -4553,14 +4565,14 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
*/
bgp_unlink_nexthop(new);
- bgp_info_set_flag(rn, new, BGP_INFO_VALID);
+ bgp_path_info_set_flag(rn, new, BGP_PATH_VALID);
}
/* Aggregate address increment. */
bgp_aggregate_increment(bgp, p, new, afi, safi);
/* Register new BGP information. */
- bgp_info_add(rn, new);
+ bgp_path_info_add(rn, new);
/* route_node_get lock */
bgp_unlock_node(rn);
@@ -4582,26 +4594,26 @@ void bgp_static_withdraw(struct bgp *bgp, struct prefix *p, afi_t afi,
safi_t safi)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL);
/* Check selected route and self inserted route. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
/* Withdraw static BGP route from routing table. */
- if (ri) {
+ if (pi) {
if (SAFI_UNICAST == safi
&& (bgp->inst_type == BGP_INSTANCE_TYPE_VRF
|| bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, ri);
+ vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp, pi);
}
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
- bgp_unlink_nexthop(ri);
- bgp_info_delete(rn, ri);
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
+ bgp_unlink_nexthop(pi);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, safi);
}
@@ -4617,29 +4629,29 @@ static void bgp_static_withdraw_safi(struct bgp *bgp, struct prefix *p,
struct prefix_rd *prd)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
/* Check selected route and self inserted route. */
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
/* Withdraw static BGP route from routing table. */
- if (ri) {
+ if (pi) {
#if ENABLE_BGP_VNC
rfapiProcessWithdraw(
- ri->peer, NULL, p, prd, ri->attr, afi, safi, ri->type,
+ pi->peer, NULL, p, prd, pi->attr, afi, safi, pi->type,
1); /* Kill, since it is an administrative change */
#endif
if (SAFI_MPLS_VPN == safi
&& bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
- vpn_leak_to_vrf_withdraw(bgp, ri);
+ vpn_leak_to_vrf_withdraw(bgp, pi);
}
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
- bgp_info_delete(rn, ri);
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, safi);
}
@@ -4652,10 +4664,10 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
safi_t safi)
{
struct bgp_node *rn;
- struct bgp_info *new;
+ struct bgp_path_info *new;
struct attr *attr_new;
struct attr attr = {0};
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
#if ENABLE_BGP_VNC
mpls_label_t label = 0;
#endif
@@ -4703,15 +4715,16 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
/* Apply route-map. */
if (bgp_static->rmap.name) {
struct attr attr_tmp = attr;
- struct bgp_info info;
+ struct bgp_path_info rmap_path;
int ret;
- info.peer = bgp->peer_self;
- info.attr = &attr_tmp;
+ rmap_path.peer = bgp->peer_self;
+ rmap_path.attr = &attr_tmp;
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK);
- ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP, &info);
+ ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP,
+ &rmap_path);
bgp->peer_self->rmap_type = 0;
@@ -4731,49 +4744,49 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
attr_new = bgp_attr_intern(&attr);
}
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
break;
- if (ri) {
+ if (pi) {
memset(&add, 0, sizeof(union gw_addr));
- if (attrhash_cmp(ri->attr, attr_new)
- && overlay_index_equal(afi, ri, bgp_static->eth_s_id, &add)
- && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) {
+ if (attrhash_cmp(pi->attr, attr_new)
+ && overlay_index_equal(afi, pi, bgp_static->eth_s_id, &add)
+ && !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_unlock_node(rn);
bgp_attr_unintern(&attr_new);
aspath_unintern(&attr.aspath);
return;
} else {
/* The attribute is changed. */
- bgp_info_set_flag(rn, ri, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, pi, BGP_PATH_ATTR_CHANGED);
/* Rewrite BGP route information. */
- if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED))
- bgp_info_restore(rn, ri);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(rn, pi);
else
- bgp_aggregate_decrement(bgp, p, ri, afi, safi);
- bgp_attr_unintern(&ri->attr);
- ri->attr = attr_new;
- ri->uptime = bgp_clock();
+ bgp_aggregate_decrement(bgp, p, pi, afi, safi);
+ bgp_attr_unintern(&pi->attr);
+ pi->attr = attr_new;
+ pi->uptime = bgp_clock();
#if ENABLE_BGP_VNC
- if (ri->extra)
- label = decode_label(&ri->extra->label[0]);
+ if (pi->extra)
+ label = decode_label(&pi->extra->label[0]);
#endif
/* Process change. */
- bgp_aggregate_increment(bgp, p, ri, afi, safi);
+ bgp_aggregate_increment(bgp, p, pi, afi, safi);
bgp_process(bgp, rn, afi, safi);
if (SAFI_MPLS_VPN == safi
&& bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
- vpn_leak_to_vrf_update(bgp, ri);
+ vpn_leak_to_vrf_update(bgp, pi);
}
#if ENABLE_BGP_VNC
- rfapiProcessUpdate(ri->peer, NULL, p, &bgp_static->prd,
- ri->attr, afi, safi, ri->type,
- ri->sub_type, &label);
+ rfapiProcessUpdate(pi->peer, NULL, p, &bgp_static->prd,
+ pi->attr, afi, safi, pi->type,
+ pi->sub_type, &label);
#endif
bgp_unlock_node(rn);
aspath_unintern(&attr.aspath);
@@ -4785,8 +4798,8 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
/* Make new BGP info. */
new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self,
attr_new, rn);
- SET_FLAG(new->flags, BGP_INFO_VALID);
- new->extra = bgp_info_extra_new();
+ SET_FLAG(new->flags, BGP_PATH_VALID);
+ new->extra = bgp_path_info_extra_new();
if (num_labels) {
new->extra->label[0] = bgp_static->label;
new->extra->num_labels = num_labels;
@@ -4799,7 +4812,7 @@ static void bgp_static_update_safi(struct bgp *bgp, struct prefix *p,
bgp_aggregate_increment(bgp, p, new, afi, safi);
/* Register new BGP information. */
- bgp_info_add(rn, new);
+ bgp_path_info_add(rn, new);
/* route_node_get lock */
bgp_unlock_node(rn);
@@ -5071,21 +5084,21 @@ static void bgp_purge_af_static_redist_routes(struct bgp *bgp, afi_t afi,
{
struct bgp_table *table;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
table = bgp->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->peer == bgp->peer_self
- && ((ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_STATIC)
- || (ri->type != ZEBRA_ROUTE_BGP
- && ri->sub_type
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->peer == bgp->peer_self
+ && ((pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_STATIC)
+ || (pi->type != ZEBRA_ROUTE_BGP
+ && pi->sub_type
== BGP_ROUTE_REDISTRIBUTE))) {
- bgp_aggregate_decrement(bgp, &rn->p, ri, afi,
+ bgp_aggregate_decrement(bgp, &rn->p, pi, afi,
safi);
- bgp_unlink_nexthop(ri);
- bgp_info_delete(rn, ri);
+ bgp_unlink_nexthop(pi);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, safi);
}
}
@@ -5467,7 +5480,7 @@ static void bgp_aggregate_free(struct bgp_aggregate *aggregate)
XFREE(MTYPE_BGP_AGGREGATE, aggregate);
}
-static int bgp_aggregate_info_same(struct bgp_info *ri, uint8_t origin,
+static int bgp_aggregate_info_same(struct bgp_path_info *pi, uint8_t origin,
struct aspath *aspath,
struct community *comm)
{
@@ -5476,19 +5489,19 @@ static int bgp_aggregate_info_same(struct bgp_info *ri, uint8_t origin,
if (!ae)
ae = aspath_empty();
- if (!ri)
+ if (!pi)
return 0;
- if (origin != ri->attr->origin)
+ if (origin != pi->attr->origin)
return 0;
- if (!aspath_cmp(ri->attr->aspath, (aspath) ? aspath : ae))
+ if (!aspath_cmp(pi->attr->aspath, (aspath) ? aspath : ae))
return 0;
- if (!community_cmp(ri->attr->community, comm))
+ if (!community_cmp(pi->attr->community, comm))
return 0;
- if (!CHECK_FLAG(ri->flags, BGP_INFO_VALID))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID))
return 0;
return 1;
@@ -5503,15 +5516,15 @@ static void bgp_aggregate_install(struct bgp *bgp, afi_t afi, safi_t safi,
{
struct bgp_node *rn;
struct bgp_table *table;
- struct bgp_info *ri, *new;
+ struct bgp_path_info *pi, *new;
table = bgp->rib[afi][safi];
rn = bgp_node_get(table, p);
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_AGGREGATE)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_AGGREGATE)
break;
if (aggregate->count > 0) {
@@ -5534,8 +5547,8 @@ static void bgp_aggregate_install(struct bgp *bgp, afi_t afi, safi_t safi,
/*
* Mark the old as unusable
*/
- if (ri)
- bgp_info_delete(rn, ri);
+ if (pi)
+ bgp_path_info_delete(rn, pi);
new = info_make(
ZEBRA_ROUTE_BGP, BGP_ROUTE_AGGREGATE, 0, bgp->peer_self,
@@ -5543,20 +5556,20 @@ static void bgp_aggregate_install(struct bgp *bgp, afi_t afi, safi_t safi,
community, aggregate->as_set,
atomic_aggregate),
rn);
- SET_FLAG(new->flags, BGP_INFO_VALID);
+ SET_FLAG(new->flags, BGP_PATH_VALID);
- bgp_info_add(rn, new);
+ bgp_path_info_add(rn, new);
bgp_process(bgp, rn, afi, safi);
} else {
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self
- && ri->type == ZEBRA_ROUTE_BGP
- && ri->sub_type == BGP_ROUTE_AGGREGATE)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self
+ && pi->type == ZEBRA_ROUTE_BGP
+ && pi->sub_type == BGP_ROUTE_AGGREGATE)
break;
/* Withdraw static BGP route from routing table. */
- if (ri) {
- bgp_info_delete(rn, ri);
+ if (pi) {
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, safi);
}
}
@@ -5566,8 +5579,8 @@ static void bgp_aggregate_install(struct bgp *bgp, afi_t afi, safi_t safi,
/* Update an aggregate as routes are added/removed from the BGP table */
static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
- struct bgp_info *rinew, afi_t afi, safi_t safi,
- struct bgp_info *del,
+ struct bgp_path_info *pinew, afi_t afi,
+ safi_t safi, struct bgp_path_info *del,
struct bgp_aggregate *aggregate)
{
struct bgp_table *table;
@@ -5578,7 +5591,7 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
struct aspath *asmerge = NULL;
struct community *community = NULL;
struct community *commerge = NULL;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
unsigned long match = 0;
uint8_t atomic_aggregate = 0;
@@ -5602,18 +5615,18 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
match = 0;
- for (ri = rn->info; ri; ri = ri->next) {
- if (BGP_INFO_HOLDDOWN(ri))
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (BGP_PATH_HOLDDOWN(pi))
continue;
- if (del && ri == del)
+ if (del && pi == del)
continue;
- if (ri->attr->flag
+ if (pi->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE))
atomic_aggregate = 1;
- if (ri->sub_type == BGP_ROUTE_AGGREGATE)
+ if (pi->sub_type == BGP_ROUTE_AGGREGATE)
continue;
/*
@@ -5621,9 +5634,9 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
* aggregated route announcements.
*/
if (aggregate->summary_only) {
- (bgp_info_extra_get(ri))->suppress++;
- bgp_info_set_flag(rn, ri,
- BGP_INFO_ATTR_CHANGED);
+ (bgp_path_info_extra_get(pi))->suppress++;
+ bgp_path_info_set_flag(rn, pi,
+ BGP_PATH_ATTR_CHANGED);
match++;
}
@@ -5639,8 +5652,8 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
* route MUST have the ORIGIN attribute with the value
* EGP.
*/
- if (origin < ri->attr->origin)
- origin = ri->attr->origin;
+ if (origin < pi->attr->origin)
+ origin = pi->attr->origin;
if (!aggregate->as_set)
continue;
@@ -5651,57 +5664,57 @@ static void bgp_aggregate_route(struct bgp *bgp, struct prefix *p,
*/
if (aspath) {
asmerge = aspath_aggregate(aspath,
- ri->attr->aspath);
+ pi->attr->aspath);
aspath_free(aspath);
aspath = asmerge;
} else
- aspath = aspath_dup(ri->attr->aspath);
+ aspath = aspath_dup(pi->attr->aspath);
- if (!ri->attr->community)
+ if (!pi->attr->community)
continue;
if (community) {
commerge = community_merge(community,
- ri->attr->community);
+ pi->attr->community);
community = community_uniq_sort(commerge);
community_free(commerge);
} else
- community = community_dup(ri->attr->community);
+ community = community_dup(pi->attr->community);
}
if (match)
bgp_process(bgp, rn, afi, safi);
}
bgp_unlock_node(top);
- if (rinew) {
+ if (pinew) {
aggregate->count++;
if (aggregate->summary_only)
- (bgp_info_extra_get(rinew))->suppress++;
+ (bgp_path_info_extra_get(pinew))->suppress++;
- if (origin < rinew->attr->origin)
- origin = rinew->attr->origin;
+ if (origin < pinew->attr->origin)
+ origin = pinew->attr->origin;
if (aggregate->as_set) {
if (aspath) {
asmerge = aspath_aggregate(aspath,
- rinew->attr->aspath);
+ pinew->attr->aspath);
aspath_free(aspath);
aspath = asmerge;
} else
- aspath = aspath_dup(rinew->attr->aspath);
+ aspath = aspath_dup(pinew->attr->aspath);
- if (rinew->attr->community) {
+ if (pinew->attr->community) {
if (community) {
commerge = community_merge(
community,
- rinew->attr->community);
+ pinew->attr->community);
community =
community_uniq_sort(commerge);
community_free(commerge);
} else
community = community_dup(
- rinew->attr->community);
+ pinew->attr->community);
}
}
}
@@ -5723,7 +5736,7 @@ static void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
struct bgp_table *table;
struct bgp_node *top;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
unsigned long match;
table = bgp->rib[afi][safi];
@@ -5736,19 +5749,19 @@ static void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
continue;
match = 0;
- for (ri = rn->info; ri; ri = ri->next) {
- if (BGP_INFO_HOLDDOWN(ri))
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (BGP_PATH_HOLDDOWN(pi))
continue;
- if (ri->sub_type == BGP_ROUTE_AGGREGATE)
+ if (pi->sub_type == BGP_ROUTE_AGGREGATE)
continue;
- if (aggregate->summary_only && ri->extra) {
- ri->extra->suppress--;
+ if (aggregate->summary_only && pi->extra) {
+ pi->extra->suppress--;
- if (ri->extra->suppress == 0) {
- bgp_info_set_flag(
- rn, ri, BGP_INFO_ATTR_CHANGED);
+ if (pi->extra->suppress == 0) {
+ bgp_path_info_set_flag(
+ rn, pi, BGP_PATH_ATTR_CHANGED);
match++;
}
}
@@ -5763,7 +5776,7 @@ static void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
}
void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
- struct bgp_info *ri, afi_t afi, safi_t safi)
+ struct bgp_path_info *pi, afi_t afi, safi_t safi)
{
struct bgp_node *child;
struct bgp_node *rn;
@@ -5779,7 +5792,7 @@ void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
if (p->prefixlen == 0)
return;
- if (BGP_INFO_HOLDDOWN(ri))
+ if (BGP_PATH_HOLDDOWN(pi))
return;
child = bgp_node_get(table, p);
@@ -5789,7 +5802,7 @@ void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
aggregate = bgp_aggregate_get_node_info(rn);
if (aggregate != NULL && rn->p.prefixlen < p->prefixlen) {
bgp_aggregate_delete(bgp, &rn->p, afi, safi, aggregate);
- bgp_aggregate_route(bgp, &rn->p, ri, afi, safi, NULL,
+ bgp_aggregate_route(bgp, &rn->p, pi, afi, safi, NULL,
aggregate);
}
}
@@ -5797,7 +5810,7 @@ void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
}
void bgp_aggregate_decrement(struct bgp *bgp, struct prefix *p,
- struct bgp_info *del, afi_t afi, safi_t safi)
+ struct bgp_path_info *del, afi_t afi, safi_t safi)
{
struct bgp_node *child;
struct bgp_node *rn;
@@ -6061,9 +6074,9 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
uint8_t type, unsigned short instance,
route_tag_t tag)
{
- struct bgp_info *new;
- struct bgp_info *bi;
- struct bgp_info info;
+ struct bgp_path_info *new;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info rmap_path;
struct bgp_node *bn;
struct attr attr;
struct attr *new_attr;
@@ -6119,15 +6132,15 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
/* Apply route-map. */
if (red->rmap.name) {
- memset(&info, 0, sizeof(struct bgp_info));
- info.peer = bgp->peer_self;
- info.attr = &attr_new;
+ memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ rmap_path.peer = bgp->peer_self;
+ rmap_path.attr = &attr_new;
SET_FLAG(bgp->peer_self->rmap_type,
PEER_RMAP_TYPE_REDISTRIBUTE);
ret = route_map_apply(red->rmap.map, p, RMAP_BGP,
- &info);
+ &rmap_path);
bgp->peer_self->rmap_type = 0;
@@ -6150,37 +6163,37 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
new_attr = bgp_attr_intern(&attr_new);
- for (bi = bn->info; bi; bi = bi->next)
- if (bi->peer == bgp->peer_self
- && bi->sub_type == BGP_ROUTE_REDISTRIBUTE)
+ for (bpi = bn->info; bpi; bpi = bpi->next)
+ if (bpi->peer == bgp->peer_self
+ && bpi->sub_type == BGP_ROUTE_REDISTRIBUTE)
break;
- if (bi) {
+ if (bpi) {
/* Ensure the (source route) type is updated. */
- bi->type = type;
- if (attrhash_cmp(bi->attr, new_attr)
- && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ bpi->type = type;
+ if (attrhash_cmp(bpi->attr, new_attr)
+ && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
bgp_attr_unintern(&new_attr);
aspath_unintern(&attr.aspath);
bgp_unlock_node(bn);
return;
} else {
/* The attribute is changed. */
- bgp_info_set_flag(bn, bi,
- BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(bn, bpi,
+ BGP_PATH_ATTR_CHANGED);
/* Rewrite BGP route information. */
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
- bgp_info_restore(bn, bi);
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(bn, bpi);
else
- bgp_aggregate_decrement(bgp, p, bi, afi,
- SAFI_UNICAST);
- bgp_attr_unintern(&bi->attr);
- bi->attr = new_attr;
- bi->uptime = bgp_clock();
+ bgp_aggregate_decrement(
+ bgp, p, bpi, afi, SAFI_UNICAST);
+ bgp_attr_unintern(&bpi->attr);
+ bpi->attr = new_attr;
+ bpi->uptime = bgp_clock();
/* Process change. */
- bgp_aggregate_increment(bgp, p, bi, afi,
+ bgp_aggregate_increment(bgp, p, bpi, afi,
SAFI_UNICAST);
bgp_process(bgp, bn, afi, SAFI_UNICAST);
bgp_unlock_node(bn);
@@ -6191,7 +6204,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
== BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_update(
- bgp_get_default(), bgp, bi);
+ bgp_get_default(), bgp, bpi);
}
return;
}
@@ -6199,10 +6212,10 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
new = info_make(type, BGP_ROUTE_REDISTRIBUTE, instance,
bgp->peer_self, new_attr, bn);
- SET_FLAG(new->flags, BGP_INFO_VALID);
+ SET_FLAG(new->flags, BGP_PATH_VALID);
bgp_aggregate_increment(bgp, p, new, afi, SAFI_UNICAST);
- bgp_info_add(bn, new);
+ bgp_path_info_add(bn, new);
bgp_unlock_node(bn);
bgp_process(bgp, bn, afi, SAFI_UNICAST);
@@ -6222,7 +6235,7 @@ void bgp_redistribute_delete(struct bgp *bgp, struct prefix *p, uint8_t type,
{
afi_t afi;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_redist *red;
afi = family2afi(p->family);
@@ -6232,19 +6245,19 @@ void bgp_redistribute_delete(struct bgp *bgp, struct prefix *p, uint8_t type,
rn = bgp_afi_node_get(bgp->rib[afi][SAFI_UNICAST], afi,
SAFI_UNICAST, p, NULL);
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == type)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == type)
break;
- if (ri) {
+ if (pi) {
if ((bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
|| (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_withdraw(bgp_get_default(),
- bgp, ri);
+ bgp, pi);
}
- bgp_aggregate_decrement(bgp, p, ri, afi, SAFI_UNICAST);
- bgp_info_delete(rn, ri);
+ bgp_aggregate_decrement(bgp, p, pi, afi, SAFI_UNICAST);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, SAFI_UNICAST);
}
bgp_unlock_node(rn);
@@ -6256,27 +6269,27 @@ void bgp_redistribute_withdraw(struct bgp *bgp, afi_t afi, int type,
unsigned short instance)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_table *table;
table = bgp->rib[afi][SAFI_UNICAST];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- for (ri = rn->info; ri; ri = ri->next)
- if (ri->peer == bgp->peer_self && ri->type == type
- && ri->instance == instance)
+ for (pi = rn->info; pi; pi = pi->next)
+ if (pi->peer == bgp->peer_self && pi->type == type
+ && pi->instance == instance)
break;
- if (ri) {
+ if (pi) {
if ((bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
|| (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
vpn_leak_from_vrf_withdraw(bgp_get_default(),
- bgp, ri);
+ bgp, pi);
}
- bgp_aggregate_decrement(bgp, &rn->p, ri, afi,
+ bgp_aggregate_decrement(bgp, &rn->p, pi, afi,
SAFI_UNICAST);
- bgp_info_delete(rn, ri);
+ bgp_path_info_delete(rn, pi);
bgp_process(bgp, rn, afi, SAFI_UNICAST);
}
}
@@ -6288,6 +6301,7 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty,
{
int len = 0;
char buf[BUFSIZ];
+ char buf2[BUFSIZ];
if (p->family == AF_INET) {
if (!json) {
@@ -6301,6 +6315,8 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty,
&p->u.prefix, buf,
BUFSIZ));
json_object_int_add(json, "prefixLen", p->prefixlen);
+ prefix2str(p, buf2, PREFIX_STRLEN);
+ json_object_string_add(json, "network", buf2);
}
} else if (p->family == AF_ETHERNET) {
prefix2str(p, buf, PREFIX_STRLEN);
@@ -6324,6 +6340,15 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty,
vty, "%s/%d",
inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
p->prefixlen);
+ else {
+ json_object_string_add(json, "prefix",
+ inet_ntop(p->family,
+ &p->u.prefix, buf,
+ BUFSIZ));
+ json_object_int_add(json, "prefixLen", p->prefixlen);
+ prefix2str(p, buf2, PREFIX_STRLEN);
+ json_object_string_add(json, "network", buf2);
+ }
}
if (!json) {
@@ -6339,42 +6364,43 @@ enum bgp_display_type {
normal_list,
};
-/* Print the short form route status for a bgp_info */
-static void route_vty_short_status_out(struct vty *vty, struct bgp_info *binfo,
+/* Print the short form route status for a bgp_path_info */
+static void route_vty_short_status_out(struct vty *vty,
+ struct bgp_path_info *path,
json_object *json_path)
{
if (json_path) {
/* Route status display. */
- if (CHECK_FLAG(binfo->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED))
json_object_boolean_true_add(json_path, "removed");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_STALE))
+ if (CHECK_FLAG(path->flags, BGP_PATH_STALE))
json_object_boolean_true_add(json_path, "stale");
- if (binfo->extra && binfo->extra->suppress)
+ if (path->extra && path->extra->suppress)
json_object_boolean_true_add(json_path, "suppressed");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_VALID)
- && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY))
+ if (CHECK_FLAG(path->flags, BGP_PATH_VALID)
+ && !CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
json_object_boolean_true_add(json_path, "valid");
/* Selected */
- if (CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY))
+ if (CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
json_object_boolean_true_add(json_path, "history");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED))
json_object_boolean_true_add(json_path, "damped");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_SELECTED))
json_object_boolean_true_add(json_path, "bestpath");
- if (CHECK_FLAG(binfo->flags, BGP_INFO_MULTIPATH))
+ if (CHECK_FLAG(path->flags, BGP_PATH_MULTIPATH))
json_object_boolean_true_add(json_path, "multipath");
/* Internal route. */
- if ((binfo->peer->as)
- && (binfo->peer->as == binfo->peer->local_as))
+ if ((path->peer->as)
+ && (path->peer->as == path->peer->local_as))
json_object_string_add(json_path, "pathFrom",
"internal");
else
@@ -6385,41 +6411,42 @@ static void route_vty_short_status_out(struct vty *vty, struct bgp_info *binfo,
}
/* Route status display. */
- if (CHECK_FLAG(binfo->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED))
vty_out(vty, "R");
- else if (CHECK_FLAG(binfo->flags, BGP_INFO_STALE))
+ else if (CHECK_FLAG(path->flags, BGP_PATH_STALE))
vty_out(vty, "S");
- else if (binfo->extra && binfo->extra->suppress)
+ else if (path->extra && path->extra->suppress)
vty_out(vty, "s");
- else if (CHECK_FLAG(binfo->flags, BGP_INFO_VALID)
- && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY))
+ else if (CHECK_FLAG(path->flags, BGP_PATH_VALID)
+ && !CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
vty_out(vty, "*");
else
vty_out(vty, " ");
/* Selected */
- if (CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY))
+ if (CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
vty_out(vty, "h");
- else if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED))
+ else if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED))
vty_out(vty, "d");
- else if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED))
+ else if (CHECK_FLAG(path->flags, BGP_PATH_SELECTED))
vty_out(vty, ">");
- else if (CHECK_FLAG(binfo->flags, BGP_INFO_MULTIPATH))
+ else if (CHECK_FLAG(path->flags, BGP_PATH_MULTIPATH))
vty_out(vty, "=");
else
vty_out(vty, " ");
/* Internal route. */
- if (binfo->peer && (binfo->peer->as)
- && (binfo->peer->as == binfo->peer->local_as))
+ if (path->peer && (path->peer->as)
+ && (path->peer->as == path->peer->local_as))
vty_out(vty, "i");
else
vty_out(vty, " ");
}
/* called from terminal list command */
-void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
- int display, safi_t safi, json_object *json_paths)
+void route_vty_out(struct vty *vty, struct prefix *p,
+ struct bgp_path_info *path, int display, safi_t safi,
+ json_object *json_paths)
{
struct attr *attr;
json_object *json_path = NULL;
@@ -6427,9 +6454,8 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
json_object *json_nexthop_global = NULL;
json_object *json_nexthop_ll = NULL;
char vrf_id_str[VRF_NAMSIZ] = {0};
- bool nexthop_self = CHECK_FLAG(binfo->flags, BGP_INFO_ANNC_NH_SELF)
- ? true
- : false;
+ bool nexthop_self =
+ CHECK_FLAG(path->flags, BGP_PATH_ANNC_NH_SELF) ? true : false;
bool nexthop_othervrf = false;
vrf_id_t nexthop_vrfid = VRF_DEFAULT;
const char *nexthop_vrfname = "Default";
@@ -6438,7 +6464,7 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
json_path = json_object_new_object();
/* short status lead text */
- route_vty_short_status_out(vty, binfo, json_path);
+ route_vty_short_status_out(vty, path, json_path);
if (!json_paths) {
/* print prefix and mask */
@@ -6451,7 +6477,7 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
}
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
if (!attr) {
if (json_paths)
json_object_array_add(json_paths, json_path);
@@ -6465,26 +6491,26 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
* If vrf id of nexthop is different from that of prefix,
* set up printable string to append
*/
- if (binfo->extra && binfo->extra->bgp_orig) {
+ if (path->extra && path->extra->bgp_orig) {
const char *self = "";
if (nexthop_self)
self = "<";
nexthop_othervrf = true;
- nexthop_vrfid = binfo->extra->bgp_orig->vrf_id;
+ nexthop_vrfid = path->extra->bgp_orig->vrf_id;
- if (binfo->extra->bgp_orig->vrf_id == VRF_UNKNOWN)
+ if (path->extra->bgp_orig->vrf_id == VRF_UNKNOWN)
snprintf(vrf_id_str, sizeof(vrf_id_str),
"@%s%s", VRFID_NONE_STR, self);
else
snprintf(vrf_id_str, sizeof(vrf_id_str), "@%u%s",
- binfo->extra->bgp_orig->vrf_id, self);
+ path->extra->bgp_orig->vrf_id, self);
- if (binfo->extra->bgp_orig->inst_type !=
- BGP_INSTANCE_TYPE_DEFAULT)
+ if (path->extra->bgp_orig->inst_type
+ != BGP_INSTANCE_TYPE_DEFAULT)
- nexthop_vrfname = binfo->extra->bgp_orig->name;
+ nexthop_vrfname = path->extra->bgp_orig->name;
} else {
const char *self = "";
@@ -6610,7 +6636,7 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
/* We display both LL & GL if both have been
* received */
if ((attr->mp_nexthop_len == 32)
- || (binfo->peer->conf_if)) {
+ || (path->peer->conf_if)) {
json_nexthop_ll = json_object_new_object();
json_object_string_add(
json_nexthop_ll, "ip",
@@ -6639,10 +6665,10 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
* prefer-global is set */
if (((attr->mp_nexthop_len == 32)
&& !attr->mp_nexthop_prefer_global)
- || (binfo->peer->conf_if)) {
- if (binfo->peer->conf_if) {
+ || (path->peer->conf_if)) {
+ if (path->peer->conf_if) {
len = vty_out(vty, "%s",
- binfo->peer->conf_if);
+ path->peer->conf_if);
len = 16 - len; /* len of IPv6
addr + max
len of def
@@ -6712,7 +6738,7 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
char buf[BUFSIZ];
json_object_string_add(
json_path, "peerId",
- sockunion2str(&binfo->peer->su, buf, SU_ADDRSTRLEN));
+ sockunion2str(&path->peer->su, buf, SU_ADDRSTRLEN));
}
/* Print aspath */
@@ -6769,7 +6795,7 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo,
/* prints an additional line, indented, with VNC info, if
* present */
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP))
- rfapi_vty_out_vncinfo(vty, p, binfo, safi);
+ rfapi_vty_out_vncinfo(vty, p, path, safi);
#endif
}
}
@@ -6781,6 +6807,7 @@ void route_vty_out_tmp(struct vty *vty, struct prefix *p, struct attr *attr,
json_object *json_status = NULL;
json_object *json_net = NULL;
char buff[BUFSIZ];
+ char buf2[BUFSIZ];
/* Route status display. */
if (use_json) {
json_status = json_object_new_object();
@@ -6792,11 +6819,14 @@ void route_vty_out_tmp(struct vty *vty, struct prefix *p, struct attr *attr,
}
/* print prefix and mask */
- if (use_json)
+ if (use_json) {
json_object_string_add(
json_net, "addrPrefix",
inet_ntop(p->family, &p->u.prefix, buff, BUFSIZ));
- else
+ json_object_int_add(json_net, "prefixLen", p->prefixlen);
+ prefix2str(p, buf2, PREFIX_STRLEN);
+ json_object_string_add(json_net, "network", buf2);
+ } else
route_vty_out_route(p, vty, NULL);
/* Print attribute */
@@ -6911,21 +6941,21 @@ void route_vty_out_tmp(struct vty *vty, struct prefix *p, struct attr *attr,
}
void route_vty_out_tag(struct vty *vty, struct prefix *p,
- struct bgp_info *binfo, int display, safi_t safi,
+ struct bgp_path_info *path, int display, safi_t safi,
json_object *json)
{
json_object *json_out = NULL;
struct attr *attr;
mpls_label_t label = MPLS_INVALID_LABEL;
- if (!binfo->extra)
+ if (!path->extra)
return;
if (json)
json_out = json_object_new_object();
/* short status lead text */
- route_vty_short_status_out(vty, binfo, json_out);
+ route_vty_short_status_out(vty, path, json_out);
/* print prefix and mask */
if (json == NULL) {
@@ -6936,7 +6966,7 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p,
}
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
if (attr) {
if (((p->family == AF_INET)
&& ((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)))
@@ -7012,7 +7042,7 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p,
}
}
- label = decode_label(&binfo->extra->label[0]);
+ label = decode_label(&path->extra->label[0]);
if (bgp_is_valid_label(&label)) {
if (json) {
@@ -7026,7 +7056,7 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p,
}
void route_vty_out_overlay(struct vty *vty, struct prefix *p,
- struct bgp_info *binfo, int display,
+ struct bgp_path_info *path, int display,
json_object *json_paths)
{
struct attr *attr;
@@ -7036,11 +7066,11 @@ void route_vty_out_overlay(struct vty *vty, struct prefix *p,
if (json_paths)
json_path = json_object_new_object();
- if (!binfo->extra)
+ if (!path->extra)
return;
/* short status lead text */
- route_vty_short_status_out(vty, binfo, json_path);
+ route_vty_short_status_out(vty, path, json_path);
/* print prefix and mask */
if (!display)
@@ -7049,7 +7079,7 @@ void route_vty_out_overlay(struct vty *vty, struct prefix *p,
vty_out(vty, "%*s", 17, " ");
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
if (attr) {
char buf1[BUFSIZ];
int af = NEXTHOP_FAMILY(attr->mp_nexthop_len);
@@ -7104,15 +7134,15 @@ void route_vty_out_overlay(struct vty *vty, struct prefix *p,
/* dampening route */
static void damp_route_vty_out(struct vty *vty, struct prefix *p,
- struct bgp_info *binfo, int display, safi_t safi,
- bool use_json, json_object *json)
+ struct bgp_path_info *path, int display,
+ safi_t safi, bool use_json, json_object *json)
{
struct attr *attr;
int len;
char timebuf[BGP_UPTIME_LEN];
/* short status lead text */
- route_vty_short_status_out(vty, binfo, json);
+ route_vty_short_status_out(vty, path, json);
/* print prefix and mask */
if (!use_json) {
@@ -7122,7 +7152,7 @@ static void damp_route_vty_out(struct vty *vty, struct prefix *p,
vty_out(vty, "%*s", 17, " ");
}
- len = vty_out(vty, "%s", binfo->peer->host);
+ len = vty_out(vty, "%s", path->peer->host);
len = 17 - len;
if (len < 1) {
if (!use_json)
@@ -7135,15 +7165,16 @@ static void damp_route_vty_out(struct vty *vty, struct prefix *p,
}
if (use_json)
- bgp_damp_reuse_time_vty(vty, binfo, timebuf, BGP_UPTIME_LEN,
+ bgp_damp_reuse_time_vty(vty, path, timebuf, BGP_UPTIME_LEN,
use_json, json);
else
- vty_out(vty, "%s ", bgp_damp_reuse_time_vty(vty, binfo, timebuf,
- BGP_UPTIME_LEN,
- use_json, json));
+ vty_out(vty, "%s ",
+ bgp_damp_reuse_time_vty(vty, path, timebuf,
+ BGP_UPTIME_LEN, use_json,
+ json));
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
if (attr) {
/* Print aspath */
if (attr->aspath) {
@@ -7167,21 +7198,21 @@ static void damp_route_vty_out(struct vty *vty, struct prefix *p,
/* flap route */
static void flap_route_vty_out(struct vty *vty, struct prefix *p,
- struct bgp_info *binfo, int display, safi_t safi,
- bool use_json, json_object *json)
+ struct bgp_path_info *path, int display,
+ safi_t safi, bool use_json, json_object *json)
{
struct attr *attr;
struct bgp_damp_info *bdi;
char timebuf[BGP_UPTIME_LEN];
int len;
- if (!binfo->extra)
+ if (!path->extra)
return;
- bdi = binfo->extra->damp_info;
+ bdi = path->extra->damp_info;
/* short status lead text */
- route_vty_short_status_out(vty, binfo, json);
+ route_vty_short_status_out(vty, path, json);
/* print prefix and mask */
if (!use_json) {
@@ -7191,7 +7222,7 @@ static void flap_route_vty_out(struct vty *vty, struct prefix *p,
vty_out(vty, "%*s", 17, " ");
}
- len = vty_out(vty, "%s", binfo->peer->host);
+ len = vty_out(vty, "%s", path->peer->host);
len = 16 - len;
if (len < 1) {
if (!use_json)
@@ -7222,14 +7253,14 @@ static void flap_route_vty_out(struct vty *vty, struct prefix *p,
vty_out(vty, "%s ", peer_uptime(bdi->start_time, timebuf,
BGP_UPTIME_LEN, 0, NULL));
- if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)
- && !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED)
+ && !CHECK_FLAG(path->flags, BGP_PATH_HISTORY)) {
if (use_json)
- bgp_damp_reuse_time_vty(vty, binfo, timebuf,
+ bgp_damp_reuse_time_vty(vty, path, timebuf,
BGP_UPTIME_LEN, use_json, json);
else
vty_out(vty, "%s ",
- bgp_damp_reuse_time_vty(vty, binfo, timebuf,
+ bgp_damp_reuse_time_vty(vty, path, timebuf,
BGP_UPTIME_LEN,
use_json, json));
} else {
@@ -7238,7 +7269,7 @@ static void flap_route_vty_out(struct vty *vty, struct prefix *p,
}
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
if (attr) {
/* Print aspath */
if (attr->aspath) {
@@ -7315,7 +7346,7 @@ static void route_vty_out_advertised_to(struct vty *vty, struct peer *peer,
}
void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
- struct bgp_info *binfo, afi_t afi, safi_t safi,
+ struct bgp_path_info *path, afi_t afi, safi_t safi,
json_object *json_paths)
{
char buf[INET6_ADDRSTRLEN];
@@ -7343,9 +7374,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
int addpath_capable;
int has_adj;
unsigned int first_as;
- bool nexthop_self = CHECK_FLAG(binfo->flags, BGP_INFO_ANNC_NH_SELF)
- ? true
- : false;
+ bool nexthop_self =
+ CHECK_FLAG(path->flags, BGP_PATH_ANNC_NH_SELF) ? true : false;
if (json_paths) {
json_path = json_object_new_object();
@@ -7359,18 +7389,18 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
bgp_evpn_route2str((struct prefix_evpn *)p, buf2, sizeof(buf2));
vty_out(vty, " Route %s", buf2);
tag_buf[0] = '\0';
- if (binfo->extra && binfo->extra->num_labels) {
- bgp_evpn_label2str(binfo->extra->label,
- binfo->extra->num_labels, tag_buf,
+ if (path->extra && path->extra->num_labels) {
+ bgp_evpn_label2str(path->extra->label,
+ path->extra->num_labels, tag_buf,
sizeof(tag_buf));
vty_out(vty, " VNI %s", tag_buf);
}
vty_out(vty, "\n");
- if (binfo->extra && binfo->extra->parent) {
- struct bgp_info *parent_ri;
+ if (path->extra && path->extra->parent) {
+ struct bgp_path_info *parent_ri;
struct bgp_node *rn, *prn;
- parent_ri = (struct bgp_info *)binfo->extra->parent;
+ parent_ri = (struct bgp_path_info *)path->extra->parent;
rn = parent_ri->net;
if (rn && rn->prn) {
prn = rn->prn;
@@ -7383,7 +7413,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
}
- attr = binfo->attr;
+ attr = path->attr;
if (attr) {
/* Line1 display AS-path, Aggregator */
@@ -7403,7 +7433,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
}
- if (CHECK_FLAG(binfo->flags, BGP_INFO_REMOVED)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED)) {
if (json_paths)
json_object_boolean_true_add(json_path,
"removed");
@@ -7411,7 +7441,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, ", (removed)");
}
- if (CHECK_FLAG(binfo->flags, BGP_INFO_STALE)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_STALE)) {
if (json_paths)
json_object_boolean_true_add(json_path,
"stale");
@@ -7434,7 +7464,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
}
- if (CHECK_FLAG(binfo->peer->af_flags[afi][safi],
+ if (CHECK_FLAG(path->peer->af_flags[afi][safi],
PEER_FLAG_REFLECTOR_CLIENT)) {
if (json_paths)
json_object_boolean_true_add(
@@ -7443,7 +7473,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, ", (Received from a RR-client)");
}
- if (CHECK_FLAG(binfo->peer->af_flags[afi][safi],
+ if (CHECK_FLAG(path->peer->af_flags[afi][safi],
PEER_FLAG_RSERVER_CLIENT)) {
if (json_paths)
json_object_boolean_true_add(
@@ -7452,13 +7482,13 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, ", (Received from a RS-client)");
}
- if (CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_HISTORY)) {
if (json_paths)
json_object_boolean_true_add(
json_path, "dampeningHistoryEntry");
else
vty_out(vty, ", (history entry)");
- } else if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)) {
+ } else if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED)) {
if (json_paths)
json_object_boolean_true_add(
json_path, "dampeningSuppressed");
@@ -7520,21 +7550,21 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
/* Display the IGP cost or 'inaccessible' */
- if (!CHECK_FLAG(binfo->flags, BGP_INFO_VALID)) {
+ if (!CHECK_FLAG(path->flags, BGP_PATH_VALID)) {
if (json_paths)
json_object_boolean_false_add(
json_nexthop_global, "accessible");
else
vty_out(vty, " (inaccessible)");
} else {
- if (binfo->extra && binfo->extra->igpmetric) {
+ if (path->extra && path->extra->igpmetric) {
if (json_paths)
json_object_int_add(
json_nexthop_global, "metric",
- binfo->extra->igpmetric);
+ path->extra->igpmetric);
else
vty_out(vty, " (metric %u)",
- binfo->extra->igpmetric);
+ path->extra->igpmetric);
}
/* IGP cost is 0, display this only for json */
@@ -7551,7 +7581,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
/* Display peer "from" output */
/* This path was originated locally */
- if (binfo->peer == bgp->peer_self) {
+ if (path->peer == bgp->peer_self) {
if (safi == SAFI_EVPN
|| (p->family == AF_INET
@@ -7583,53 +7613,52 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
if (json_paths) {
json_object_string_add(
json_peer, "peerId",
- sockunion2str(&binfo->peer->su, buf,
+ sockunion2str(&path->peer->su, buf,
SU_ADDRSTRLEN));
json_object_string_add(
json_peer, "routerId",
inet_ntop(AF_INET,
- &binfo->peer->remote_id, buf1,
+ &path->peer->remote_id, buf1,
sizeof(buf1)));
- if (binfo->peer->hostname)
+ if (path->peer->hostname)
json_object_string_add(
json_peer, "hostname",
- binfo->peer->hostname);
+ path->peer->hostname);
- if (binfo->peer->domainname)
+ if (path->peer->domainname)
json_object_string_add(
json_peer, "domainname",
- binfo->peer->domainname);
+ path->peer->domainname);
- if (binfo->peer->conf_if)
+ if (path->peer->conf_if)
json_object_string_add(
json_peer, "interface",
- binfo->peer->conf_if);
+ path->peer->conf_if);
} else {
- if (binfo->peer->conf_if) {
- if (binfo->peer->hostname
+ if (path->peer->conf_if) {
+ if (path->peer->hostname
&& bgp_flag_check(
- binfo->peer->bgp,
+ path->peer->bgp,
BGP_FLAG_SHOW_HOSTNAME))
vty_out(vty, " from %s(%s)",
- binfo->peer->hostname,
- binfo->peer->conf_if);
+ path->peer->hostname,
+ path->peer->conf_if);
else
vty_out(vty, " from %s",
- binfo->peer->conf_if);
+ path->peer->conf_if);
} else {
- if (binfo->peer->hostname
+ if (path->peer->hostname
&& bgp_flag_check(
- binfo->peer->bgp,
+ path->peer->bgp,
BGP_FLAG_SHOW_HOSTNAME))
vty_out(vty, " from %s(%s)",
- binfo->peer->hostname,
- binfo->peer->host);
+ path->peer->hostname,
+ path->peer->host);
else
vty_out(vty, " from %s",
sockunion2str(
- &binfo->peer
- ->su,
+ &path->peer->su,
buf,
SU_ADDRSTRLEN));
}
@@ -7642,7 +7671,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, " (%s)",
inet_ntop(
AF_INET,
- &binfo->peer->remote_id,
+ &path->peer->remote_id,
buf1, sizeof(buf1)));
}
}
@@ -7650,18 +7679,18 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
/*
* Note when vrfid of nexthop is different from that of prefix
*/
- if (binfo->extra && binfo->extra->bgp_orig) {
- vrf_id_t nexthop_vrfid = binfo->extra->bgp_orig->vrf_id;
+ if (path->extra && path->extra->bgp_orig) {
+ vrf_id_t nexthop_vrfid = path->extra->bgp_orig->vrf_id;
if (json_paths) {
const char *vn;
- if (binfo->extra->bgp_orig->inst_type ==
- BGP_INSTANCE_TYPE_DEFAULT)
+ if (path->extra->bgp_orig->inst_type
+ == BGP_INSTANCE_TYPE_DEFAULT)
vn = "Default";
else
- vn = binfo->extra->bgp_orig->name;
+ vn = path->extra->bgp_orig->name;
json_object_string_add(json_path, "nhVrfName",
vn);
@@ -7778,13 +7807,13 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
attr->tag);
}
- if (!CHECK_FLAG(binfo->flags, BGP_INFO_VALID)) {
+ if (!CHECK_FLAG(path->flags, BGP_PATH_VALID)) {
if (json_paths)
json_object_boolean_false_add(json_path,
"valid");
else
vty_out(vty, ", invalid");
- } else if (!CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) {
+ } else if (!CHECK_FLAG(path->flags, BGP_PATH_HISTORY)) {
if (json_paths)
json_object_boolean_true_add(json_path,
"valid");
@@ -7792,8 +7821,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, ", valid");
}
- if (binfo->peer != bgp->peer_self) {
- if (binfo->peer->as == binfo->peer->local_as) {
+ if (path->peer != bgp->peer_self) {
+ if (path->peer->as == path->peer->local_as) {
if (CHECK_FLAG(bgp->config,
BGP_CONFIG_CONFEDERATION)) {
if (json_paths)
@@ -7813,7 +7842,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
} else {
if (bgp_confederation_peers_check(
- bgp, binfo->peer->as)) {
+ bgp, path->peer->as)) {
if (json_paths)
json_object_string_add(
json_peer, "type",
@@ -7830,7 +7859,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, ", external");
}
}
- } else if (binfo->sub_type == BGP_ROUTE_AGGREGATE) {
+ } else if (path->sub_type == BGP_ROUTE_AGGREGATE) {
if (json_paths) {
json_object_boolean_true_add(json_path,
"aggregated");
@@ -7839,7 +7868,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
} else {
vty_out(vty, ", aggregated, local");
}
- } else if (binfo->type != ZEBRA_ROUTE_BGP) {
+ } else if (path->type != ZEBRA_ROUTE_BGP) {
if (json_paths)
json_object_boolean_true_add(json_path,
"sourced");
@@ -7864,9 +7893,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, ", atomic-aggregate");
}
- if (CHECK_FLAG(binfo->flags, BGP_INFO_MULTIPATH)
- || (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED)
- && bgp_info_mpath_count(binfo))) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_MULTIPATH)
+ || (CHECK_FLAG(path->flags, BGP_PATH_SELECTED)
+ && bgp_path_info_mpath_count(path))) {
if (json_paths)
json_object_boolean_true_add(json_path,
"multipath");
@@ -7875,7 +7904,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
// Mark the bestpath(s)
- if (CHECK_FLAG(binfo->flags, BGP_INFO_DMED_SELECTED)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_DMED_SELECTED)) {
first_as = aspath_get_first_as(attr->aspath);
if (json_paths) {
@@ -7894,7 +7923,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
}
- if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_SELECTED)) {
if (json_paths) {
if (!json_bestpath)
json_bestpath =
@@ -8024,14 +8053,14 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
vty_out(vty, "\n");
}
- if (binfo->extra && binfo->extra->damp_info)
- bgp_damp_info_vty(vty, binfo, json_path);
+ if (path->extra && path->extra->damp_info)
+ bgp_damp_info_vty(vty, path, json_path);
/* Remote Label */
- if (binfo->extra && bgp_is_valid_label(&binfo->extra->label[0])
+ if (path->extra && bgp_is_valid_label(&path->extra->label[0])
&& safi != SAFI_EVPN) {
- mpls_label_t label =
- label_pton(&binfo->extra->label[0]);
+ mpls_label_t label = label_pton(&path->extra->label[0]);
+
if (json_paths)
json_object_int_add(json_path, "remoteLabel",
label);
@@ -8050,16 +8079,16 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
/* Line 8 display Addpath IDs */
- if (binfo->addpath_rx_id || binfo->addpath_tx_id) {
+ if (path->addpath_rx_id || path->addpath_tx_id) {
if (json_paths) {
json_object_int_add(json_path, "addpathRxId",
- binfo->addpath_rx_id);
+ path->addpath_rx_id);
json_object_int_add(json_path, "addpathTxId",
- binfo->addpath_tx_id);
+ path->addpath_tx_id);
} else {
vty_out(vty, " AddPath ID: RX %u, TX %u\n",
- binfo->addpath_rx_id,
- binfo->addpath_tx_id);
+ path->addpath_rx_id,
+ path->addpath_tx_id);
}
}
@@ -8072,12 +8101,12 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
addpath_capable =
bgp_addpath_encode_tx(peer, afi, safi);
has_adj = bgp_adj_out_lookup(
- peer, binfo->net, binfo->addpath_tx_id);
+ peer, path->net, path->addpath_tx_id);
if ((addpath_capable && has_adj)
|| (!addpath_capable && has_adj
- && CHECK_FLAG(binfo->flags,
- BGP_INFO_SELECTED))) {
+ && CHECK_FLAG(path->flags,
+ BGP_PATH_SELECTED))) {
if (json_path && !json_adv_to)
json_adv_to =
json_object_new_object();
@@ -8103,7 +8132,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
}
/* Line 9 display Uptime */
- tbuf = time(NULL) - (bgp_clock() - binfo->uptime);
+ tbuf = time(NULL) - (bgp_clock() - path->uptime);
if (json_paths) {
json_last_update = json_object_new_object();
json_object_int_add(json_last_update, "epoch", tbuf);
@@ -8191,7 +8220,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
unsigned long *total_cum,
unsigned long *json_header_depth)
{
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_node *rn;
int header = 1;
int display;
@@ -8236,19 +8265,19 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
else
json_paths = NULL;
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
total_count++;
if (type == bgp_show_type_flap_statistics
|| type == bgp_show_type_flap_neighbor
|| type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor) {
- if (!(ri->extra && ri->extra->damp_info))
+ if (!(pi->extra && pi->extra->damp_info))
continue;
}
if (type == bgp_show_type_regexp) {
regex_t *regex = output_arg;
- if (bgp_regexec(regex, ri->attr->aspath)
+ if (bgp_regexec(regex, pi->attr->aspath)
== REG_NOMATCH)
continue;
}
@@ -8262,23 +8291,23 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
if (type == bgp_show_type_filter_list) {
struct as_list *as_list = output_arg;
- if (as_list_apply(as_list, ri->attr->aspath)
+ if (as_list_apply(as_list, pi->attr->aspath)
!= AS_FILTER_PERMIT)
continue;
}
if (type == bgp_show_type_route_map) {
struct route_map *rmap = output_arg;
- struct bgp_info binfo;
+ struct bgp_path_info path;
struct attr dummy_attr;
int ret;
- bgp_attr_dup(&dummy_attr, ri->attr);
+ bgp_attr_dup(&dummy_attr, pi->attr);
- binfo.peer = ri->peer;
- binfo.attr = &dummy_attr;
+ path.peer = pi->peer;
+ path.attr = &dummy_attr;
ret = route_map_apply(rmap, &rn->p, RMAP_BGP,
- &binfo);
+ &path);
if (ret == RMAP_DENYMATCH)
continue;
}
@@ -8287,9 +8316,9 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
|| type == bgp_show_type_damp_neighbor) {
union sockunion *su = output_arg;
- if (ri->peer == NULL
- || ri->peer->su_remote == NULL
- || !sockunion_same(ri->peer->su_remote, su))
+ if (pi->peer == NULL
+ || pi->peer->su_remote == NULL
+ || !sockunion_same(pi->peer->su_remote, su))
continue;
}
if (type == bgp_show_type_cidr_only) {
@@ -8312,28 +8341,28 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
continue;
}
if (type == bgp_show_type_community_all) {
- if (!ri->attr->community)
+ if (!pi->attr->community)
continue;
}
if (type == bgp_show_type_community) {
struct community *com = output_arg;
- if (!ri->attr->community
- || !community_match(ri->attr->community,
+ if (!pi->attr->community
+ || !community_match(pi->attr->community,
com))
continue;
}
if (type == bgp_show_type_community_exact) {
struct community *com = output_arg;
- if (!ri->attr->community
- || !community_cmp(ri->attr->community, com))
+ if (!pi->attr->community
+ || !community_cmp(pi->attr->community, com))
continue;
}
if (type == bgp_show_type_community_list) {
struct community_list *list = output_arg;
- if (!community_list_match(ri->attr->community,
+ if (!community_list_match(pi->attr->community,
list))
continue;
}
@@ -8341,32 +8370,32 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
struct community_list *list = output_arg;
if (!community_list_exact_match(
- ri->attr->community, list))
+ pi->attr->community, list))
continue;
}
if (type == bgp_show_type_lcommunity) {
struct lcommunity *lcom = output_arg;
- if (!ri->attr->lcommunity
- || !lcommunity_match(ri->attr->lcommunity,
+ if (!pi->attr->lcommunity
+ || !lcommunity_match(pi->attr->lcommunity,
lcom))
continue;
}
if (type == bgp_show_type_lcommunity_list) {
struct community_list *list = output_arg;
- if (!lcommunity_list_match(ri->attr->lcommunity,
+ if (!lcommunity_list_match(pi->attr->lcommunity,
list))
continue;
}
if (type == bgp_show_type_lcommunity_all) {
- if (!ri->attr->lcommunity)
+ if (!pi->attr->lcommunity)
continue;
}
if (type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor) {
- if (!CHECK_FLAG(ri->flags, BGP_INFO_DAMPED)
- || CHECK_FLAG(ri->flags, BGP_INFO_HISTORY))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_DAMPED)
+ || CHECK_FLAG(pi->flags, BGP_PATH_HISTORY))
continue;
}
@@ -8401,14 +8430,14 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
}
if (type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor)
- damp_route_vty_out(vty, &rn->p, ri, display,
+ damp_route_vty_out(vty, &rn->p, pi, display,
safi, use_json, json_paths);
else if (type == bgp_show_type_flap_statistics
|| type == bgp_show_type_flap_neighbor)
- flap_route_vty_out(vty, &rn->p, ri, display,
+ flap_route_vty_out(vty, &rn->p, pi, display,
safi, use_json, json_paths);
else
- route_vty_out(vty, &rn->p, ri, display, safi,
+ route_vty_out(vty, &rn->p, pi, display, safi,
json_paths);
display++;
}
@@ -8593,7 +8622,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
struct bgp_node *rn, struct prefix_rd *prd,
afi_t afi, safi_t safi, json_object *json)
{
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct prefix *p;
struct peer *peer;
struct listnode *node, *nnode;
@@ -8660,23 +8689,45 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
vty_out(vty, "not allocated\n");
}
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
count++;
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
best = count;
- if (ri->extra && ri->extra->suppress)
+ if (pi->extra && pi->extra->suppress)
suppress = 1;
- if (ri->attr->community != NULL) {
- if (community_include(ri->attr->community,
- COMMUNITY_NO_ADVERTISE))
- no_advertise = 1;
- if (community_include(ri->attr->community,
- COMMUNITY_NO_EXPORT))
- no_export = 1;
- if (community_include(ri->attr->community,
- COMMUNITY_LOCAL_AS))
- local_as = 1;
- }
+
+ if (pi->attr->community == NULL)
+ continue;
+
+ no_advertise += community_include(
+ pi->attr->community, COMMUNITY_NO_ADVERTISE);
+ no_export += community_include(pi->attr->community,
+ COMMUNITY_NO_EXPORT);
+ local_as += community_include(pi->attr->community,
+ COMMUNITY_LOCAL_AS);
+ accept_own += community_include(pi->attr->community,
+ COMMUNITY_ACCEPT_OWN);
+ route_filter_translated_v4 += community_include(
+ pi->attr->community,
+ COMMUNITY_ROUTE_FILTER_TRANSLATED_v4);
+ route_filter_translated_v6 += community_include(
+ pi->attr->community,
+ COMMUNITY_ROUTE_FILTER_TRANSLATED_v6);
+ route_filter_v4 += community_include(
+ pi->attr->community, COMMUNITY_ROUTE_FILTER_v4);
+ route_filter_v6 += community_include(
+ pi->attr->community, COMMUNITY_ROUTE_FILTER_v6);
+ llgr_stale += community_include(pi->attr->community,
+ COMMUNITY_LLGR_STALE);
+ no_llgr += community_include(pi->attr->community,
+ COMMUNITY_NO_LLGR);
+ accept_own_nexthop +=
+ community_include(pi->attr->community,
+ COMMUNITY_ACCEPT_OWN_NEXTHOP);
+ blackhole += community_include(pi->attr->community,
+ COMMUNITY_BLACKHOLE);
+ no_peer += community_include(pi->attr->community,
+ COMMUNITY_NO_PEER);
}
}
@@ -8779,7 +8830,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
struct prefix match;
struct bgp_node *rn;
struct bgp_node *rm;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_table *table;
json_object *json = NULL;
json_object *json_paths = NULL;
@@ -8817,7 +8868,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
continue;
}
- for (ri = rm->info; ri; ri = ri->next) {
+ for (pi = rm->info; pi; pi = pi->next) {
if (header) {
route_vty_out_detail_header(
vty, bgp, rm,
@@ -8827,17 +8878,17 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
}
display++;
- if (pathtype == BGP_PATH_ALL
- || (pathtype == BGP_PATH_BESTPATH
- && CHECK_FLAG(ri->flags,
- BGP_INFO_SELECTED))
- || (pathtype == BGP_PATH_MULTIPATH
- && (CHECK_FLAG(ri->flags,
- BGP_INFO_MULTIPATH)
- || CHECK_FLAG(ri->flags,
- BGP_INFO_SELECTED))))
+ if (pathtype == BGP_PATH_SHOW_ALL
+ || (pathtype == BGP_PATH_SHOW_BESTPATH
+ && CHECK_FLAG(pi->flags,
+ BGP_PATH_SELECTED))
+ || (pathtype == BGP_PATH_SHOW_MULTIPATH
+ && (CHECK_FLAG(pi->flags,
+ BGP_PATH_MULTIPATH)
+ || CHECK_FLAG(pi->flags,
+ BGP_PATH_SELECTED))))
route_vty_out_detail(vty, bgp, &rm->p,
- ri, AFI_IP, safi,
+ pi, AFI_IP, safi,
json_paths);
}
@@ -8855,7 +8906,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
if ((rn = bgp_node_match(rib, &match)) != NULL) {
if (!prefix_check
|| rn->p.prefixlen == match.prefixlen) {
- for (ri = rn->info; ri; ri = ri->next) {
+ for (pi = rn->info; pi; pi = pi->next) {
if (header) {
route_vty_out_detail_header(
vty, bgp, rn, NULL, afi,
@@ -8864,20 +8915,22 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
}
display++;
- if (pathtype == BGP_PATH_ALL
- || (pathtype == BGP_PATH_BESTPATH
+ if (pathtype == BGP_PATH_SHOW_ALL
+ || (pathtype
+ == BGP_PATH_SHOW_BESTPATH
&& CHECK_FLAG(
- ri->flags,
- BGP_INFO_SELECTED))
- || (pathtype == BGP_PATH_MULTIPATH
+ pi->flags,
+ BGP_PATH_SELECTED))
+ || (pathtype
+ == BGP_PATH_SHOW_MULTIPATH
&& (CHECK_FLAG(
- ri->flags,
- BGP_INFO_MULTIPATH)
+ pi->flags,
+ BGP_PATH_MULTIPATH)
|| CHECK_FLAG(
- ri->flags,
- BGP_INFO_SELECTED))))
+ pi->flags,
+ BGP_PATH_SELECTED))))
route_vty_out_detail(
- vty, bgp, &rn->p, ri,
+ vty, bgp, &rn->p, pi,
afi, safi, json_paths);
}
}
@@ -9087,10 +9140,6 @@ DEFUN (show_ip_bgp,
|prefix-list WORD\
|filter-list WORD\
|statistics\
- |community <AA:NN|local-AS|no-advertise|no-export|graceful-shutdown\
- no-peer|blackhole|llgr-stale|no-llgr|accept-own|accept-own-nexthop\
- route-filter-v6|route-filter-v4|route-filter-translated-v6|\
- route-filter-translated-v4> [exact-match]\
|community-list <(1-500)|WORD> [exact-match]\
|A.B.C.D/M longer-prefixes\
|X:X::X:X/M longer-prefixes\
@@ -9110,23 +9159,6 @@ DEFUN (show_ip_bgp,
"Display routes conforming to the filter-list\n"
"Regular expression access list name\n"
"BGP RIB advertisement statistics\n"
- "Display routes matching the communities\n"
- COMMUNITY_AANN_STR
- "Do not send outside local AS (well-known community)\n"
- "Do not advertise to any peer (well-known community)\n"
- "Do not export to next AS (well-known community)\n"
- "Graceful shutdown (well-known community)\n"
- "Do not export to any peer (well-known community)\n"
- "Inform EBGP peers to blackhole traffic to prefix (well-known community)\n"
- "Staled Long-lived Graceful Restart VPN route (well-known community)\n"
- "Removed because Long-lived Graceful Restart was not enabled for VPN route (well-known community)\n"
- "Should accept local VPN route if exported and imported into different VRF (well-known community)\n"
- "Should accept VPN route with local nexthop (well-known community)\n"
- "RT VPNv6 route filtering (well-known community)\n"
- "RT VPNv4 route filtering (well-known community)\n"
- "RT translated VPNv6 route filtering (well-known community)\n"
- "RT translated VPNv4 route filtering (well-known community)\n"
- "Exact match of the communities\n"
"Display routes matching the community-list\n"
"community-list number\n"
"community-list name\n"
@@ -9188,11 +9220,14 @@ DEFUN (show_ip_bgp,
DEFUN (show_ip_bgp_json,
show_ip_bgp_json_cmd,
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]\
- [<\
- cidr-only\
- |dampening <flap-statistics|dampened-paths>\
- |community [<AA:NN|local-AS|no-advertise|no-export|graceful-shutdown>] [exact-match]\
- >] [json]",
+ [cidr-only\
+ |dampening <flap-statistics|dampened-paths>\
+ |community [AA:NN|local-AS|no-advertise|no-export\
+ |graceful-shutdown|no-peer|blackhole|llgr-stale|no-llgr\
+ |accept-own|accept-own-nexthop|route-filter-v6\
+ |route-filter-v4|route-filter-translated-v6\
+ |route-filter-translated-v4] [exact-match]\
+ ] [json]",
SHOW_STR
IP_STR
BGP_STR
@@ -9209,6 +9244,16 @@ DEFUN (show_ip_bgp_json,
"Do not advertise to any peer (well-known community)\n"
"Do not export to next AS (well-known community)\n"
"Graceful shutdown (well-known community)\n"
+ "Do not export to any peer (well-known community)\n"
+ "Inform EBGP peers to blackhole traffic to prefix (well-known community)\n"
+ "Staled Long-lived Graceful Restart VPN route (well-known community)\n"
+ "Removed because Long-lived Graceful Restart was not enabled for VPN route (well-known community)\n"
+ "Should accept local VPN route if exported and imported into different VRF (well-known community)\n"
+ "Should accept VPN route with local nexthop (well-known community)\n"
+ "RT VPNv6 route filtering (well-known community)\n"
+ "RT VPNv4 route filtering (well-known community)\n"
+ "RT translated VPNv6 route filtering (well-known community)\n"
+ "RT translated VPNv4 route filtering (well-known community)\n"
"Exact match of the communities\n"
JSON_STR)
{
@@ -9217,7 +9262,6 @@ DEFUN (show_ip_bgp_json,
enum bgp_show_type sh_type = bgp_show_type_normal;
struct bgp *bgp = NULL;
int idx = 0;
- int idx_community_type = 0;
int exact_match = 0;
bool uj = use_json(argc, argv);
@@ -9244,29 +9288,23 @@ DEFUN (show_ip_bgp_json,
}
if (argv_find(argv, argc, "community", &idx)) {
+ char *maybecomm = idx + 1 < argc ? argv[idx + 1]->text : NULL;
+ char *community = NULL;
- /* show a specific community */
- if (argv_find(argv, argc, "local-AS", &idx_community_type) ||
- argv_find(argv, argc, "no-advertise",
- &idx_community_type) ||
- argv_find(argv, argc, "no-export",
- &idx_community_type) ||
- argv_find(argv, argc, "graceful-shutdown",
- &idx_community_type) ||
- argv_find(argv, argc, "AA:NN", &idx_community_type)) {
- if (argv_find(argv, argc, "exact-match", &idx))
- exact_match = 1;
-
- return (bgp_show_community(vty, bgp,
- argv[idx_community_type]->arg,
- exact_match, afi, safi, uj));
- } else {
+ if (maybecomm && !strmatch(maybecomm, "json")
+ && !strmatch(maybecomm, "exact-match"))
+ community = maybecomm;
+
+ if (argv_find(argv, argc, "exact-match", &idx))
+ exact_match = 1;
- /* show all communities */
+ if (community)
+ return bgp_show_community(vty, bgp, community,
+ exact_match, afi, safi, uj);
+ else
return (bgp_show(vty, bgp, afi, safi,
- bgp_show_type_community_all, NULL,
- uj));
- }
+ bgp_show_type_community_all, NULL,
+ uj));
}
return bgp_show(vty, bgp, afi, safi, sh_type, NULL, uj);
@@ -9337,11 +9375,11 @@ DEFUN (show_ip_bgp_route,
/* [<bestpath|multipath>] */
if (argv_find(argv, argc, "bestpath", &idx))
- path_type = BGP_PATH_BESTPATH;
+ path_type = BGP_PATH_SHOW_BESTPATH;
else if (argv_find(argv, argc, "multipath", &idx))
- path_type = BGP_PATH_MULTIPATH;
+ path_type = BGP_PATH_SHOW_MULTIPATH;
else
- path_type = BGP_PATH_ALL;
+ path_type = BGP_PATH_SHOW_ALL;
return bgp_show_route(vty, bgp, prefix, afi, safi, NULL, prefix_check,
path_type, uj);
@@ -9670,9 +9708,9 @@ static int bgp_table_stats_walker(struct thread *t)
ts->counts[BGP_STATS_MAXBITLEN] = space;
for (rn = top; rn; rn = bgp_route_next(rn)) {
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
struct bgp_node *prn = bgp_node_parent_nolock(rn);
- unsigned int rinum = 0;
+ unsigned int pinum = 0;
if (rn == top)
continue;
@@ -9703,23 +9741,23 @@ static int bgp_table_stats_walker(struct thread *t)
} else if (prn->info)
ts->counts[BGP_STATS_MAX_AGGREGATEABLE]++;
- for (ri = rn->info; ri; ri = ri->next) {
- rinum++;
+ for (pi = rn->info; pi; pi = pi->next) {
+ pinum++;
ts->counts[BGP_STATS_RIB]++;
- if (ri->attr
- && (CHECK_FLAG(ri->attr->flag,
+ if (pi->attr
+ && (CHECK_FLAG(pi->attr->flag,
ATTR_FLAG_BIT(
BGP_ATTR_ATOMIC_AGGREGATE))))
ts->counts[BGP_STATS_AGGREGATES]++;
/* as-path stats */
- if (ri->attr && ri->attr->aspath) {
+ if (pi->attr && pi->attr->aspath) {
unsigned int hops =
- aspath_count_hops(ri->attr->aspath);
+ aspath_count_hops(pi->attr->aspath);
unsigned int size =
- aspath_size(ri->attr->aspath);
- as_t highest = aspath_highest(ri->attr->aspath);
+ aspath_size(pi->attr->aspath);
+ as_t highest = aspath_highest(pi->attr->aspath);
ts->counts[BGP_STATS_ASPATH_COUNT]++;
@@ -9880,39 +9918,39 @@ static int bgp_peer_count_walker(struct thread *t)
for (rn = bgp_table_top(pc->table); rn; rn = bgp_route_next(rn)) {
struct bgp_adj_in *ain;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
for (ain = rn->adj_in; ain; ain = ain->next)
if (ain->peer == peer)
pc->count[PCOUNT_ADJ_IN]++;
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->peer != peer)
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->peer != peer)
continue;
pc->count[PCOUNT_ALL]++;
- if (CHECK_FLAG(ri->flags, BGP_INFO_DAMPED))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_DAMPED))
pc->count[PCOUNT_DAMPED]++;
- if (CHECK_FLAG(ri->flags, BGP_INFO_HISTORY))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_HISTORY))
pc->count[PCOUNT_HISTORY]++;
- if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
pc->count[PCOUNT_REMOVED]++;
- if (CHECK_FLAG(ri->flags, BGP_INFO_STALE))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_STALE))
pc->count[PCOUNT_STALE]++;
- if (CHECK_FLAG(ri->flags, BGP_INFO_VALID))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_VALID))
pc->count[PCOUNT_VALID]++;
- if (!CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_UNUSEABLE))
pc->count[PCOUNT_PFCNT]++;
- if (CHECK_FLAG(ri->flags, BGP_INFO_COUNTED)) {
+ if (CHECK_FLAG(pi->flags, BGP_PATH_COUNTED)) {
pc->count[PCOUNT_COUNTED]++;
- if (CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
+ if (CHECK_FLAG(pi->flags, BGP_PATH_UNUSEABLE))
flog_err(
EC_LIB_DEVELOPMENT,
"Attempting to count but flags say it is unusable");
} else {
- if (!CHECK_FLAG(ri->flags, BGP_INFO_UNUSEABLE))
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_UNUSEABLE))
flog_err(
EC_LIB_DEVELOPMENT,
"Not counted but flags say we should");
@@ -10108,7 +10146,7 @@ DEFUN (show_ip_bgp_vpn_all_route_prefix,
}
return bgp_show_route(vty, bgp, network, AFI_IP, SAFI_MPLS_VPN, NULL, 0,
- BGP_PATH_ALL, use_json(argc, argv));
+ BGP_PATH_SHOW_ALL, use_json(argc, argv));
}
#endif /* KEEP_OLD_VPN_COMMANDS */
@@ -10137,7 +10175,7 @@ DEFUN (show_ip_bgp_l2vpn_evpn_all_route_prefix,
return CMD_WARNING;
}
return bgp_show_route(vty, NULL, network, AFI_L2VPN, SAFI_EVPN, NULL, 0,
- BGP_PATH_ALL, use_json(argc, argv));
+ BGP_PATH_SHOW_ALL, use_json(argc, argv));
}
static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
@@ -10750,7 +10788,7 @@ DEFUN (show_bgp_afi_vpn_rd_route,
}
return bgp_show_route(vty, NULL, argv[6]->arg, afi, SAFI_MPLS_VPN, &prd,
- 0, BGP_PATH_ALL, use_json(argc, argv));
+ 0, BGP_PATH_SHOW_ALL, use_json(argc, argv));
}
static struct bgp_distance *bgp_distance_new(void)
@@ -10857,8 +10895,8 @@ static int bgp_distance_unset(struct vty *vty, const char *distance_str,
}
/* Apply BGP information to distance method. */
-uint8_t bgp_distance_apply(struct prefix *p, struct bgp_info *rinfo, afi_t afi,
- safi_t safi, struct bgp *bgp)
+uint8_t bgp_distance_apply(struct prefix *p, struct bgp_path_info *pinfo,
+ afi_t afi, safi_t safi, struct bgp *bgp)
{
struct bgp_node *rn;
struct prefix q;
@@ -10870,7 +10908,7 @@ uint8_t bgp_distance_apply(struct prefix *p, struct bgp_info *rinfo, afi_t afi,
if (!bgp)
return 0;
- peer = rinfo->peer;
+ peer = pinfo->peer;
/* Check source address. */
sockunion2hostprefix(&peer->su, &q);
@@ -11136,8 +11174,8 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
struct prefix match;
struct bgp_node *rn;
struct bgp_node *rm;
- struct bgp_info *ri;
- struct bgp_info *ri_temp;
+ struct bgp_path_info *pi;
+ struct bgp_path_info *pi_temp;
struct bgp *bgp;
struct bgp_table *table;
@@ -11179,16 +11217,16 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
if (!prefix_check
|| rm->p.prefixlen == match.prefixlen) {
- ri = rm->info;
- while (ri) {
- if (ri->extra && ri->extra->damp_info) {
- ri_temp = ri->next;
+ pi = rm->info;
+ while (pi) {
+ if (pi->extra && pi->extra->damp_info) {
+ pi_temp = pi->next;
bgp_damp_info_free(
- ri->extra->damp_info,
+ pi->extra->damp_info,
1);
- ri = ri_temp;
+ pi = pi_temp;
} else
- ri = ri->next;
+ pi = pi->next;
}
}
@@ -11199,16 +11237,16 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
!= NULL) {
if (!prefix_check
|| rn->p.prefixlen == match.prefixlen) {
- ri = rn->info;
- while (ri) {
- if (ri->extra && ri->extra->damp_info) {
- ri_temp = ri->next;
+ pi = rn->info;
+ while (pi) {
+ if (pi->extra && pi->extra->damp_info) {
+ pi_temp = pi->next;
bgp_damp_info_free(
- ri->extra->damp_info,
+ pi->extra->damp_info,
1);
- ri = ri_temp;
+ pi = pi_temp;
} else
- ri = ri->next;
+ pi = pi->next;
}
}
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 476bb3aa05..f0edc8d49a 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -72,11 +72,11 @@ enum bgp_show_adj_route_type {
*/
#define BGP_MAX_LABELS 2
-/* Ancillary information to struct bgp_info,
+/* Ancillary information to struct bgp_path_info,
* used for uncommonly used data (aggregation, MPLS, etc.)
* and lazily allocated to save memory.
*/
-struct bgp_info_extra {
+struct bgp_path_info_extra {
/* Pointer to dampening structure. */
struct bgp_damp_info *damp_info;
@@ -150,13 +150,13 @@ struct bgp_info_extra {
struct list *bgp_fs_pbr;
};
-struct bgp_info {
+struct bgp_path_info {
/* For linked list. */
- struct bgp_info *next;
- struct bgp_info *prev;
+ struct bgp_path_info *next;
+ struct bgp_path_info *prev;
/* For nexthop linked list */
- LIST_ENTRY(bgp_info) nh_thread;
+ LIST_ENTRY(bgp_path_info) nh_thread;
/* Back pointer to the prefix node */
struct bgp_node *net;
@@ -171,11 +171,11 @@ struct bgp_info {
struct attr *attr;
/* Extra information */
- struct bgp_info_extra *extra;
+ struct bgp_path_info_extra *extra;
/* Multipath information */
- struct bgp_info_mpath *mpath;
+ struct bgp_path_info_mpath *mpath;
/* Uptime. */
time_t uptime;
@@ -185,21 +185,21 @@ struct bgp_info {
/* BGP information status. */
uint16_t flags;
-#define BGP_INFO_IGP_CHANGED (1 << 0)
-#define BGP_INFO_DAMPED (1 << 1)
-#define BGP_INFO_HISTORY (1 << 2)
-#define BGP_INFO_SELECTED (1 << 3)
-#define BGP_INFO_VALID (1 << 4)
-#define BGP_INFO_ATTR_CHANGED (1 << 5)
-#define BGP_INFO_DMED_CHECK (1 << 6)
-#define BGP_INFO_DMED_SELECTED (1 << 7)
-#define BGP_INFO_STALE (1 << 8)
-#define BGP_INFO_REMOVED (1 << 9)
-#define BGP_INFO_COUNTED (1 << 10)
-#define BGP_INFO_MULTIPATH (1 << 11)
-#define BGP_INFO_MULTIPATH_CHG (1 << 12)
-#define BGP_INFO_RIB_ATTR_CHG (1 << 13)
-#define BGP_INFO_ANNC_NH_SELF (1 << 14)
+#define BGP_PATH_IGP_CHANGED (1 << 0)
+#define BGP_PATH_DAMPED (1 << 1)
+#define BGP_PATH_HISTORY (1 << 2)
+#define BGP_PATH_SELECTED (1 << 3)
+#define BGP_PATH_VALID (1 << 4)
+#define BGP_PATH_ATTR_CHANGED (1 << 5)
+#define BGP_PATH_DMED_CHECK (1 << 6)
+#define BGP_PATH_DMED_SELECTED (1 << 7)
+#define BGP_PATH_STALE (1 << 8)
+#define BGP_PATH_REMOVED (1 << 9)
+#define BGP_PATH_COUNTED (1 << 10)
+#define BGP_PATH_MULTIPATH (1 << 11)
+#define BGP_PATH_MULTIPATH_CHG (1 << 12)
+#define BGP_PATH_RIB_ATTR_CHG (1 << 13)
+#define BGP_PATH_ANNC_NH_SELF (1 << 14)
/* BGP route type. This can be static, RIP, OSPF, BGP etc. */
uint8_t type;
@@ -224,9 +224,9 @@ struct bgp_info {
};
/* Structure used in BGP path selection */
-struct bgp_info_pair {
- struct bgp_info *old;
- struct bgp_info *new;
+struct bgp_path_info_pair {
+ struct bgp_path_info *old;
+ struct bgp_path_info *new;
};
/* BGP static route configuration. */
@@ -277,20 +277,20 @@ struct bgp_static {
#define BGP_ATTR_NEXTHOP_AFI_IP6(attr) \
(!CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) \
&& ((attr)->mp_nexthop_len == 16 || (attr)->mp_nexthop_len == 32))
-#define BGP_INFO_COUNTABLE(BI) \
- (!CHECK_FLAG((BI)->flags, BGP_INFO_HISTORY) \
- && !CHECK_FLAG((BI)->flags, BGP_INFO_REMOVED))
+#define BGP_PATH_COUNTABLE(BI) \
+ (!CHECK_FLAG((BI)->flags, BGP_PATH_HISTORY) \
+ && !CHECK_FLAG((BI)->flags, BGP_PATH_REMOVED))
/* Flags which indicate a route is unuseable in some form */
-#define BGP_INFO_UNUSEABLE \
- (BGP_INFO_HISTORY | BGP_INFO_DAMPED | BGP_INFO_REMOVED)
+#define BGP_PATH_UNUSEABLE \
+ (BGP_PATH_HISTORY | BGP_PATH_DAMPED | BGP_PATH_REMOVED)
/* Macro to check BGP information is alive or not. Sadly,
* not equivalent to just checking previous, because of the
* sense of the additional VALID flag.
*/
-#define BGP_INFO_HOLDDOWN(BI) \
- (!CHECK_FLAG((BI)->flags, BGP_INFO_VALID) \
- || CHECK_FLAG((BI)->flags, BGP_INFO_UNUSEABLE))
+#define BGP_PATH_HOLDDOWN(BI) \
+ (!CHECK_FLAG((BI)->flags, BGP_PATH_VALID) \
+ || CHECK_FLAG((BI)->flags, BGP_PATH_UNUSEABLE))
#define DISTRIBUTE_IN_NAME(F) ((F)->dlist[FILTER_IN].name)
#define DISTRIBUTE_IN(F) ((F)->dlist[FILTER_IN].alist)
@@ -318,7 +318,11 @@ struct bgp_static {
/* path PREFIX (addpath rxid NUMBER) */
#define PATH_ADDPATH_STR_BUFFER PREFIX2STR_BUFFER + 32
-enum bgp_path_type { BGP_PATH_ALL, BGP_PATH_BESTPATH, BGP_PATH_MULTIPATH };
+enum bgp_path_type {
+ BGP_PATH_SHOW_ALL,
+ BGP_PATH_SHOW_BESTPATH,
+ BGP_PATH_SHOW_MULTIPATH
+};
static inline void bgp_bump_version(struct bgp_node *node)
{
@@ -335,7 +339,7 @@ static inline int bgp_fibupd_safi(safi_t safi)
}
/* Prototypes. */
-extern void bgp_rib_remove(struct bgp_node *rn, struct bgp_info *ri,
+extern void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *peer, afi_t afi, safi_t safi);
extern void bgp_process_queue_init(void);
extern void bgp_route_init(void);
@@ -354,15 +358,19 @@ extern void bgp_clear_stale_route(struct peer *, afi_t, safi_t);
extern struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
safi_t safi, struct prefix *p,
struct prefix_rd *prd);
-extern struct bgp_info *bgp_info_lock(struct bgp_info *);
-extern struct bgp_info *bgp_info_unlock(struct bgp_info *);
-extern void bgp_info_add(struct bgp_node *rn, struct bgp_info *ri);
-extern void bgp_info_reap(struct bgp_node *rn, struct bgp_info *ri);
-extern void bgp_info_delete(struct bgp_node *rn, struct bgp_info *ri);
-extern struct bgp_info_extra *bgp_info_extra_get(struct bgp_info *);
-extern void bgp_info_set_flag(struct bgp_node *, struct bgp_info *, uint32_t);
-extern void bgp_info_unset_flag(struct bgp_node *, struct bgp_info *, uint32_t);
-extern void bgp_info_path_with_addpath_rx_str(struct bgp_info *ri, char *buf);
+extern struct bgp_path_info *bgp_path_info_lock(struct bgp_path_info *path);
+extern struct bgp_path_info *bgp_path_info_unlock(struct bgp_path_info *path);
+extern void bgp_path_info_add(struct bgp_node *rn, struct bgp_path_info *pi);
+extern void bgp_path_info_reap(struct bgp_node *rn, struct bgp_path_info *pi);
+extern void bgp_path_info_delete(struct bgp_node *rn, struct bgp_path_info *pi);
+extern struct bgp_path_info_extra *
+bgp_path_info_extra_get(struct bgp_path_info *path);
+extern void bgp_path_info_set_flag(struct bgp_node *rn,
+ struct bgp_path_info *path, uint32_t flag);
+extern void bgp_path_info_unset_flag(struct bgp_node *rn,
+ struct bgp_path_info *path, uint32_t flag);
+extern void bgp_path_info_path_with_addpath_rx_str(struct bgp_path_info *pi,
+ char *buf);
extern int bgp_nlri_parse_ip(struct peer *, struct attr *, struct bgp_nlri *);
@@ -416,38 +424,44 @@ extern void bgp_config_write_network(struct vty *, struct bgp *, afi_t, safi_t);
extern void bgp_config_write_distance(struct vty *, struct bgp *, afi_t,
safi_t);
-extern void bgp_aggregate_increment(struct bgp *, struct prefix *,
- struct bgp_info *, afi_t, safi_t);
-extern void bgp_aggregate_decrement(struct bgp *, struct prefix *,
- struct bgp_info *, afi_t, safi_t);
+extern void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
+ struct bgp_path_info *path, afi_t afi,
+ safi_t safi);
+extern void bgp_aggregate_decrement(struct bgp *bgp, struct prefix *p,
+ struct bgp_path_info *path, afi_t afi,
+ safi_t safi);
-extern uint8_t bgp_distance_apply(struct prefix *, struct bgp_info *, afi_t,
- safi_t, struct bgp *);
+extern uint8_t bgp_distance_apply(struct prefix *p, struct bgp_path_info *path,
+ afi_t afi, safi_t safi, struct bgp *bgp);
extern afi_t bgp_node_afi(struct vty *);
extern safi_t bgp_node_safi(struct vty *);
-extern struct bgp_info *info_make(int type, int sub_type,
- unsigned short instance, struct peer *peer,
- struct attr *attr, struct bgp_node *rn);
-
-extern void route_vty_out(struct vty *, struct prefix *, struct bgp_info *, int,
- safi_t, json_object *);
-extern void route_vty_out_tag(struct vty *, struct prefix *, struct bgp_info *,
- int, safi_t, json_object *);
+extern struct bgp_path_info *info_make(int type, int sub_type,
+ unsigned short instance,
+ struct peer *peer, struct attr *attr,
+ struct bgp_node *rn);
+
+extern void route_vty_out(struct vty *vty, struct prefix *p,
+ struct bgp_path_info *path, int display, safi_t safi,
+ json_object *json_paths);
+extern void route_vty_out_tag(struct vty *vty, struct prefix *p,
+ struct bgp_path_info *path, int display,
+ safi_t safi, json_object *json);
extern void route_vty_out_tmp(struct vty *vty, struct prefix *p,
struct attr *attr, safi_t safi, bool use_json,
json_object *json_ar);
extern void route_vty_out_overlay(struct vty *vty, struct prefix *p,
- struct bgp_info *binfo, int display,
+ struct bgp_path_info *path, int display,
json_object *json);
extern int subgroup_process_announce_selected(struct update_subgroup *subgrp,
- struct bgp_info *selected,
+ struct bgp_path_info *selected,
struct bgp_node *rn,
uint32_t addpath_tx_id);
-extern int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri,
+extern int subgroup_announce_check(struct bgp_node *rn,
+ struct bgp_path_info *pi,
struct update_subgroup *subgrp,
struct prefix *p, struct attr *attr);
@@ -458,28 +472,30 @@ extern void bgp_process_queues_drain_immediate(void);
extern struct bgp_node *bgp_afi_node_lookup(struct bgp_table *table, afi_t afi,
safi_t safi, struct prefix *p,
struct prefix_rd *prd);
-extern struct bgp_info *bgp_info_new(void);
-extern void bgp_info_restore(struct bgp_node *, struct bgp_info *);
-
-extern int bgp_info_cmp_compatible(struct bgp *, struct bgp_info *,
- struct bgp_info *, char *pfx_buf, afi_t afi,
- safi_t safi);
+extern struct bgp_path_info *bgp_path_info_new(void);
+extern void bgp_path_info_restore(struct bgp_node *rn,
+ struct bgp_path_info *path);
+
+extern int bgp_path_info_cmp_compatible(struct bgp *bgp,
+ struct bgp_path_info *new,
+ struct bgp_path_info *exist,
+ char *pfx_buf, afi_t afi, safi_t safi);
extern void bgp_attr_add_gshut_community(struct attr *attr);
extern void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
struct bgp_maxpaths_cfg *mpath_cfg,
- struct bgp_info_pair *result, afi_t afi,
+ struct bgp_path_info_pair *result, afi_t afi,
safi_t safi);
extern void bgp_zebra_clear_route_change_flags(struct bgp_node *rn);
extern int bgp_zebra_has_route_changed(struct bgp_node *rn,
- struct bgp_info *selected);
+ struct bgp_path_info *selected);
extern void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
struct bgp_node *rn,
struct prefix_rd *prd, afi_t afi,
safi_t safi, json_object *json);
extern void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
- struct prefix *p, struct bgp_info *binfo,
+ struct prefix *p, struct bgp_path_info *path,
afi_t afi, safi_t safi,
json_object *json_paths);
extern int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 0a3e4b3c89..d468d48d86 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -233,7 +233,7 @@ struct bgp_match_peer_compiled {
/* 'match peer (A.B.C.D|X:X::X:X|WORD)' */
/* Compares the peer specified in the 'match peer' clause with the peer
- received in bgp_info->peer. If it is the same, or if the peer structure
+ received in bgp_path_info->peer. If it is the same, or if the peer structure
received is a peer_group containing it, returns RMAP_MATCH. */
static route_map_result_t route_match_peer(void *rule,
const struct prefix *prefix,
@@ -251,7 +251,7 @@ static route_map_result_t route_match_peer(void *rule,
if (type == RMAP_BGP) {
pc = rule;
su = &pc->su;
- peer = ((struct bgp_info *)object)->peer;
+ peer = ((struct bgp_path_info *)object)->peer;
if (pc->interface) {
if (!peer->conf_if)
@@ -341,7 +341,7 @@ static route_map_result_t route_match_command(void *rule,
u_int32_t locpref = 0;
u_int32_t newlocpref = 0;
enum lua_rm_status lrm_status;
- struct bgp_info *info = (struct bgp_info *)object;
+ struct bgp_path_info *path = (struct bgp_path_info *)object;
lua_State *L = lua_initialize("/etc/frr/lua.scr");
if (L == NULL)
@@ -354,18 +354,18 @@ static route_map_result_t route_match_command(void *rule,
zlog_debug("Set up prefix table");
/*
- * Setup the bgp_info information
+ * Setup the bgp_path_info information
*/
lua_newtable(L);
- lua_pushinteger(L, info->attr->med);
+ lua_pushinteger(L, path->attr->med);
lua_setfield(L, -2, "metric");
- lua_pushinteger(L, info->attr->nh_ifindex);
+ lua_pushinteger(L, path->attr->nh_ifindex);
lua_setfield(L, -2, "ifindex");
- lua_pushstring(L, info->attr->aspath->str);
+ lua_pushstring(L, path->attr->aspath->str);
lua_setfield(L, -2, "aspath");
- lua_pushinteger(L, info->attr->local_pref);
+ lua_pushinteger(L, path->attr->local_pref);
lua_setfield(L, -2, "localpref");
- zlog_debug("%s %d", info->attr->aspath->str, info->attr->nh_ifindex);
+ zlog_debug("%s %d", path->attr->aspath->str, path->attr->nh_ifindex);
lua_setglobal(L, "nexthop");
zlog_debug("Set up nexthop information");
@@ -383,16 +383,16 @@ static route_map_result_t route_match_command(void *rule,
case LUA_RM_MATCH_AND_CHANGE:
zlog_debug("MATCH AND CHANGE");
lua_getglobal(L, "nexthop");
- info->attr->med = get_integer(L, "metric");
+ path->attr->med = get_integer(L, "metric");
/*
* This needs to be abstraced with the set function
*/
- if (info->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
- locpref = info->attr->local_pref;
+ if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
+ locpref = path->attr->local_pref;
newlocpref = get_integer(L, "localpref");
if (newlocpref != locpref) {
- info->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
- info->attr->local_pref = newlocpref;
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
+ path->attr->local_pref = newlocpref;
}
status = RMAP_MATCH;
break;
@@ -477,13 +477,13 @@ static route_map_result_t route_match_ip_next_hop(void *rule,
void *object)
{
struct access_list *alist;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct prefix_ipv4 p;
if (type == RMAP_BGP && prefix->family == AF_INET) {
- bgp_info = object;
+ path = object;
p.family = AF_INET;
- p.prefix = bgp_info->attr->nexthop;
+ p.prefix = path->attr->nexthop;
p.prefixlen = IPV4_MAX_BITLEN;
alist = access_list_lookup(AFI_IP, (char *)rule);
@@ -524,13 +524,13 @@ static route_map_result_t route_match_ip_route_source(void *rule,
void *object)
{
struct access_list *alist;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct peer *peer;
struct prefix_ipv4 p;
if (type == RMAP_BGP && pfx->family == AF_INET) {
- bgp_info = object;
- peer = bgp_info->peer;
+ path = object;
+ peer = path->peer;
if (!peer || sockunion_family(&peer->su) != AF_INET)
return RMAP_NOMATCH;
@@ -610,13 +610,13 @@ route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
struct prefix_list *plist;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct prefix_ipv4 p;
if (type == RMAP_BGP && prefix->family == AF_INET) {
- bgp_info = object;
+ path = object;
p.family = AF_INET;
- p.prefix = bgp_info->attr->nexthop;
+ p.prefix = path->attr->nexthop;
p.prefixlen = IPV4_MAX_BITLEN;
plist = prefix_list_lookup(AFI_IP, (char *)rule);
@@ -651,19 +651,19 @@ static route_map_result_t
route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP && prefix->family == AF_INET) {
- bgp_info = (struct bgp_info *)object;
- if (!bgp_info || !bgp_info->attr)
+ path = (struct bgp_path_info *)object;
+ if (!path || !path->attr)
return RMAP_DENYMATCH;
/* If nexthop interface's index can't be resolved and nexthop is
set to any address then mark it as type `blackhole`.
This logic works for matching kernel/static routes like:
`ip route add blackhole 10.0.0.1`. */
- if (bgp_info->attr->nexthop.s_addr == INADDR_ANY
- && !bgp_info->attr->nh_ifindex)
+ if (path->attr->nexthop.s_addr == INADDR_ANY
+ && !path->attr->nh_ifindex)
return RMAP_MATCH;
}
return RMAP_NOMATCH;
@@ -692,13 +692,13 @@ route_match_ip_route_source_prefix_list(void *rule,
route_map_object_t type, void *object)
{
struct prefix_list *plist;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct peer *peer;
struct prefix_ipv4 p;
if (type == RMAP_BGP && prefix->family == AF_INET) {
- bgp_info = object;
- peer = bgp_info->peer;
+ path = object;
+ peer = path->peer;
if (!peer || sockunion_family(&peer->su) != AF_INET)
return RMAP_NOMATCH;
@@ -810,16 +810,16 @@ static route_map_result_t route_match_vni(void *rule,
route_map_object_t type, void *object)
{
vni_t vni = 0;
- struct bgp_info *bgp_info = NULL;
+ struct bgp_path_info *path = NULL;
if (type == RMAP_BGP) {
vni = *((vni_t *)rule);
- bgp_info = (struct bgp_info *)object;
+ path = (struct bgp_path_info *)object;
- if (bgp_info->extra == NULL)
+ if (path->extra == NULL)
return RMAP_NOMATCH;
- if (vni == label2vni(&bgp_info->extra->label[0]))
+ if (vni == label2vni(&path->extra->label[0]))
return RMAP_MATCH;
}
@@ -914,13 +914,13 @@ static route_map_result_t route_match_local_pref(void *rule,
void *object)
{
uint32_t *local_pref;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
local_pref = rule;
- bgp_info = object;
+ path = object;
- if (bgp_info->attr->local_pref == *local_pref)
+ if (path->attr->local_pref == *local_pref)
return RMAP_MATCH;
else
return RMAP_NOMATCH;
@@ -974,12 +974,12 @@ static route_map_result_t route_match_metric(void *rule,
void *object)
{
struct rmap_value *rv;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
rv = rule;
- bgp_info = object;
- return route_value_match(rv, bgp_info->attr->med);
+ path = object;
+ return route_value_match(rv, path->attr->med);
}
return RMAP_NOMATCH;
}
@@ -999,17 +999,17 @@ static route_map_result_t route_match_aspath(void *rule,
{
struct as_list *as_list;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
as_list = as_list_lookup((char *)rule);
if (as_list == NULL)
return RMAP_NOMATCH;
- bgp_info = object;
+ path = object;
/* Perform match. */
- return ((as_list_apply(as_list, bgp_info->attr->aspath)
+ return ((as_list_apply(as_list, path->attr->aspath)
== AS_FILTER_DENY)
? RMAP_NOMATCH
: RMAP_MATCH);
@@ -1047,11 +1047,11 @@ static route_map_result_t route_match_community(void *rule,
void *object)
{
struct community_list *list;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct rmap_community *rcom;
if (type == RMAP_BGP) {
- bgp_info = object;
+ path = object;
rcom = rule;
list = community_list_lookup(bgp_clist, rcom->name,
@@ -1060,12 +1060,11 @@ static route_map_result_t route_match_community(void *rule,
return RMAP_NOMATCH;
if (rcom->exact) {
- if (community_list_exact_match(
- bgp_info->attr->community, list))
+ if (community_list_exact_match(path->attr->community,
+ list))
return RMAP_MATCH;
} else {
- if (community_list_match(bgp_info->attr->community,
- list))
+ if (community_list_match(path->attr->community, list))
return RMAP_MATCH;
}
}
@@ -1115,11 +1114,11 @@ static route_map_result_t route_match_lcommunity(void *rule,
void *object)
{
struct community_list *list;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct rmap_community *rcom;
if (type == RMAP_BGP) {
- bgp_info = object;
+ path = object;
rcom = rule;
list = community_list_lookup(bgp_clist, rcom->name,
@@ -1127,7 +1126,7 @@ static route_map_result_t route_match_lcommunity(void *rule,
if (!list)
return RMAP_NOMATCH;
- if (lcommunity_list_match(bgp_info->attr->lcommunity, list))
+ if (lcommunity_list_match(path->attr->lcommunity, list))
return RMAP_MATCH;
}
return RMAP_NOMATCH;
@@ -1176,17 +1175,17 @@ static route_map_result_t route_match_ecommunity(void *rule,
void *object)
{
struct community_list *list;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
- bgp_info = object;
+ path = object;
list = community_list_lookup(bgp_clist, (char *)rule,
EXTCOMMUNITY_LIST_MASTER);
if (!list)
return RMAP_NOMATCH;
- if (ecommunity_list_match(bgp_info->attr->ecommunity, list))
+ if (ecommunity_list_match(path->attr->ecommunity, list))
return RMAP_MATCH;
}
return RMAP_NOMATCH;
@@ -1219,13 +1218,13 @@ static route_map_result_t route_match_origin(void *rule,
void *object)
{
uint8_t *origin;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
origin = rule;
- bgp_info = object;
+ path = object;
- if (bgp_info->attr->origin == *origin)
+ if (path->attr->origin == *origin)
return RMAP_MATCH;
}
@@ -1322,17 +1321,17 @@ static route_map_result_t route_match_interface(void *rule,
void *object)
{
struct interface *ifp;
- struct bgp_info *info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
- info = object;
+ path = object;
- if (!info || !info->attr)
+ if (!path || !path->attr)
return RMAP_NOMATCH;
ifp = if_lookup_by_name_all_vrf((char *)rule);
- if (ifp == NULL || ifp->ifindex != info->attr->nh_ifindex)
+ if (ifp == NULL || ifp->ifindex != path->attr->nh_ifindex)
return RMAP_NOMATCH;
return RMAP_MATCH;
@@ -1368,14 +1367,13 @@ static route_map_result_t route_match_tag(void *rule,
route_map_object_t type, void *object)
{
route_tag_t *tag;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
tag = rule;
- bgp_info = object;
+ path = object;
- return ((bgp_info->attr->tag == *tag) ? RMAP_MATCH
- : RMAP_NOMATCH);
+ return ((path->attr->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH);
}
return RMAP_NOMATCH;
@@ -1402,15 +1400,15 @@ static route_map_result_t route_set_ip_nexthop(void *rule,
void *object)
{
struct rmap_ip_nexthop_set *rins = rule;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct peer *peer;
if (type == RMAP_BGP) {
- bgp_info = object;
- peer = bgp_info->peer;
+ path = object;
+ peer = path->peer;
if (rins->unchanged) {
- SET_FLAG(bgp_info->attr->rmap_change_flags,
+ SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_NEXTHOP_UNCHANGED);
} else if (rins->peer_address) {
if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN)
@@ -1418,9 +1416,9 @@ static route_map_result_t route_set_ip_nexthop(void *rule,
PEER_RMAP_TYPE_IMPORT))
&& peer->su_remote
&& sockunion_family(peer->su_remote) == AF_INET) {
- bgp_info->attr->nexthop.s_addr =
+ path->attr->nexthop.s_addr =
sockunion2ip(peer->su_remote);
- bgp_info->attr->flag |=
+ path->attr->flag |=
ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
} else if (CHECK_FLAG(peer->rmap_type,
PEER_RMAP_TYPE_OUT)) {
@@ -1430,20 +1428,19 @@ static route_map_result_t route_set_ip_nexthop(void *rule,
* needs to be done.
* Also, clear the value.
*/
- SET_FLAG(bgp_info->attr->rmap_change_flags,
+ SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_NEXTHOP_PEER_ADDRESS);
- bgp_info->attr->nexthop.s_addr = 0;
+ path->attr->nexthop.s_addr = 0;
}
} else {
/* Set next hop value. */
- bgp_info->attr->flag |=
- ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
- bgp_info->attr->nexthop = *rins->address;
- SET_FLAG(bgp_info->attr->rmap_change_flags,
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
+ path->attr->nexthop = *rins->address;
+ SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_IPV4_NHOP_CHANGED);
/* case for MP-BGP : MPLS VPN */
- bgp_info->attr->mp_nexthop_global_in = *rins->address;
- bgp_info->attr->mp_nexthop_len = sizeof(*rins->address);
+ path->attr->mp_nexthop_global_in = *rins->address;
+ path->attr->mp_nexthop_len = sizeof(*rins->address);
}
}
@@ -1510,21 +1507,21 @@ static route_map_result_t route_set_local_pref(void *rule,
void *object)
{
struct rmap_value *rv;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
uint32_t locpref = 0;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
rv = rule;
- bgp_info = object;
+ path = object;
/* Set local preference value. */
- if (bgp_info->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
- locpref = bgp_info->attr->local_pref;
+ if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
+ locpref = path->attr->local_pref;
- bgp_info->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
- bgp_info->attr->local_pref =
- route_value_adjust(rv, locpref, bgp_info->peer);
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
+ path->attr->local_pref =
+ route_value_adjust(rv, locpref, path->peer);
}
return RMAP_OKAY;
@@ -1545,16 +1542,15 @@ static route_map_result_t route_set_weight(void *rule,
void *object)
{
struct rmap_value *rv;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
rv = rule;
- bgp_info = object;
+ path = object;
/* Set weight value. */
- bgp_info->attr->weight =
- route_value_adjust(rv, 0, bgp_info->peer);
+ path->attr->weight = route_value_adjust(rv, 0, path->peer);
}
return RMAP_OKAY;
@@ -1574,21 +1570,19 @@ static route_map_result_t route_set_metric(void *rule,
void *object)
{
struct rmap_value *rv;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
uint32_t med = 0;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
rv = rule;
- bgp_info = object;
+ path = object;
- if (bgp_info->attr->flag
- & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
- med = bgp_info->attr->med;
+ if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
+ med = path->attr->med;
- bgp_info->attr->med =
- route_value_adjust(rv, med, bgp_info->peer);
- bgp_info->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC);
+ path->attr->med = route_value_adjust(rv, med, path->peer);
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC);
}
return RMAP_OKAY;
}
@@ -1608,15 +1602,15 @@ static route_map_result_t route_set_aspath_prepend(void *rule,
{
struct aspath *aspath;
struct aspath *new;
- struct bgp_info *binfo;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
- binfo = object;
+ path = object;
- if (binfo->attr->aspath->refcnt)
- new = aspath_dup(binfo->attr->aspath);
+ if (path->attr->aspath->refcnt)
+ new = aspath_dup(path->attr->aspath);
else
- new = binfo->attr->aspath;
+ new = path->attr->aspath;
if ((uintptr_t)rule > 10) {
aspath = rule;
@@ -1624,11 +1618,11 @@ static route_map_result_t route_set_aspath_prepend(void *rule,
} else {
as_t as = aspath_leftmost(new);
if (!as)
- as = binfo->peer->as;
+ as = path->peer->as;
new = aspath_add_seq_n(new, as, (uintptr_t)rule);
}
- binfo->attr->aspath = new;
+ path->attr->aspath = new;
}
return RMAP_OKAY;
@@ -1670,16 +1664,16 @@ static route_map_result_t route_set_aspath_exclude(void *rule,
void *object)
{
struct aspath *new_path, *exclude_path;
- struct bgp_info *binfo;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
exclude_path = rule;
- binfo = object;
- if (binfo->attr->aspath->refcnt)
- new_path = aspath_dup(binfo->attr->aspath);
+ path = object;
+ if (path->attr->aspath->refcnt)
+ new_path = aspath_dup(path->attr->aspath);
else
- new_path = binfo->attr->aspath;
- binfo->attr->aspath =
+ new_path = path->attr->aspath;
+ path->attr->aspath =
aspath_filter_exclude(new_path, exclude_path);
}
return RMAP_OKAY;
@@ -1705,7 +1699,7 @@ static route_map_result_t route_set_community(void *rule,
void *object)
{
struct rmap_com_set *rcs;
- struct bgp_info *binfo;
+ struct bgp_path_info *path;
struct attr *attr;
struct community *new = NULL;
struct community *old;
@@ -1713,8 +1707,8 @@ static route_map_result_t route_set_community(void *rule,
if (type == RMAP_BGP) {
rcs = rule;
- binfo = object;
- attr = binfo->attr;
+ path = object;
+ attr = path->attr;
old = attr->community;
/* "none" case. */
@@ -1821,7 +1815,7 @@ static route_map_result_t route_set_lcommunity(void *rule,
void *object)
{
struct rmap_lcom_set *rcs;
- struct bgp_info *binfo;
+ struct bgp_path_info *path;
struct attr *attr;
struct lcommunity *new = NULL;
struct lcommunity *old;
@@ -1829,8 +1823,8 @@ static route_map_result_t route_set_lcommunity(void *rule,
if (type == RMAP_BGP) {
rcs = rule;
- binfo = object;
- attr = binfo->attr;
+ path = object;
+ attr = path->attr;
old = attr->lcommunity;
/* "none" case. */
@@ -1937,16 +1931,16 @@ static route_map_result_t route_set_lcommunity_delete(void *rule,
struct lcommunity *merge;
struct lcommunity *new;
struct lcommunity *old;
- struct bgp_info *binfo;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
if (!rule)
return RMAP_OKAY;
- binfo = object;
+ path = object;
list = community_list_lookup(bgp_clist, rule,
LARGE_COMMUNITY_LIST_MASTER);
- old = binfo->attr->lcommunity;
+ old = path->attr->lcommunity;
if (list && old) {
merge = lcommunity_list_match_delete(
@@ -1963,13 +1957,13 @@ static route_map_result_t route_set_lcommunity_delete(void *rule,
lcommunity_free(&old);
if (new->size == 0) {
- binfo->attr->lcommunity = NULL;
- binfo->attr->flag &= ~ATTR_FLAG_BIT(
+ path->attr->lcommunity = NULL;
+ path->attr->flag &= ~ATTR_FLAG_BIT(
BGP_ATTR_LARGE_COMMUNITIES);
lcommunity_free(&new);
} else {
- binfo->attr->lcommunity = new;
- binfo->attr->flag |= ATTR_FLAG_BIT(
+ path->attr->lcommunity = new;
+ path->attr->flag |= ATTR_FLAG_BIT(
BGP_ATTR_LARGE_COMMUNITIES);
}
}
@@ -2022,16 +2016,16 @@ static route_map_result_t route_set_community_delete(
struct community *merge;
struct community *new;
struct community *old;
- struct bgp_info *binfo;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
if (!rule)
return RMAP_OKAY;
- binfo = object;
+ path = object;
list = community_list_lookup(bgp_clist, rule,
COMMUNITY_LIST_MASTER);
- old = binfo->attr->community;
+ old = path->attr->community;
if (list && old) {
merge = community_list_match_delete(community_dup(old),
@@ -2048,13 +2042,13 @@ static route_map_result_t route_set_community_delete(
community_free(old);
if (new->size == 0) {
- binfo->attr->community = NULL;
- binfo->attr->flag &=
+ path->attr->community = NULL;
+ path->attr->flag &=
~ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES);
community_free(new);
} else {
- binfo->attr->community = new;
- binfo->attr->flag |=
+ path->attr->community = new;
+ path->attr->flag |=
ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES);
}
}
@@ -2104,17 +2098,17 @@ static route_map_result_t route_set_ecommunity(void *rule,
struct ecommunity *ecom;
struct ecommunity *new_ecom;
struct ecommunity *old_ecom;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
ecom = rule;
- bgp_info = object;
+ path = object;
if (!ecom)
return RMAP_OKAY;
/* We assume additive for Extended Community. */
- old_ecom = bgp_info->attr->ecommunity;
+ old_ecom = path->attr->ecommunity;
if (old_ecom) {
new_ecom = ecommunity_merge(ecommunity_dup(old_ecom),
@@ -2130,9 +2124,9 @@ static route_map_result_t route_set_ecommunity(void *rule,
new_ecom = ecommunity_dup(ecom);
/* will be intern()'d or attr_flush()'d by bgp_update_main() */
- bgp_info->attr->ecommunity = new_ecom;
+ path->attr->ecommunity = new_ecom;
- bgp_info->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
}
return RMAP_OKAY;
}
@@ -2190,13 +2184,13 @@ static route_map_result_t route_set_origin(void *rule,
void *object)
{
uint8_t *origin;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
origin = rule;
- bgp_info = object;
+ path = object;
- bgp_info->attr->origin = *origin;
+ path->attr->origin = *origin;
}
return RMAP_OKAY;
@@ -2239,12 +2233,11 @@ static route_map_result_t route_set_atomic_aggregate(void *rule,
route_map_object_t type,
void *object)
{
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
- bgp_info = object;
- bgp_info->attr->flag |=
- ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE);
+ path = object;
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE);
}
return RMAP_OKAY;
@@ -2279,16 +2272,16 @@ static route_map_result_t route_set_aggregator_as(void *rule,
route_map_object_t type,
void *object)
{
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct aggregator *aggregator;
if (type == RMAP_BGP) {
- bgp_info = object;
+ path = object;
aggregator = rule;
- bgp_info->attr->aggregator_as = aggregator->as;
- bgp_info->attr->aggregator_addr = aggregator->address;
- bgp_info->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR);
+ path->attr->aggregator_as = aggregator->as;
+ path->attr->aggregator_addr = aggregator->address;
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR);
}
return RMAP_OKAY;
@@ -2327,20 +2320,20 @@ struct route_map_rule_cmd route_set_aggregator_as_cmd = {
route_set_aggregator_as_compile, route_set_aggregator_as_free,
};
-/* Set tag to object. object must be pointer to struct bgp_info */
+/* Set tag to object. object must be pointer to struct bgp_path_info */
static route_map_result_t route_set_tag(void *rule,
const struct prefix *prefix,
route_map_object_t type, void *object)
{
route_tag_t *tag;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
tag = rule;
- bgp_info = object;
+ path = object;
/* Set tag value */
- bgp_info->attr->tag = *tag;
+ path->attr->tag = *tag;
}
return RMAP_OKAY;
@@ -2352,27 +2345,26 @@ static struct route_map_rule_cmd route_set_tag_cmd = {
route_map_rule_tag_free,
};
-/* Set label-index to object. object must be pointer to struct bgp_info */
+/* Set label-index to object. object must be pointer to struct bgp_path_info */
static route_map_result_t route_set_label_index(void *rule,
const struct prefix *prefix,
route_map_object_t type,
void *object)
{
struct rmap_value *rv;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
uint32_t label_index;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
rv = rule;
- bgp_info = object;
+ path = object;
/* Set label-index value. */
label_index = rv->value;
if (label_index) {
- bgp_info->attr->label_index = label_index;
- bgp_info->attr->flag |=
- ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID);
+ path->attr->label_index = label_index;
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID);
}
}
@@ -2429,17 +2421,17 @@ static route_map_result_t route_match_ipv6_next_hop(void *rule,
void *object)
{
struct in6_addr *addr = rule;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
- bgp_info = object;
+ path = object;
- if (IPV6_ADDR_SAME(&bgp_info->attr->mp_nexthop_global, addr))
+ if (IPV6_ADDR_SAME(&path->attr->mp_nexthop_global, addr))
return RMAP_MATCH;
- if (bgp_info->attr->mp_nexthop_len
+ if (path->attr->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
- && IPV6_ADDR_SAME(&bgp_info->attr->mp_nexthop_local, rule))
+ && IPV6_ADDR_SAME(&path->attr->mp_nexthop_local, rule))
return RMAP_MATCH;
return RMAP_NOMATCH;
@@ -2514,16 +2506,16 @@ static route_map_result_t
route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct in6_addr *addr = rule;
if (type == RMAP_BGP && prefix->family == AF_INET6) {
- bgp_info = (struct bgp_info *)object;
- if (!bgp_info || !bgp_info->attr)
+ path = (struct bgp_path_info *)object;
+ if (!path || !path->attr)
return RMAP_DENYMATCH;
- if (IPV6_ADDR_SAME(&bgp_info->attr->mp_nexthop_global, addr)
- && !bgp_info->attr->nh_ifindex)
+ if (IPV6_ADDR_SAME(&path->attr->mp_nexthop_global, addr)
+ && !path->attr->nh_ifindex)
return RMAP_MATCH;
}
return RMAP_NOMATCH;
@@ -2564,22 +2556,21 @@ static route_map_result_t route_set_ipv6_nexthop_global(void *rule,
void *object)
{
struct in6_addr *address;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
address = rule;
- bgp_info = object;
+ path = object;
/* Set next hop value. */
- bgp_info->attr->mp_nexthop_global = *address;
+ path->attr->mp_nexthop_global = *address;
/* Set nexthop length. */
- if (bgp_info->attr->mp_nexthop_len == 0)
- bgp_info->attr->mp_nexthop_len =
- BGP_ATTR_NHLEN_IPV6_GLOBAL;
+ if (path->attr->mp_nexthop_len == 0)
+ path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
- SET_FLAG(bgp_info->attr->rmap_change_flags,
+ SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_IPV6_GLOBAL_NHOP_CHANGED);
}
@@ -2622,25 +2613,25 @@ static route_map_result_t
route_set_ipv6_nexthop_prefer_global(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct peer *peer;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
- bgp_info = object;
- peer = bgp_info->peer;
+ path = object;
+ peer = path->peer;
if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN)
|| CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IMPORT))
&& peer->su_remote
&& sockunion_family(peer->su_remote) == AF_INET6) {
/* Set next hop preference to global */
- bgp_info->attr->mp_nexthop_prefer_global = TRUE;
- SET_FLAG(bgp_info->attr->rmap_change_flags,
+ path->attr->mp_nexthop_prefer_global = TRUE;
+ SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED);
} else {
- bgp_info->attr->mp_nexthop_prefer_global = FALSE;
- SET_FLAG(bgp_info->attr->rmap_change_flags,
+ path->attr->mp_nexthop_prefer_global = FALSE;
+ SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED);
}
}
@@ -2678,23 +2669,23 @@ static route_map_result_t route_set_ipv6_nexthop_local(void *rule,
void *object)
{
struct in6_addr *address;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
address = rule;
- bgp_info = object;
+ path = object;
/* Set next hop value. */
- bgp_info->attr->mp_nexthop_local = *address;
+ path->attr->mp_nexthop_local = *address;
/* Set nexthop length. */
- if (bgp_info->attr->mp_nexthop_len
+ if (path->attr->mp_nexthop_len
!= BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- bgp_info->attr->mp_nexthop_len =
+ path->attr->mp_nexthop_len =
BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
- SET_FLAG(bgp_info->attr->rmap_change_flags,
+ SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_IPV6_LL_NHOP_CHANGED);
}
@@ -2741,13 +2732,13 @@ static route_map_result_t route_set_ipv6_nexthop_peer(void *rule,
void *object)
{
struct in6_addr peer_address;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
struct peer *peer;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
- bgp_info = object;
- peer = bgp_info->peer;
+ path = object;
+ peer = path->peer;
if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN)
|| CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IMPORT))
@@ -2756,14 +2747,13 @@ static route_map_result_t route_set_ipv6_nexthop_peer(void *rule,
peer_address = peer->su_remote->sin6.sin6_addr;
/* Set next hop value and length in attribute. */
if (IN6_IS_ADDR_LINKLOCAL(&peer_address)) {
- bgp_info->attr->mp_nexthop_local = peer_address;
- if (bgp_info->attr->mp_nexthop_len != 32)
- bgp_info->attr->mp_nexthop_len = 32;
+ path->attr->mp_nexthop_local = peer_address;
+ if (path->attr->mp_nexthop_len != 32)
+ path->attr->mp_nexthop_len = 32;
} else {
- bgp_info->attr->mp_nexthop_global =
- peer_address;
- if (bgp_info->attr->mp_nexthop_len == 0)
- bgp_info->attr->mp_nexthop_len = 16;
+ path->attr->mp_nexthop_global = peer_address;
+ if (path->attr->mp_nexthop_len == 0)
+ path->attr->mp_nexthop_len = 16;
}
} else if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT)) {
@@ -2776,12 +2766,12 @@ static route_map_result_t route_set_ipv6_nexthop_peer(void *rule,
* nexthops, whether we send one or both is determined
* elsewhere.
*/
- SET_FLAG(bgp_info->attr->rmap_change_flags,
+ SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_NEXTHOP_PEER_ADDRESS);
/* clear next hop value. */
- memset(&(bgp_info->attr->mp_nexthop_global), 0,
+ memset(&(path->attr->mp_nexthop_global), 0,
sizeof(struct in6_addr));
- memset(&(bgp_info->attr->mp_nexthop_local), 0,
+ memset(&(path->attr->mp_nexthop_local), 0,
sizeof(struct in6_addr));
}
}
@@ -2820,16 +2810,16 @@ static route_map_result_t route_set_vpnv4_nexthop(void *rule,
void *object)
{
struct in_addr *address;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
address = rule;
- bgp_info = object;
+ path = object;
/* Set next hop value. */
- bgp_info->attr->mp_nexthop_global_in = *address;
- bgp_info->attr->mp_nexthop_len = 4;
+ path->attr->mp_nexthop_global_in = *address;
+ path->attr->mp_nexthop_len = 4;
}
return RMAP_OKAY;
@@ -2860,17 +2850,17 @@ static route_map_result_t route_set_vpnv6_nexthop(void *rule,
void *object)
{
struct in6_addr *address;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
/* Fetch routemap's rule information. */
address = rule;
- bgp_info = object;
+ path = object;
/* Set next hop value. */
- memcpy(&bgp_info->attr->mp_nexthop_global, address,
+ memcpy(&path->attr->mp_nexthop_global, address,
sizeof(struct in6_addr));
- bgp_info->attr->mp_nexthop_len = BGP_ATTR_NHLEN_VPNV6_GLOBAL;
+ path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_VPNV6_GLOBAL;
}
return RMAP_OKAY;
@@ -2916,14 +2906,14 @@ static route_map_result_t route_set_originator_id(void *rule,
void *object)
{
struct in_addr *address;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
address = rule;
- bgp_info = object;
+ path = object;
- bgp_info->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID);
- bgp_info->attr->originator_id = *address;
+ path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID);
+ path->attr->originator_id = *address;
}
return RMAP_OKAY;
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index 56566525a4..77bd2eaefa 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -217,12 +217,12 @@ static route_map_result_t route_match(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
int *rpki_status = rule;
- struct bgp_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP) {
- bgp_info = object;
+ path = object;
- if (rpki_validate_prefix(bgp_info->peer, bgp_info->attr, prefix)
+ if (rpki_validate_prefix(path->peer, path->attr, prefix)
== *rpki_status) {
return RMAP_MATCH;
}
@@ -418,13 +418,13 @@ static void revalidate_bgp_node(struct bgp_node *bgp_node, afi_t afi,
for (ain = bgp_node->adj_in; ain; ain = ain->next) {
int ret;
- struct bgp_info *bgp_info = bgp_node->info;
+ struct bgp_path_info *path = bgp_node->info;
mpls_label_t *label = NULL;
uint32_t num_labels = 0;
- if (bgp_info && bgp_info->extra) {
- label = bgp_info->extra->label;
- num_labels = bgp_info->extra->num_labels;
+ if (path && path->extra) {
+ label = path->extra->label;
+ num_labels = path->extra->num_labels;
}
ret = bgp_update(ain->peer, &bgp_node->p, ain->addpath_rx_id,
ain->attr, afi, safi, ZEBRA_ROUTE_BGP,
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 0700e0ac24..413737fa46 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -674,14 +674,15 @@ static uint8_t *bgpRcvdPathAttrTable(struct variable *v, oid name[],
return NULL;
}
-static struct bgp_info *bgp4PathAttrLookup(struct variable *v, oid name[],
- size_t *length, struct bgp *bgp,
- struct prefix_ipv4 *addr, int exact)
+static struct bgp_path_info *bgp4PathAttrLookup(struct variable *v, oid name[],
+ size_t *length, struct bgp *bgp,
+ struct prefix_ipv4 *addr,
+ int exact)
{
oid *offset;
int offsetlen;
- struct bgp_info *binfo;
- struct bgp_info *min;
+ struct bgp_path_info *path;
+ struct bgp_path_info *min;
struct bgp_node *rn;
union sockunion su;
unsigned int len;
@@ -714,9 +715,9 @@ static struct bgp_info *bgp4PathAttrLookup(struct variable *v, oid name[],
if (rn) {
bgp_unlock_node(rn);
- for (binfo = rn->info; binfo; binfo = binfo->next)
- if (sockunion_same(&binfo->peer->su, &su))
- return binfo;
+ for (path = rn->info; path; path = path->next)
+ if (sockunion_same(&path->peer->su, &su))
+ return path;
}
} else {
offset = name + v->namelen;
@@ -761,22 +762,22 @@ static struct bgp_info *bgp4PathAttrLookup(struct variable *v, oid name[],
do {
min = NULL;
- for (binfo = rn->info; binfo; binfo = binfo->next) {
- if (binfo->peer->su.sin.sin_family == AF_INET
+ for (path = rn->info; path; path = path->next) {
+ if (path->peer->su.sin.sin_family == AF_INET
&& ntohl(paddr.s_addr)
- < ntohl(binfo->peer->su.sin
+ < ntohl(path->peer->su.sin
.sin_addr
.s_addr)) {
if (min) {
- if (ntohl(binfo->peer->su.sin
+ if (ntohl(path->peer->su.sin
.sin_addr
.s_addr)
< ntohl(min->peer->su.sin
.sin_addr
.s_addr))
- min = binfo;
+ min = path;
} else
- min = binfo;
+ min = path;
}
}
@@ -812,7 +813,7 @@ static uint8_t *bgp4PathAttrTable(struct variable *v, oid name[],
WriteMethod **write_method)
{
struct bgp *bgp;
- struct bgp_info *binfo;
+ struct bgp_path_info *path;
struct prefix_ipv4 addr;
bgp = bgp_get_default();
@@ -824,13 +825,13 @@ static uint8_t *bgp4PathAttrTable(struct variable *v, oid name[],
return NULL;
memset(&addr, 0, sizeof(struct prefix_ipv4));
- binfo = bgp4PathAttrLookup(v, name, length, bgp, &addr, exact);
- if (!binfo)
+ path = bgp4PathAttrLookup(v, name, length, bgp, &addr, exact);
+ if (!path)
return NULL;
switch (v->magic) {
case BGP4PATHATTRPEER: /* 1 */
- return SNMP_IPADDRESS(binfo->peer->su.sin.sin_addr);
+ return SNMP_IPADDRESS(path->peer->su.sin.sin_addr);
break;
case BGP4PATHATTRIPADDRPREFIXLEN: /* 2 */
return SNMP_INTEGER(addr.prefixlen);
@@ -839,28 +840,28 @@ static uint8_t *bgp4PathAttrTable(struct variable *v, oid name[],
return SNMP_IPADDRESS(addr.prefix);
break;
case BGP4PATHATTRORIGIN: /* 4 */
- return SNMP_INTEGER(binfo->attr->origin);
+ return SNMP_INTEGER(path->attr->origin);
break;
case BGP4PATHATTRASPATHSEGMENT: /* 5 */
- return aspath_snmp_pathseg(binfo->attr->aspath, var_len);
+ return aspath_snmp_pathseg(path->attr->aspath, var_len);
break;
case BGP4PATHATTRNEXTHOP: /* 6 */
- return SNMP_IPADDRESS(binfo->attr->nexthop);
+ return SNMP_IPADDRESS(path->attr->nexthop);
break;
case BGP4PATHATTRMULTIEXITDISC: /* 7 */
- return SNMP_INTEGER(binfo->attr->med);
+ return SNMP_INTEGER(path->attr->med);
break;
case BGP4PATHATTRLOCALPREF: /* 8 */
- return SNMP_INTEGER(binfo->attr->local_pref);
+ return SNMP_INTEGER(path->attr->local_pref);
break;
case BGP4PATHATTRATOMICAGGREGATE: /* 9 */
return SNMP_INTEGER(1);
break;
case BGP4PATHATTRAGGREGATORAS: /* 10 */
- return SNMP_INTEGER(binfo->attr->aggregator_as);
+ return SNMP_INTEGER(path->attr->aggregator_as);
break;
case BGP4PATHATTRAGGREGATORADDR: /* 11 */
- return SNMP_IPADDRESS(binfo->attr->aggregator_addr);
+ return SNMP_IPADDRESS(path->attr->aggregator_addr);
break;
case BGP4PATHATTRCALCLOCALPREF: /* 12 */
return SNMP_INTEGER(-1);
@@ -868,7 +869,7 @@ static uint8_t *bgp4PathAttrTable(struct variable *v, oid name[],
case BGP4PATHATTRBEST: /* 13 */
#define BGP4_PathAttrBest_false 1
#define BGP4_PathAttrBest_true 2
- if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED))
+ if (CHECK_FLAG(path->flags, BGP_INFO_SELECTED))
return SNMP_INTEGER(BGP4_PathAttrBest_true);
else
return SNMP_INTEGER(BGP4_PathAttrBest_false);
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index f7bb6e1054..231f326cef 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -104,7 +104,7 @@ struct bgp_table *bgp_table_init(struct bgp *bgp, afi_t afi, safi_t safi)
route_table_set_info(rt->route_table, rt);
/*
- * pointer to bgp instance allows working back from bgp_info to bgp
+ * pointer to bgp instance allows working back from bgp_path_info to bgp
*/
rt->bgp = bgp;
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 7f7b4a893f..6ebfc4af02 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -1182,6 +1182,8 @@ static void update_subgroup_copy_adj_out(struct update_subgroup *source,
aout_copy->attr =
aout->attr ? bgp_attr_intern(aout->attr) : NULL;
}
+
+ dest->scount = source->scount;
}
/*
@@ -1904,7 +1906,7 @@ int bgp_addpath_encode_tx(struct peer *peer, afi_t afi, safi_t safi)
* configured addpath-tx knob
*/
int bgp_addpath_tx_path(struct peer *peer, afi_t afi, safi_t safi,
- struct bgp_info *ri)
+ struct bgp_path_info *pi)
{
if (CHECK_FLAG(peer->af_flags[afi][safi],
PEER_FLAG_ADDPATH_TX_ALL_PATHS))
@@ -1912,7 +1914,7 @@ int bgp_addpath_tx_path(struct peer *peer, afi_t afi, safi_t safi,
if (CHECK_FLAG(peer->af_flags[afi][safi],
PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)
- && CHECK_FLAG(ri->flags, BGP_INFO_DMED_SELECTED))
+ && CHECK_FLAG(pi->flags, BGP_PATH_DMED_SELECTED))
return 1;
return 0;
diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h
index c1cbca6dcf..b1d852d384 100644
--- a/bgpd/bgp_updgrp.h
+++ b/bgpd/bgp_updgrp.h
@@ -293,7 +293,7 @@ typedef int (*updgrp_walkcb)(struct update_group *updgrp, void *ctx);
struct updwalk_context {
struct vty *vty;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
uint64_t updgrp_id;
uint64_t subgrp_id;
bgp_policy_type_e policy_type;
@@ -442,7 +442,7 @@ extern void subgroup_announce_all(struct update_subgroup *subgrp);
extern void subgroup_default_originate(struct update_subgroup *subgrp,
int withdraw);
extern void group_announce_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct bgp_node *rn, struct bgp_info *ri);
+ struct bgp_node *rn, struct bgp_path_info *pi);
extern void subgroup_clear_table(struct update_subgroup *subgrp);
extern void update_group_announce(struct bgp *bgp);
extern void update_group_announce_rrclients(struct bgp *bgp);
@@ -455,7 +455,8 @@ extern void bgp_adj_out_remove_subgroup(struct bgp_node *rn,
struct update_subgroup *subgrp);
extern void bgp_adj_out_set_subgroup(struct bgp_node *rn,
struct update_subgroup *subgrp,
- struct attr *attr, struct bgp_info *binfo);
+ struct attr *attr,
+ struct bgp_path_info *path);
extern void bgp_adj_out_unset_subgroup(struct bgp_node *rn,
struct update_subgroup *subgrp,
char withdraw, uint32_t addpath_tx_id);
@@ -469,7 +470,7 @@ extern int update_group_clear_update_dbg(struct update_group *updgrp,
extern void update_bgp_group_free(struct bgp *bgp);
extern int bgp_addpath_encode_tx(struct peer *peer, afi_t afi, safi_t safi);
extern int bgp_addpath_tx_path(struct peer *peer, afi_t afi, safi_t safi,
- struct bgp_info *ri);
+ struct bgp_path_info *pi);
/*
* Inline functions
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index 6ffb1d448b..1f81dad649 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -101,7 +101,7 @@ static int group_announce_route_walkcb(struct update_group *updgrp, void *arg)
{
struct updwalk_context *ctx = arg;
struct update_subgroup *subgrp;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
afi_t afi;
safi_t safi;
struct peer *peer;
@@ -140,15 +140,15 @@ static int group_announce_route_walkcb(struct update_group *updgrp, void *arg)
adj_next = adj->next;
if (adj->subgroup == subgrp) {
- for (ri = ctx->rn->info; ri;
- ri = ri->next) {
- if (ri->addpath_tx_id
+ for (pi = ctx->rn->info; pi;
+ pi = pi->next) {
+ if (pi->addpath_tx_id
== adj->addpath_tx_id) {
break;
}
}
- if (!ri) {
+ if (!pi) {
subgroup_process_announce_selected(
subgrp, NULL,
ctx->rn,
@@ -157,32 +157,32 @@ static int group_announce_route_walkcb(struct update_group *updgrp, void *arg)
}
}
- for (ri = ctx->rn->info; ri; ri = ri->next) {
+ for (pi = ctx->rn->info; pi; pi = pi->next) {
/* Skip the bestpath for now */
- if (ri == ctx->ri)
+ if (pi == ctx->pi)
continue;
subgroup_process_announce_selected(
- subgrp, ri, ctx->rn,
- ri->addpath_tx_id);
+ subgrp, pi, ctx->rn,
+ pi->addpath_tx_id);
}
/* Process the bestpath last so the "show [ip]
* bgp neighbor x.x.x.x advertised"
* output shows the attributes from the bestpath
*/
- if (ctx->ri)
+ if (ctx->pi)
subgroup_process_announce_selected(
- subgrp, ctx->ri, ctx->rn,
- ctx->ri->addpath_tx_id);
+ subgrp, ctx->pi, ctx->rn,
+ ctx->pi->addpath_tx_id);
}
/* An update-group that does not use addpath */
else {
- if (ctx->ri) {
+ if (ctx->pi) {
subgroup_process_announce_selected(
- subgrp, ctx->ri, ctx->rn,
- ctx->ri->addpath_tx_id);
+ subgrp, ctx->pi, ctx->rn,
+ ctx->pi->addpath_tx_id);
} else {
/* Find the addpath_tx_id of the path we
* had advertised and
@@ -429,7 +429,7 @@ bgp_advertise_clean_subgroup(struct update_subgroup *subgrp,
void bgp_adj_out_set_subgroup(struct bgp_node *rn,
struct update_subgroup *subgrp, struct attr *attr,
- struct bgp_info *binfo)
+ struct bgp_path_info *path)
{
struct bgp_adj_out *adj = NULL;
struct bgp_advertise *adv;
@@ -438,10 +438,10 @@ void bgp_adj_out_set_subgroup(struct bgp_node *rn,
return;
/* Look for adjacency information. */
- adj = adj_lookup(rn, subgrp, binfo->addpath_tx_id);
+ adj = adj_lookup(rn, subgrp, path->addpath_tx_id);
if (!adj) {
- adj = bgp_adj_out_alloc(subgrp, rn, binfo->addpath_tx_id);
+ adj = bgp_adj_out_alloc(subgrp, rn, path->addpath_tx_id);
if (!adj)
return;
}
@@ -452,8 +452,9 @@ void bgp_adj_out_set_subgroup(struct bgp_node *rn,
adv = adj->adv;
adv->rn = rn;
- assert(adv->binfo == NULL);
- adv->binfo = bgp_info_lock(binfo); /* bgp_info adj_out reference */
+ assert(adv->pathi == NULL);
+ /* bgp_path_info adj_out reference */
+ adv->pathi = bgp_path_info_lock(path);
if (attr)
adv->baa = bgp_advertise_intern(subgrp->hash, attr);
@@ -568,7 +569,7 @@ void subgroup_announce_table(struct update_subgroup *subgrp,
struct bgp_table *table)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *ri;
struct attr attr;
struct peer *peer;
afi_t afi;
@@ -594,7 +595,7 @@ void subgroup_announce_table(struct update_subgroup *subgrp,
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
for (ri = rn->info; ri; ri = ri->next)
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)
+ if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)
|| (addpath_capable
&& bgp_addpath_tx_path(peer, afi, safi, ri))) {
if (subgroup_announce_check(rn, ri, subgrp,
@@ -663,11 +664,11 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
{
struct bgp *bgp;
struct attr attr;
- struct bgp_info *info, init_info, tmp_info;
+ struct bgp_path_info *info, init_info, tmp_info;
struct prefix p;
struct peer *from;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *ri;
struct peer *peer;
int ret = RMAP_DENYMATCH;
afi_t afi;
@@ -830,10 +831,10 @@ void subgroup_announce_all(struct update_subgroup *subgrp)
* input route.
*/
void group_announce_route(struct bgp *bgp, afi_t afi, safi_t safi,
- struct bgp_node *rn, struct bgp_info *ri)
+ struct bgp_node *rn, struct bgp_path_info *pi)
{
struct updwalk_context ctx;
- ctx.ri = ri;
+ ctx.pi = pi;
ctx.rn = rn;
update_group_af_walk(bgp, afi, safi, group_announce_route_walkcb, &ctx);
}
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index 56a82c801c..3950e2f18f 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -687,7 +687,7 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
struct bgp_adj_out *adj;
struct bgp_advertise *adv;
struct bgp_node *rn = NULL;
- struct bgp_info *binfo = NULL;
+ struct bgp_path_info *path = NULL;
bgp_size_t total_attr_len = 0;
unsigned long attrlen_pos = 0;
size_t mpattrlen_pos = 0;
@@ -731,7 +731,7 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
rn = adv->rn;
adj = adv->adj;
addpath_tx_id = adj->addpath_tx_id;
- binfo = adv->binfo;
+ path = adv->pathi;
space_remaining = STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
- BGP_MAX_PACKET_SIZE_OVERFLOW;
@@ -747,8 +747,8 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
if (stream_empty(s)) {
struct peer *from = NULL;
- if (binfo)
- from = binfo->peer;
+ if (path)
+ from = path->peer;
/* 1: Write the BGP message header - 16 bytes marker, 2
* bytes length,
@@ -821,13 +821,13 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
prd = (struct prefix_rd *)&rn->prn->p;
if (safi == SAFI_LABELED_UNICAST) {
- label = bgp_adv_label(rn, binfo, peer, afi,
+ label = bgp_adv_label(rn, path, peer, afi,
safi);
label_pnt = &label;
num_labels = 1;
- } else if (binfo && binfo->extra) {
- label_pnt = &binfo->extra->label[0];
- num_labels = binfo->extra->num_labels;
+ } else if (path && path->extra) {
+ label_pnt = &path->extra->label[0];
+ num_labels = path->extra->num_labels;
}
if (stream_empty(snlri))
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index f617c9f997..922db96079 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -7524,12 +7524,13 @@ DEFUN (show_bgp_memory,
count = mtype_stats_alloc(MTYPE_BGP_ROUTE);
vty_out(vty, "%ld BGP routes, using %s of memory\n", count,
mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct bgp_info)));
+ count * sizeof(struct bgp_path_info)));
if ((count = mtype_stats_alloc(MTYPE_BGP_ROUTE_EXTRA)))
vty_out(vty, "%ld BGP route ancillaries, using %s of memory\n",
count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct bgp_info_extra)));
+ mtype_memstr(
+ memstrbuf, sizeof(memstrbuf),
+ count * sizeof(struct bgp_path_info_extra)));
if ((count = mtype_stats_alloc(MTYPE_BGP_STATIC)))
vty_out(vty, "%ld Static routes, using %s of memory\n", count,
@@ -7681,6 +7682,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
int pfx_rcd_safi;
json_object *json_peer = NULL;
json_object *json_peers = NULL;
+ struct peer_af *paf;
/* labeled-unicast routes are installed in the unicast table so in order
* to
@@ -7975,6 +7977,11 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
use_json, json_peer);
json_object_int_add(json_peer, "prefixReceivedCount",
peer->pcount[afi][pfx_rcd_safi]);
+ paf = peer_af_find(peer, afi, pfx_rcd_safi);
+ if (paf && PAF_SUBGRP(paf))
+ json_object_int_add(json_peer,
+ "pfxSnt",
+ (PAF_SUBGRP(paf))->scount);
if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN))
json_object_string_add(json_peer, "state",
@@ -8688,6 +8695,9 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
/* Receive prefix count */
json_object_int_add(json_addr, "acceptedPrefixCounter",
p->pcount[afi][safi]);
+ if (paf && PAF_SUBGRP(paf))
+ json_object_int_add(json_addr, "sentPrefixCounter",
+ (PAF_SUBGRP(paf))->scount);
/* Maximum prefix */
if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) {
@@ -13725,11 +13735,11 @@ static void community_list_perror(struct vty *vty, int ret)
/* "community-list" keyword help string. */
#define COMMUNITY_LIST_STR "Add a community list entry\n"
-/* ip community-list standard */
-DEFUN (ip_community_list_standard,
- ip_community_list_standard_cmd,
- "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
- IP_STR
+/*community-list standard */
+DEFUN (community_list_standard,
+ bgp_community_list_standard_cmd,
+ "bgp community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
+ BGP_STR
COMMUNITY_LIST_STR
"Community list number (standard)\n"
"Add an standard community-list entry\n"
@@ -13743,6 +13753,14 @@ DEFUN (ip_community_list_standard,
int style = COMMUNITY_LIST_STANDARD;
int idx = 0;
+
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
+ zlog_warn("Deprecated option: 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
+ }
+
argv_find(argv, argc, "(1-99)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_name_or_number = argv[idx]->arg;
@@ -13765,10 +13783,12 @@ DEFUN (ip_community_list_standard,
return CMD_SUCCESS;
}
-DEFUN (no_ip_community_list_standard_all,
- no_ip_community_list_standard_all_cmd,
- "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
- NO_STR
+#if CONFDATE > 20191005
+CPP_NOTICE("bgpd: remove deprecated 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' command")
+#endif
+ALIAS (community_list_standard,
+ ip_community_list_standard_cmd,
+ "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
IP_STR
COMMUNITY_LIST_STR
"Community list number (standard)\n"
@@ -13777,12 +13797,33 @@ DEFUN (no_ip_community_list_standard_all,
"Specify community to reject\n"
"Specify community to accept\n"
COMMUNITY_VAL_STR)
+
+DEFUN (no_community_list_standard_all,
+ no_bgp_community_list_standard_all_cmd,
+ "no bgp community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
+ NO_STR
+ BGP_STR
+ COMMUNITY_LIST_STR
+ "Community list number (standard)\n"
+ "Add an standard community-list entry\n"
+ "Community list name\n"
+ "Specify community to reject\n"
+ "Specify community to accept\n"
+ COMMUNITY_VAL_STR)
{
char *cl_name_or_number = NULL;
int direct = 0;
int style = COMMUNITY_LIST_STANDARD;
int idx = 0;
+
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'no bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
+ zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> |AA:NN' being used");
+ }
+
argv_find(argv, argc, "(1-99)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_name_or_number = argv[idx]->arg;
@@ -13803,13 +13844,25 @@ DEFUN (no_ip_community_list_standard_all,
return CMD_SUCCESS;
}
-
-/* ip community-list expanded */
-DEFUN (ip_community_list_expanded_all,
- ip_community_list_expanded_all_cmd,
- "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
+ALIAS (no_community_list_standard_all,
+ no_ip_community_list_standard_all_cmd,
+ "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
+ NO_STR
IP_STR
COMMUNITY_LIST_STR
+ "Community list number (standard)\n"
+ "Add an standard community-list entry\n"
+ "Community list name\n"
+ "Specify community to reject\n"
+ "Specify community to accept\n"
+ COMMUNITY_VAL_STR)
+
+/*community-list expanded */
+DEFUN (community_list_expanded_all,
+ bgp_community_list_expanded_all_cmd,
+ "bgp community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
+ BGP_STR
+ COMMUNITY_LIST_STR
"Community list number (expanded)\n"
"Add an expanded community-list entry\n"
"Community list name\n"
@@ -13822,6 +13875,12 @@ DEFUN (ip_community_list_expanded_all,
int style = COMMUNITY_LIST_EXPANDED;
int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
+ zlog_warn("Deprecated option: 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
+ }
argv_find(argv, argc, "(100-500)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_name_or_number = argv[idx]->arg;
@@ -13844,10 +13903,9 @@ DEFUN (ip_community_list_expanded_all,
return CMD_SUCCESS;
}
-DEFUN (no_ip_community_list_expanded_all,
- no_ip_community_list_expanded_all_cmd,
- "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
- NO_STR
+ALIAS (community_list_expanded_all,
+ ip_community_list_expanded_all_cmd,
+ "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
IP_STR
COMMUNITY_LIST_STR
"Community list number (expanded)\n"
@@ -13856,12 +13914,31 @@ DEFUN (no_ip_community_list_expanded_all,
"Specify community to reject\n"
"Specify community to accept\n"
COMMUNITY_VAL_STR)
+
+DEFUN (no_community_list_expanded_all,
+ no_bgp_community_list_expanded_all_cmd,
+ "no bgp community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
+ NO_STR
+ BGP_STR
+ COMMUNITY_LIST_STR
+ "Community list number (expanded)\n"
+ "Add an expanded community-list entry\n"
+ "Community list name\n"
+ "Specify community to reject\n"
+ "Specify community to accept\n"
+ COMMUNITY_VAL_STR)
{
char *cl_name_or_number = NULL;
int direct = 0;
int style = COMMUNITY_LIST_EXPANDED;
int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'no community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
+ zlog_warn("Deprecated option: 'no community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
+ }
argv_find(argv, argc, "(100-500)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_name_or_number = argv[idx]->arg;
@@ -13883,6 +13960,19 @@ DEFUN (no_ip_community_list_expanded_all,
return CMD_SUCCESS;
}
+ALIAS (no_community_list_expanded_all,
+ no_ip_community_list_expanded_all_cmd,
+ "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
+ NO_STR
+ IP_STR
+ COMMUNITY_LIST_STR
+ "Community list number (expanded)\n"
+ "Add an expanded community-list entry\n"
+ "Community list name\n"
+ "Specify community to reject\n"
+ "Specify community to accept\n"
+ COMMUNITY_VAL_STR)
+
/* Return configuration string of community-list entry. */
static const char *community_list_config_str(struct community_entry *entry)
{
@@ -13930,16 +14020,23 @@ static void community_list_show(struct vty *vty, struct community_list *list)
}
}
-DEFUN (show_ip_community_list,
- show_ip_community_list_cmd,
- "show ip community-list",
+DEFUN (show_community_list,
+ show_bgp_community_list_cmd,
+ "show bgp community-list",
SHOW_STR
- IP_STR
+ BGP_STR
"List community-list\n")
{
struct community_list *list;
struct community_list_master *cm;
+ int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'show bgp community-list <(1-500)|WORD>'\n");
+ zlog_warn("Deprecated option: 'ip show community-list <(1-500)|WORD>' being used");
+ }
cm = community_list_master_lookup(bgp_clist, COMMUNITY_LIST_MASTER);
if (!cm)
return CMD_SUCCESS;
@@ -13953,11 +14050,18 @@ DEFUN (show_ip_community_list,
return CMD_SUCCESS;
}
-DEFUN (show_ip_community_list_arg,
- show_ip_community_list_arg_cmd,
- "show ip community-list <(1-500)|WORD>",
+ALIAS (show_community_list,
+ show_ip_community_list_cmd,
+ "show ip community-list",
SHOW_STR
IP_STR
+ "List community-list\n")
+
+DEFUN (show_community_list_arg,
+ show_bgp_community_list_arg_cmd,
+ "show bgp community-list <(1-500)|WORD>",
+ SHOW_STR
+ BGP_STR
"List community-list\n"
"Community-list number\n"
"Community-list name\n")
@@ -13965,6 +14069,13 @@ DEFUN (show_ip_community_list_arg,
int idx_comm_list = 3;
struct community_list *list;
+ int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'show bgp community-list <(1-500)|WORD>'\n");
+ zlog_warn("Deprecated option: 'ip show community-list <(1-500)|WORD>' being used");
+ }
list = community_list_lookup(bgp_clist, argv[idx_comm_list]->arg,
COMMUNITY_LIST_MASTER);
if (!list) {
@@ -13977,6 +14088,15 @@ DEFUN (show_ip_community_list_arg,
return CMD_SUCCESS;
}
+ALIAS (show_community_list_arg,
+ show_ip_community_list_arg_cmd,
+ "show ip community-list <(1-500)|WORD>",
+ SHOW_STR
+ IP_STR
+ "List community-list\n"
+ "Community-list number\n"
+ "Community-list name\n")
+
/*
* Large Community code.
*/
@@ -13990,6 +14110,12 @@ static int lcommunity_list_set_vty(struct vty *vty, int argc,
int idx = 0;
char *cl_name;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'bgp large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>'\n");
+ zlog_warn("Deprecated option: 'large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' being used");
+ }
direct = argv_find(argv, argc, "permit", &idx) ? COMMUNITY_PERMIT
: COMMUNITY_DENY;
@@ -14035,6 +14161,12 @@ static int lcommunity_list_unset_vty(struct vty *vty, int argc,
char *str = NULL;
int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'no bgp large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>'\n");
+ zlog_warn("Deprecated option: 'no ip large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' being used");
+ }
argv_find(argv, argc, "permit", &idx);
argv_find(argv, argc, "deny", &idx);
@@ -14078,7 +14210,23 @@ static int lcommunity_list_unset_vty(struct vty *vty, int argc,
#define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
#define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
-DEFUN (ip_lcommunity_list_standard,
+#if CONFDATE > 20191005
+CPP_NOTICE("bgpd: remove deprecated 'ip large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' command")
+#endif
+DEFUN (lcommunity_list_standard,
+ bgp_lcommunity_list_standard_cmd,
+ "bgp large-community-list (1-99) <deny|permit>",
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Large Community list number (standard)\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n")
+{
+ return lcommunity_list_set_vty(vty, argc, argv,
+ LARGE_COMMUNITY_LIST_STANDARD, 0);
+}
+
+ALIAS (lcommunity_list_standard,
ip_lcommunity_list_standard_cmd,
"ip large-community-list (1-99) <deny|permit>",
IP_STR
@@ -14086,12 +14234,22 @@ DEFUN (ip_lcommunity_list_standard,
"Large Community list number (standard)\n"
"Specify large community to reject\n"
"Specify large community to accept\n")
+
+DEFUN (lcommunity_list_standard1,
+ bgp_lcommunity_list_standard1_cmd,
+ "bgp large-community-list (1-99) <deny|permit> AA:BB:CC...",
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Large Community list number (standard)\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n"
+ LCOMMUNITY_VAL_STR)
{
return lcommunity_list_set_vty(vty, argc, argv,
LARGE_COMMUNITY_LIST_STANDARD, 0);
}
-DEFUN (ip_lcommunity_list_standard1,
+ALIAS (lcommunity_list_standard1,
ip_lcommunity_list_standard1_cmd,
"ip large-community-list (1-99) <deny|permit> AA:BB:CC...",
IP_STR
@@ -14100,12 +14258,22 @@ DEFUN (ip_lcommunity_list_standard1,
"Specify large community to reject\n"
"Specify large community to accept\n"
LCOMMUNITY_VAL_STR)
+
+DEFUN (lcommunity_list_expanded,
+ bgp_lcommunity_list_expanded_cmd,
+ "bgp large-community-list (100-500) <deny|permit> LINE...",
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Large Community list number (expanded)\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n"
+ "An ordered list as a regular-expression\n")
{
return lcommunity_list_set_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_STANDARD, 0);
+ LARGE_COMMUNITY_LIST_EXPANDED, 0);
}
-DEFUN (ip_lcommunity_list_expanded,
+ALIAS (lcommunity_list_expanded,
ip_lcommunity_list_expanded_cmd,
"ip large-community-list (100-500) <deny|permit> LINE...",
IP_STR
@@ -14114,12 +14282,22 @@ DEFUN (ip_lcommunity_list_expanded,
"Specify large community to reject\n"
"Specify large community to accept\n"
"An ordered list as a regular-expression\n")
+
+DEFUN (lcommunity_list_name_standard,
+ bgp_lcommunity_list_name_standard_cmd,
+ "bgp large-community-list standard WORD <deny|permit>",
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Specify standard large-community-list\n"
+ "Large Community list name\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n")
{
return lcommunity_list_set_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_EXPANDED, 0);
+ LARGE_COMMUNITY_LIST_STANDARD, 1);
}
-DEFUN (ip_lcommunity_list_name_standard,
+ALIAS (lcommunity_list_name_standard,
ip_lcommunity_list_name_standard_cmd,
"ip large-community-list standard WORD <deny|permit>",
IP_STR
@@ -14128,12 +14306,23 @@ DEFUN (ip_lcommunity_list_name_standard,
"Large Community list name\n"
"Specify large community to reject\n"
"Specify large community to accept\n")
+
+DEFUN (lcommunity_list_name_standard1,
+ bgp_lcommunity_list_name_standard1_cmd,
+ "bgp large-community-list standard WORD <deny|permit> AA:BB:CC...",
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Specify standard large-community-list\n"
+ "Large Community list name\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n"
+ LCOMMUNITY_VAL_STR)
{
return lcommunity_list_set_vty(vty, argc, argv,
LARGE_COMMUNITY_LIST_STANDARD, 1);
}
-DEFUN (ip_lcommunity_list_name_standard1,
+ALIAS (lcommunity_list_name_standard1,
ip_lcommunity_list_name_standard1_cmd,
"ip large-community-list standard WORD <deny|permit> AA:BB:CC...",
IP_STR
@@ -14143,12 +14332,23 @@ DEFUN (ip_lcommunity_list_name_standard1,
"Specify large community to reject\n"
"Specify large community to accept\n"
LCOMMUNITY_VAL_STR)
+
+DEFUN (lcommunity_list_name_expanded,
+ bgp_lcommunity_list_name_expanded_cmd,
+ "bgp large-community-list expanded WORD <deny|permit> LINE...",
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Specify expanded large-community-list\n"
+ "Large Community list name\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n"
+ "An ordered list as a regular-expression\n")
{
return lcommunity_list_set_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_STANDARD, 1);
+ LARGE_COMMUNITY_LIST_EXPANDED, 1);
}
-DEFUN (ip_lcommunity_list_name_expanded,
+ALIAS (lcommunity_list_name_expanded,
ip_lcommunity_list_name_expanded_cmd,
"ip large-community-list expanded WORD <deny|permit> LINE...",
IP_STR
@@ -14158,12 +14358,22 @@ DEFUN (ip_lcommunity_list_name_expanded,
"Specify large community to reject\n"
"Specify large community to accept\n"
"An ordered list as a regular-expression\n")
+
+DEFUN (no_lcommunity_list_standard_all,
+ no_bgp_lcommunity_list_standard_all_cmd,
+ "no bgp large-community-list <(1-99)|(100-500)|WORD>",
+ NO_STR
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Large Community list number (standard)\n"
+ "Large Community list number (expanded)\n"
+ "Large Community list name\n")
{
- return lcommunity_list_set_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_EXPANDED, 1);
+ return lcommunity_list_unset_vty(vty, argc, argv,
+ LARGE_COMMUNITY_LIST_STANDARD);
}
-DEFUN (no_ip_lcommunity_list_standard_all,
+ALIAS (no_lcommunity_list_standard_all,
no_ip_lcommunity_list_standard_all_cmd,
"no ip large-community-list <(1-99)|(100-500)|WORD>",
NO_STR
@@ -14172,12 +14382,21 @@ DEFUN (no_ip_lcommunity_list_standard_all,
"Large Community list number (standard)\n"
"Large Community list number (expanded)\n"
"Large Community list name\n")
+
+DEFUN (no_lcommunity_list_name_expanded_all,
+ no_bgp_lcommunity_list_name_expanded_all_cmd,
+ "no bgp large-community-list expanded WORD",
+ NO_STR
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Specify expanded large-community-list\n"
+ "Large Community list name\n")
{
return lcommunity_list_unset_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_STANDARD);
+ LARGE_COMMUNITY_LIST_EXPANDED);
}
-DEFUN (no_ip_lcommunity_list_name_expanded_all,
+ALIAS (no_lcommunity_list_name_expanded_all,
no_ip_lcommunity_list_name_expanded_all_cmd,
"no ip large-community-list expanded WORD",
NO_STR
@@ -14185,12 +14404,23 @@ DEFUN (no_ip_lcommunity_list_name_expanded_all,
LCOMMUNITY_LIST_STR
"Specify expanded large-community-list\n"
"Large Community list name\n")
+
+DEFUN (no_lcommunity_list_standard,
+ no_bgp_lcommunity_list_standard_cmd,
+ "no bgp large-community-list (1-99) <deny|permit> AA:AA:NN...",
+ NO_STR
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Large Community list number (standard)\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n"
+ LCOMMUNITY_VAL_STR)
{
return lcommunity_list_unset_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_EXPANDED);
+ LARGE_COMMUNITY_LIST_STANDARD);
}
-DEFUN (no_ip_lcommunity_list_standard,
+ALIAS (no_lcommunity_list_standard,
no_ip_lcommunity_list_standard_cmd,
"no ip large-community-list (1-99) <deny|permit> AA:AA:NN...",
NO_STR
@@ -14200,12 +14430,23 @@ DEFUN (no_ip_lcommunity_list_standard,
"Specify large community to reject\n"
"Specify large community to accept\n"
LCOMMUNITY_VAL_STR)
+
+DEFUN (no_lcommunity_list_expanded,
+ no_bgp_lcommunity_list_expanded_cmd,
+ "no bgp large-community-list (100-500) <deny|permit> LINE...",
+ NO_STR
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Large Community list number (expanded)\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n"
+ "An ordered list as a regular-expression\n")
{
return lcommunity_list_unset_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_STANDARD);
+ LARGE_COMMUNITY_LIST_EXPANDED);
}
-DEFUN (no_ip_lcommunity_list_expanded,
+ALIAS (no_lcommunity_list_expanded,
no_ip_lcommunity_list_expanded_cmd,
"no ip large-community-list (100-500) <deny|permit> LINE...",
NO_STR
@@ -14215,12 +14456,24 @@ DEFUN (no_ip_lcommunity_list_expanded,
"Specify large community to reject\n"
"Specify large community to accept\n"
"An ordered list as a regular-expression\n")
+
+DEFUN (no_lcommunity_list_name_standard,
+ no_bgp_lcommunity_list_name_standard_cmd,
+ "no bgp large-community-list standard WORD <deny|permit> AA:AA:NN...",
+ NO_STR
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Specify standard large-community-list\n"
+ "Large Community list name\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n"
+ LCOMMUNITY_VAL_STR)
{
return lcommunity_list_unset_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_EXPANDED);
+ LARGE_COMMUNITY_LIST_STANDARD);
}
-DEFUN (no_ip_lcommunity_list_name_standard,
+ALIAS (no_lcommunity_list_name_standard,
no_ip_lcommunity_list_name_standard_cmd,
"no ip large-community-list standard WORD <deny|permit> AA:AA:NN...",
NO_STR
@@ -14231,12 +14484,24 @@ DEFUN (no_ip_lcommunity_list_name_standard,
"Specify large community to reject\n"
"Specify large community to accept\n"
LCOMMUNITY_VAL_STR)
+
+DEFUN (no_lcommunity_list_name_expanded,
+ no_bgp_lcommunity_list_name_expanded_cmd,
+ "no bgp large-community-list expanded WORD <deny|permit> LINE...",
+ NO_STR
+ BGP_STR
+ LCOMMUNITY_LIST_STR
+ "Specify expanded large-community-list\n"
+ "Large community list name\n"
+ "Specify large community to reject\n"
+ "Specify large community to accept\n"
+ "An ordered list as a regular-expression\n")
{
return lcommunity_list_unset_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_STANDARD);
+ LARGE_COMMUNITY_LIST_EXPANDED);
}
-DEFUN (no_ip_lcommunity_list_name_expanded,
+ALIAS (no_lcommunity_list_name_expanded,
no_ip_lcommunity_list_name_expanded_cmd,
"no ip large-community-list expanded WORD <deny|permit> LINE...",
NO_STR
@@ -14247,10 +14512,6 @@ DEFUN (no_ip_lcommunity_list_name_expanded,
"Specify large community to reject\n"
"Specify large community to accept\n"
"An ordered list as a regular-expression\n")
-{
- return lcommunity_list_unset_vty(vty, argc, argv,
- LARGE_COMMUNITY_LIST_EXPANDED);
-}
static void lcommunity_list_show(struct vty *vty, struct community_list *list)
{
@@ -14282,15 +14543,23 @@ static void lcommunity_list_show(struct vty *vty, struct community_list *list)
}
}
-DEFUN (show_ip_lcommunity_list,
- show_ip_lcommunity_list_cmd,
- "show ip large-community-list",
+DEFUN (show_lcommunity_list,
+ show_bgp_lcommunity_list_cmd,
+ "show bgp large-community-list",
SHOW_STR
- IP_STR
+ BGP_STR
"List large-community list\n")
{
struct community_list *list;
struct community_list_master *cm;
+ int idx = 0;
+
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'show bgp large-community-list <(1-500)|WORD>'\n");
+ zlog_warn("Deprecated option: 'ip show large-community-list <(1-500)|WORD>' being used");
+ }
cm = community_list_master_lookup(bgp_clist,
LARGE_COMMUNITY_LIST_MASTER);
@@ -14306,16 +14575,31 @@ DEFUN (show_ip_lcommunity_list,
return CMD_SUCCESS;
}
-DEFUN (show_ip_lcommunity_list_arg,
- show_ip_lcommunity_list_arg_cmd,
- "show ip large-community-list <(1-500)|WORD>",
+ALIAS (show_lcommunity_list,
+ show_ip_lcommunity_list_cmd,
+ "show ip large-community-list",
SHOW_STR
IP_STR
+ "List large-community list\n")
+
+DEFUN (show_lcommunity_list_arg,
+ show_bgp_lcommunity_list_arg_cmd,
+ "show bgp large-community-list <(1-500)|WORD>",
+ SHOW_STR
+ BGP_STR
"List large-community list\n"
"large-community-list number\n"
"large-community-list name\n")
{
struct community_list *list;
+ int idx = 0;
+
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'show bgp large-community-list <(1-500)|WORD>'\n");
+ zlog_warn("Deprecated option: 'ip show large-community-list <(1-500)|WORD>' being used");
+ }
list = community_list_lookup(bgp_clist, argv[3]->arg,
LARGE_COMMUNITY_LIST_MASTER);
@@ -14329,14 +14613,23 @@ DEFUN (show_ip_lcommunity_list_arg,
return CMD_SUCCESS;
}
+ALIAS (show_lcommunity_list_arg,
+ show_ip_lcommunity_list_arg_cmd,
+ "show ip large-community-list <(1-500)|WORD>",
+ SHOW_STR
+ IP_STR
+ "List large-community list\n"
+ "large-community-list number\n"
+ "large-community-list name\n")
+
/* "extcommunity-list" keyword help string. */
#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
-DEFUN (ip_extcommunity_list_standard,
- ip_extcommunity_list_standard_cmd,
- "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
- IP_STR
+DEFUN (extcommunity_list_standard,
+ bgp_extcommunity_list_standard_cmd,
+ "bgp extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
+ BGP_STR
EXTCOMMUNITY_LIST_STR
"Extended Community list number (standard)\n"
"Specify standard extcommunity-list\n"
@@ -14350,6 +14643,12 @@ DEFUN (ip_extcommunity_list_standard,
char *cl_number_or_name = NULL;
int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
+ zlog_warn("Deprecated option: 'ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
+ }
argv_find(argv, argc, "(1-99)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_number_or_name = argv[idx]->arg;
@@ -14371,11 +14670,26 @@ DEFUN (ip_extcommunity_list_standard,
return CMD_SUCCESS;
}
-DEFUN (ip_extcommunity_list_name_expanded,
- ip_extcommunity_list_name_expanded_cmd,
- "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
+#if CONFDATE > 20191005
+CPP_NOTICE("bgpd: remove deprecated 'ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' command")
+#endif
+ALIAS (extcommunity_list_standard,
+ ip_extcommunity_list_standard_cmd,
+ "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
IP_STR
EXTCOMMUNITY_LIST_STR
+ "Extended Community list number (standard)\n"
+ "Specify standard extcommunity-list\n"
+ "Community list name\n"
+ "Specify community to reject\n"
+ "Specify community to accept\n"
+ EXTCOMMUNITY_VAL_STR)
+
+DEFUN (extcommunity_list_name_expanded,
+ bgp_extcommunity_list_name_expanded_cmd,
+ "bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
+ BGP_STR
+ EXTCOMMUNITY_LIST_STR
"Extended Community list number (expanded)\n"
"Specify expanded extcommunity-list\n"
"Extended Community list name\n"
@@ -14388,6 +14702,13 @@ DEFUN (ip_extcommunity_list_name_expanded,
char *cl_number_or_name = NULL;
int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
+ zlog_warn("Deprecated option: ‘ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
+ }
+
argv_find(argv, argc, "(100-500)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_number_or_name = argv[idx]->arg;
@@ -14409,12 +14730,24 @@ DEFUN (ip_extcommunity_list_name_expanded,
return CMD_SUCCESS;
}
-DEFUN (no_ip_extcommunity_list_standard_all,
- no_ip_extcommunity_list_standard_all_cmd,
- "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
- NO_STR
+ALIAS (extcommunity_list_name_expanded,
+ ip_extcommunity_list_name_expanded_cmd,
+ "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
IP_STR
EXTCOMMUNITY_LIST_STR
+ "Extended Community list number (expanded)\n"
+ "Specify expanded extcommunity-list\n"
+ "Extended Community list name\n"
+ "Specify community to reject\n"
+ "Specify community to accept\n"
+ "An ordered list as a regular-expression\n")
+
+DEFUN (no_extcommunity_list_standard_all,
+ no_bgp_extcommunity_list_standard_all_cmd,
+ "no bgp extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
+ NO_STR
+ BGP_STR
+ EXTCOMMUNITY_LIST_STR
"Extended Community list number (standard)\n"
"Specify standard extcommunity-list\n"
"Community list name\n"
@@ -14427,6 +14760,12 @@ DEFUN (no_ip_extcommunity_list_standard_all,
char *cl_number_or_name = NULL;
int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'no bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
+ zlog_warn("Deprecated option: ‘no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
+ }
argv_find(argv, argc, "(1-99)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_number_or_name = argv[idx]->arg;
@@ -14448,12 +14787,25 @@ DEFUN (no_ip_extcommunity_list_standard_all,
return CMD_SUCCESS;
}
-DEFUN (no_ip_extcommunity_list_expanded_all,
- no_ip_extcommunity_list_expanded_all_cmd,
- "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
+ALIAS (no_extcommunity_list_standard_all,
+ no_ip_extcommunity_list_standard_all_cmd,
+ "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
NO_STR
IP_STR
EXTCOMMUNITY_LIST_STR
+ "Extended Community list number (standard)\n"
+ "Specify standard extcommunity-list\n"
+ "Community list name\n"
+ "Specify community to reject\n"
+ "Specify community to accept\n"
+ EXTCOMMUNITY_VAL_STR)
+
+DEFUN (no_extcommunity_list_expanded_all,
+ no_bgp_extcommunity_list_expanded_all_cmd,
+ "no bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
+ NO_STR
+ BGP_STR
+ EXTCOMMUNITY_LIST_STR
"Extended Community list number (expanded)\n"
"Specify expanded extcommunity-list\n"
"Extended Community list name\n"
@@ -14466,6 +14818,12 @@ DEFUN (no_ip_extcommunity_list_expanded_all,
char *cl_number_or_name = NULL;
int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'no bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
+ zlog_warn("Deprecated option: ‘no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
+ }
argv_find(argv, argc, "(100-500)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_number_or_name = argv[idx]->arg;
@@ -14487,6 +14845,19 @@ DEFUN (no_ip_extcommunity_list_expanded_all,
return CMD_SUCCESS;
}
+ALIAS (no_extcommunity_list_expanded_all,
+ no_ip_extcommunity_list_expanded_all_cmd,
+ "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
+ NO_STR
+ IP_STR
+ EXTCOMMUNITY_LIST_STR
+ "Extended Community list number (expanded)\n"
+ "Specify expanded extcommunity-list\n"
+ "Extended Community list name\n"
+ "Specify community to reject\n"
+ "Specify community to accept\n"
+ "An ordered list as a regular-expression\n")
+
static void extcommunity_list_show(struct vty *vty, struct community_list *list)
{
struct community_entry *entry;
@@ -14517,16 +14888,23 @@ static void extcommunity_list_show(struct vty *vty, struct community_list *list)
}
}
-DEFUN (show_ip_extcommunity_list,
- show_ip_extcommunity_list_cmd,
- "show ip extcommunity-list",
+DEFUN (show_extcommunity_list,
+ show_bgp_extcommunity_list_cmd,
+ "show bgp extcommunity-list",
SHOW_STR
- IP_STR
+ BGP_STR
"List extended-community list\n")
{
struct community_list *list;
struct community_list_master *cm;
+ int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'show bgp extcommunity-list <(1-500)|WORD>'\n");
+ zlog_warn("Deprecated option: 'ip show extcommunity-list <(1-500)|WORD>' being used");
+ }
cm = community_list_master_lookup(bgp_clist, EXTCOMMUNITY_LIST_MASTER);
if (!cm)
return CMD_SUCCESS;
@@ -14540,18 +14918,32 @@ DEFUN (show_ip_extcommunity_list,
return CMD_SUCCESS;
}
-DEFUN (show_ip_extcommunity_list_arg,
- show_ip_extcommunity_list_arg_cmd,
- "show ip extcommunity-list <(1-500)|WORD>",
+ALIAS (show_extcommunity_list,
+ show_ip_extcommunity_list_cmd,
+ "show ip extcommunity-list",
SHOW_STR
IP_STR
+ "List extended-community list\n")
+
+DEFUN (show_extcommunity_list_arg,
+ show_bgp_extcommunity_list_arg_cmd,
+ "show bgp extcommunity-list <(1-500)|WORD>",
+ SHOW_STR
+ BGP_STR
"List extended-community list\n"
"Extcommunity-list number\n"
"Extcommunity-list name\n")
{
int idx_comm_list = 3;
struct community_list *list;
+ int idx = 0;
+ if (argv_find(argv, argc, "ip", &idx)) {
+ vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
+ vty_out(vty, "if you are using this please migrate to the below command.\n");
+ vty_out(vty, "'show bgp extcommunity-list <(1-500)|WORD>'\n");
+ zlog_warn("Deprecated option: 'ip show extcommunity-list <(1-500)|WORD>' being used");
+ }
list = community_list_lookup(bgp_clist, argv[idx_comm_list]->arg,
EXTCOMMUNITY_LIST_MASTER);
if (!list) {
@@ -14564,6 +14956,15 @@ DEFUN (show_ip_extcommunity_list_arg,
return CMD_SUCCESS;
}
+ALIAS (show_extcommunity_list_arg,
+ show_ip_extcommunity_list_arg_cmd,
+ "show ip extcommunity-list <(1-500)|WORD>",
+ SHOW_STR
+ IP_STR
+ "List extended-community list\n"
+ "Extcommunity-list number\n"
+ "Extcommunity-list name\n")
+
/* Display community-list and extcommunity-list configuration. */
static int community_list_config_write(struct vty *vty)
{
@@ -14577,14 +14978,14 @@ static int community_list_config_write(struct vty *vty)
for (list = cm->num.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next) {
- vty_out(vty, "ip community-list %s %s %s\n", list->name,
+ vty_out(vty, "bgp community-list %s %s %s\n", list->name,
community_direct_str(entry->direct),
community_list_config_str(entry));
write++;
}
for (list = cm->str.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next) {
- vty_out(vty, "ip community-list %s %s %s %s\n",
+ vty_out(vty, "bgp community-list %s %s %s %s\n",
entry->style == COMMUNITY_LIST_STANDARD
? "standard"
: "expanded",
@@ -14598,14 +14999,14 @@ static int community_list_config_write(struct vty *vty)
for (list = cm->num.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next) {
- vty_out(vty, "ip extcommunity-list %s %s %s\n",
+ vty_out(vty, "bgp extcommunity-list %s %s %s\n",
list->name, community_direct_str(entry->direct),
community_list_config_str(entry));
write++;
}
for (list = cm->str.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next) {
- vty_out(vty, "ip extcommunity-list %s %s %s %s\n",
+ vty_out(vty, "bgp extcommunity-list %s %s %s %s\n",
entry->style == EXTCOMMUNITY_LIST_STANDARD
? "standard"
: "expanded",
@@ -14621,14 +15022,14 @@ static int community_list_config_write(struct vty *vty)
for (list = cm->num.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next) {
- vty_out(vty, "ip large-community-list %s %s %s\n",
+ vty_out(vty, "bgp large-community-list %s %s %s\n",
list->name, community_direct_str(entry->direct),
community_list_config_str(entry));
write++;
}
for (list = cm->str.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next) {
- vty_out(vty, "ip large-community-list %s %s %s %s\n",
+ vty_out(vty, "bgp large-community-list %s %s %s %s\n",
entry->style == LARGE_COMMUNITY_LIST_STANDARD
? "standard"
: "expanded",
@@ -14649,6 +15050,12 @@ static void community_list_vty(void)
install_node(&community_list_node, community_list_config_write);
/* Community-list. */
+ install_element(CONFIG_NODE, &bgp_community_list_standard_cmd);
+ install_element(CONFIG_NODE, &bgp_community_list_expanded_all_cmd);
+ install_element(CONFIG_NODE, &no_bgp_community_list_standard_all_cmd);
+ install_element(CONFIG_NODE, &no_bgp_community_list_expanded_all_cmd);
+ install_element(VIEW_NODE, &show_bgp_community_list_cmd);
+ install_element(VIEW_NODE, &show_bgp_community_list_arg_cmd);
install_element(CONFIG_NODE, &ip_community_list_standard_cmd);
install_element(CONFIG_NODE, &ip_community_list_expanded_all_cmd);
install_element(CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
@@ -14657,6 +15064,12 @@ static void community_list_vty(void)
install_element(VIEW_NODE, &show_ip_community_list_arg_cmd);
/* Extcommunity-list. */
+ install_element(CONFIG_NODE, &bgp_extcommunity_list_standard_cmd);
+ install_element(CONFIG_NODE, &bgp_extcommunity_list_name_expanded_cmd);
+ install_element(CONFIG_NODE, &no_bgp_extcommunity_list_standard_all_cmd);
+ install_element(CONFIG_NODE, &no_bgp_extcommunity_list_expanded_all_cmd);
+ install_element(VIEW_NODE, &show_bgp_extcommunity_list_cmd);
+ install_element(VIEW_NODE, &show_bgp_extcommunity_list_arg_cmd);
install_element(CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
install_element(CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
install_element(CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
@@ -14665,6 +15078,21 @@ static void community_list_vty(void)
install_element(VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
/* Large Community List */
+ install_element(CONFIG_NODE, &bgp_lcommunity_list_standard_cmd);
+ install_element(CONFIG_NODE, &bgp_lcommunity_list_standard1_cmd);
+ install_element(CONFIG_NODE, &bgp_lcommunity_list_expanded_cmd);
+ install_element(CONFIG_NODE, &bgp_lcommunity_list_name_standard_cmd);
+ install_element(CONFIG_NODE, &bgp_lcommunity_list_name_standard1_cmd);
+ install_element(CONFIG_NODE, &bgp_lcommunity_list_name_expanded_cmd);
+ install_element(CONFIG_NODE, &no_bgp_lcommunity_list_standard_all_cmd);
+ install_element(CONFIG_NODE,
+ &no_bgp_lcommunity_list_name_expanded_all_cmd);
+ install_element(CONFIG_NODE, &no_bgp_lcommunity_list_standard_cmd);
+ install_element(CONFIG_NODE, &no_bgp_lcommunity_list_expanded_cmd);
+ install_element(CONFIG_NODE, &no_bgp_lcommunity_list_name_standard_cmd);
+ install_element(CONFIG_NODE, &no_bgp_lcommunity_list_name_expanded_cmd);
+ install_element(VIEW_NODE, &show_bgp_lcommunity_list_cmd);
+ install_element(VIEW_NODE, &show_bgp_lcommunity_list_arg_cmd);
install_element(CONFIG_NODE, &ip_lcommunity_list_standard_cmd);
install_element(CONFIG_NODE, &ip_lcommunity_list_standard1_cmd);
install_element(CONFIG_NODE, &ip_lcommunity_list_expanded_cmd);
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 5a5c7c9861..b2148e52c6 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -925,41 +925,40 @@ bool bgp_zebra_nexthop_set(union sockunion *local, union sockunion *remote,
return true;
}
-static struct in6_addr *bgp_info_to_ipv6_nexthop(struct bgp_info *info,
- ifindex_t *ifindex)
+static struct in6_addr *
+bgp_path_info_to_ipv6_nexthop(struct bgp_path_info *path, ifindex_t *ifindex)
{
struct in6_addr *nexthop = NULL;
/* Only global address nexthop exists. */
- if (info->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) {
- nexthop = &info->attr->mp_nexthop_global;
+ if (path->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) {
+ nexthop = &path->attr->mp_nexthop_global;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
- *ifindex = info->attr->nh_ifindex;
-
+ *ifindex = path->attr->nh_ifindex;
}
/* If both global and link-local address present. */
- if (info->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
+ if (path->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
/* Check if route-map is set to prefer global over link-local */
- if (info->attr->mp_nexthop_prefer_global) {
- nexthop = &info->attr->mp_nexthop_global;
+ if (path->attr->mp_nexthop_prefer_global) {
+ nexthop = &path->attr->mp_nexthop_global;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
- *ifindex = info->attr->nh_ifindex;
+ *ifindex = path->attr->nh_ifindex;
} else {
/* Workaround for Cisco's nexthop bug. */
if (IN6_IS_ADDR_UNSPECIFIED(
- &info->attr->mp_nexthop_global)
- && info->peer->su_remote->sa.sa_family
+ &path->attr->mp_nexthop_global)
+ && path->peer->su_remote->sa.sa_family
== AF_INET6) {
nexthop =
- &info->peer->su_remote->sin6.sin6_addr;
+ &path->peer->su_remote->sin6.sin6_addr;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
- *ifindex = info->peer->nexthop.ifp
+ *ifindex = path->peer->nexthop.ifp
->ifindex;
} else {
- nexthop = &info->attr->mp_nexthop_local;
+ nexthop = &path->attr->mp_nexthop_local;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
- *ifindex = info->attr->nh_lla_ifindex;
+ *ifindex = path->attr->nh_lla_ifindex;
}
}
}
@@ -968,12 +967,12 @@ static struct in6_addr *bgp_info_to_ipv6_nexthop(struct bgp_info *info,
}
static int bgp_table_map_apply(struct route_map *map, struct prefix *p,
- struct bgp_info *info)
+ struct bgp_path_info *path)
{
route_map_result_t ret;
- ret = route_map_apply(map, p, RMAP_BGP, info);
- bgp_attr_flush(info->attr);
+ ret = route_map_apply(map, p, RMAP_BGP, path);
+ bgp_attr_flush(path->attr);
if (ret != RMAP_DENYMATCH)
return 1;
@@ -986,7 +985,7 @@ static int bgp_table_map_apply(struct route_map *map, struct prefix *p,
inet_ntop(AF_INET, &p->u.prefix4, buf[0],
sizeof(buf[0])),
p->prefixlen,
- inet_ntop(AF_INET, &info->attr->nexthop, buf[1],
+ inet_ntop(AF_INET, &path->attr->nexthop, buf[1],
sizeof(buf[1])));
}
if (p->family == AF_INET6) {
@@ -994,7 +993,7 @@ static int bgp_table_map_apply(struct route_map *map, struct prefix *p,
ifindex_t ifindex;
struct in6_addr *nexthop;
- nexthop = bgp_info_to_ipv6_nexthop(info, &ifindex);
+ nexthop = bgp_path_info_to_ipv6_nexthop(path, &ifindex);
zlog_debug(
"Zebra rmap deny: IPv6 route %s/%d nexthop %s",
inet_ntop(AF_INET6, &p->u.prefix6, buf[0],
@@ -1121,17 +1120,15 @@ static int update_ipv4nh_for_route_install(int nh_othervrf,
return 1;
}
-static int update_ipv6nh_for_route_install(int nh_othervrf,
- struct in6_addr *nexthop,
- ifindex_t ifindex,
- struct bgp_info *ri,
- struct bgp_info *best_ri,
- bool is_evpn,
- struct zapi_nexthop *api_nh)
+static int
+update_ipv6nh_for_route_install(int nh_othervrf, struct in6_addr *nexthop,
+ ifindex_t ifindex, struct bgp_path_info *pi,
+ struct bgp_path_info *best_pi, bool is_evpn,
+ struct zapi_nexthop *api_nh)
{
struct attr *attr;
- attr = ri->attr;
+ attr = pi->attr;
if (is_evpn)
api_nh->type = NEXTHOP_TYPE_IPV6_IFINDEX;
@@ -1150,22 +1147,22 @@ static int update_ipv6nh_for_route_install(int nh_othervrf,
}
} else {
if (IN6_IS_ADDR_LINKLOCAL(nexthop)) {
- if (ri == best_ri &&
- attr->mp_nexthop_len
- == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
- if (ri->peer->nexthop.ifp)
- ifindex = ri->peer->nexthop.ifp
- ->ifindex;
+ if (pi == best_pi
+ && attr->mp_nexthop_len
+ == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
+ if (pi->peer->nexthop.ifp)
+ ifindex =
+ pi->peer->nexthop.ifp->ifindex;
if (!ifindex) {
- if (ri->peer->conf_if)
- ifindex = ri->peer->ifp->ifindex;
- else if (ri->peer->ifname)
+ if (pi->peer->conf_if)
+ ifindex = pi->peer->ifp->ifindex;
+ else if (pi->peer->ifname)
ifindex = ifname2ifindex(
- ri->peer->ifname,
- ri->peer->bgp->vrf_id);
- else if (ri->peer->nexthop.ifp)
- ifindex = ri->peer->nexthop.ifp
- ->ifindex;
+ pi->peer->ifname,
+ pi->peer->bgp->vrf_id);
+ else if (pi->peer->nexthop.ifp)
+ ifindex =
+ pi->peer->nexthop.ifp->ifindex;
}
if (ifindex == 0)
@@ -1183,7 +1180,7 @@ static int update_ipv6nh_for_route_install(int nh_othervrf,
}
void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
- struct bgp_info *info, struct bgp *bgp, afi_t afi,
+ struct bgp_path_info *info, struct bgp *bgp, afi_t afi,
safi_t safi)
{
struct zapi_route api;
@@ -1193,11 +1190,11 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
int has_valid_label = 0;
uint8_t distance;
struct peer *peer;
- struct bgp_info *mpinfo;
+ struct bgp_path_info *mpinfo;
uint32_t metric;
struct attr local_attr;
- struct bgp_info local_info;
- struct bgp_info *mpinfo_cp = &local_info;
+ struct bgp_path_info local_info;
+ struct bgp_path_info *mpinfo_cp = &local_info;
route_tag_t tag;
mpls_label_t label;
int nh_othervrf = 0;
@@ -1242,7 +1239,8 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
/* Obtain peer from parent */
if (info->extra && info->extra->parent)
- peer = ((struct bgp_info *)(info->extra->parent))->peer;
+ peer = ((struct bgp_path_info *)(info->extra->parent))
+ ->peer;
}
tag = info->attr->tag;
@@ -1266,7 +1264,7 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
/* Metric is currently based on the best-path only */
metric = info->attr->med;
- for (mpinfo = info; mpinfo; mpinfo = bgp_info_mpath_next(mpinfo)) {
+ for (mpinfo = info; mpinfo; mpinfo = bgp_path_info_mpath_next(mpinfo)) {
if (valid_nh_count >= multipath_num)
break;
@@ -1356,8 +1354,8 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
tag = mpinfo_cp->attr->tag;
}
}
- nexthop = bgp_info_to_ipv6_nexthop(mpinfo_cp,
- &ifindex);
+ nexthop = bgp_path_info_to_ipv6_nexthop(mpinfo_cp,
+ &ifindex);
nh_updated = update_ipv6nh_for_route_install(
nh_othervrf, nexthop, ifindex,
mpinfo, info, is_evpn, api_nh);
@@ -1466,7 +1464,7 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi)
{
struct bgp_node *rn;
struct bgp_table *table;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
/* Don't try to install if we're not connected to Zebra or Zebra doesn't
* know of this instance.
@@ -1479,18 +1477,18 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi)
return;
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
- for (ri = rn->info; ri; ri = ri->next)
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) &&
+ for (pi = rn->info; pi; pi = pi->next)
+ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED) &&
- (ri->type == ZEBRA_ROUTE_BGP
- && (ri->sub_type == BGP_ROUTE_NORMAL
- || ri->sub_type == BGP_ROUTE_IMPORTED)))
+ (pi->type == ZEBRA_ROUTE_BGP
+ && (pi->sub_type == BGP_ROUTE_NORMAL
+ || pi->sub_type == BGP_ROUTE_IMPORTED)))
- bgp_zebra_announce(rn, &rn->p, ri, bgp, afi,
+ bgp_zebra_announce(rn, &rn->p, pi, bgp, afi,
safi);
}
-void bgp_zebra_withdraw(struct prefix *p, struct bgp_info *info,
+void bgp_zebra_withdraw(struct prefix *p, struct bgp_path_info *info,
struct bgp *bgp, safi_t safi)
{
struct zapi_route api;
@@ -1680,7 +1678,7 @@ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red,
afi_t afi, int type, uint32_t metric)
{
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *pi;
if (red->redist_metric_flag && red->redist_metric == metric)
return 0;
@@ -1690,21 +1688,21 @@ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red,
for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- for (ri = rn->info; ri; ri = ri->next) {
- if (ri->sub_type == BGP_ROUTE_REDISTRIBUTE
- && ri->type == type
- && ri->instance == red->instance) {
+ for (pi = rn->info; pi; pi = pi->next) {
+ if (pi->sub_type == BGP_ROUTE_REDISTRIBUTE
+ && pi->type == type
+ && pi->instance == red->instance) {
struct attr *old_attr;
struct attr new_attr;
- bgp_attr_dup(&new_attr, ri->attr);
+ bgp_attr_dup(&new_attr, pi->attr);
new_attr.med = red->redist_metric;
- old_attr = ri->attr;
- ri->attr = bgp_attr_intern(&new_attr);
+ old_attr = pi->attr;
+ pi->attr = bgp_attr_intern(&new_attr);
bgp_attr_unintern(&old_attr);
- bgp_info_set_flag(rn, ri,
- BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(rn, pi,
+ BGP_PATH_ATTR_CHANGED);
bgp_process(bgp, rn, afi, SAFI_UNICAST);
}
}
@@ -1933,6 +1931,29 @@ int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni)
return zclient_send_message(zclient);
}
+int bgp_zebra_vxlan_flood_control(struct bgp *bgp,
+ enum vxlan_flood_control flood_ctrl)
+{
+ struct stream *s;
+
+ /* Check socket. */
+ if (!zclient || zclient->sock < 0)
+ return 0;
+
+ /* Don't try to register if Zebra doesn't know of this instance. */
+ if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp))
+ return 0;
+
+ s = zclient->obuf;
+ stream_reset(s);
+
+ zclient_create_header(s, ZEBRA_VXLAN_FLOOD_CONTROL, bgp->vrf_id);
+ stream_putc(s, flood_ctrl);
+ stream_putw_at(s, 0, stream_get_endp(s));
+
+ return zclient_send_message(zclient);
+}
+
int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise)
{
struct stream *s;
@@ -1950,6 +1971,10 @@ int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise)
zclient_create_header(s, ZEBRA_ADVERTISE_ALL_VNI, bgp->vrf_id);
stream_putc(s, advertise);
+ /* Also inform current BUM handling setting. This is really
+ * relevant only when 'advertise' is set.
+ */
+ stream_putc(s, bgp->vxlan_flood_ctrl);
stream_putw_at(s, 0, stream_get_endp(s));
return zclient_send_message(zclient);
@@ -2081,20 +2106,20 @@ static int ipset_entry_notify_owner(int command, struct zclient *zclient,
break;
case ZAPI_IPSET_ENTRY_INSTALLED:
{
- struct bgp_info *bgp_info;
- struct bgp_info_extra *extra;
-
- bgp_pbime->installed = true;
- bgp_pbime->install_in_progress = false;
- if (BGP_DEBUG(zebra, ZEBRA))
- zlog_debug("%s: Received IPSET_ENTRY_INSTALLED",
- __PRETTY_FUNCTION__);
- /* link bgp_info to bpme */
- bgp_info = (struct bgp_info *)bgp_pbime->bgp_info;
- extra = bgp_info_extra_get(bgp_info);
- if (extra->bgp_fs_pbr == NULL)
- extra->bgp_fs_pbr = list_new();
- listnode_add(extra->bgp_fs_pbr, bgp_pbime);
+ struct bgp_path_info *path;
+ struct bgp_path_info_extra *extra;
+
+ bgp_pbime->installed = true;
+ bgp_pbime->install_in_progress = false;
+ if (BGP_DEBUG(zebra, ZEBRA))
+ zlog_debug("%s: Received IPSET_ENTRY_INSTALLED",
+ __PRETTY_FUNCTION__);
+ /* link bgp_path_info to bpme */
+ path = (struct bgp_path_info *)bgp_pbime->path;
+ extra = bgp_path_info_extra_get(path);
+ if (extra->bgp_fs_pbr == NULL)
+ extra->bgp_fs_pbr = list_new();
+ listnode_add(extra->bgp_fs_pbr, bgp_pbime);
}
break;
case ZAPI_IPSET_ENTRY_FAIL_REMOVE:
diff --git a/bgpd/bgp_zebra.h b/bgpd/bgp_zebra.h
index 0223c423df..458730dd43 100644
--- a/bgpd/bgp_zebra.h
+++ b/bgpd/bgp_zebra.h
@@ -36,11 +36,12 @@ extern void bgp_config_write_maxpaths(struct vty *, struct bgp *, afi_t,
safi_t);
extern void bgp_config_write_redistribute(struct vty *, struct bgp *, afi_t,
safi_t);
-extern void bgp_zebra_announce(struct bgp_node *, struct prefix *,
- struct bgp_info *, struct bgp *, afi_t, safi_t);
+extern void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p,
+ struct bgp_path_info *path, struct bgp *bgp,
+ afi_t afi, safi_t safi);
extern void bgp_zebra_announce_table(struct bgp *, afi_t, safi_t);
-extern void bgp_zebra_withdraw(struct prefix *, struct bgp_info *,
- struct bgp *, safi_t);
+extern void bgp_zebra_withdraw(struct prefix *p, struct bgp_path_info *path,
+ struct bgp *bgp, safi_t safi);
extern void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer);
extern void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer);
@@ -71,6 +72,8 @@ extern int bgp_zebra_advertise_subnet(struct bgp *bgp, int advertise,
vni_t vni);
extern int bgp_zebra_advertise_gw_macip(struct bgp *, int, vni_t);
extern int bgp_zebra_advertise_all_vni(struct bgp *, int);
+extern int bgp_zebra_vxlan_flood_control(struct bgp *bgp,
+ enum vxlan_flood_control flood_ctrl);
extern int bgp_zebra_num_connects(void);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 861435c036..cef5394b09 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -485,6 +485,11 @@ struct bgp {
/* EVPN - use RFC 8365 to auto-derive RT */
int advertise_autort_rfc8365;
+ /*
+ * Flooding mechanism for BUM packets for VxLAN-EVPN.
+ */
+ enum vxlan_flood_control vxlan_flood_ctrl;
+
/* Hash table of Import RTs to EVIs */
struct hash *import_rt_hash;
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index c7c2239db7..6978dd145d 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -361,7 +361,7 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
{
afi_t afi; /* of the VN address */
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
char buf[PREFIX_STRLEN];
char buf2[RD_ADDRSTRLEN];
struct prefix_rd prd0;
@@ -384,21 +384,22 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
__func__, peer, buf, prefix_rd2str(prd, buf2, sizeof(buf2)),
afi, safi, bn, (bn ? bn->info : NULL));
- for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
+ for (bpi = (bn ? bn->info : NULL); bpi; bpi = bpi->next) {
vnc_zlog_debug_verbose(
- "%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p, local_pref=%u",
- __func__, bi, bi->peer, bi->type, bi->sub_type,
- (bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL),
- ((bi->attr
- && CHECK_FLAG(bi->attr->flag,
+ "%s: trying bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p, local_pref=%u",
+ __func__, bpi, bpi->peer, bpi->type, bpi->sub_type,
+ (bpi->extra ? bpi->extra->vnc.export.rfapi_handle
+ : NULL),
+ ((bpi->attr
+ && CHECK_FLAG(bpi->attr->flag,
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)))
- ? bi->attr->local_pref
+ ? bpi->attr->local_pref
: 0));
- if (bi->peer == peer && bi->type == type
- && bi->sub_type == sub_type && bi->extra
- && bi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+ if (bpi->peer == peer && bpi->type == type
+ && bpi->sub_type == sub_type && bpi->extra
+ && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
vnc_zlog_debug_verbose("%s: matched it", __func__);
@@ -412,8 +413,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
* route. Leave the route itself in place.
* TBD add return code reporting of success/failure
*/
- if (!bi || !bi->extra
- || !bi->extra->vnc.export.local_nexthops) {
+ if (!bpi || !bpi->extra
+ || !bpi->extra->vnc.export.local_nexthops) {
/*
* no local nexthops
*/
@@ -429,7 +430,7 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
struct listnode *node;
struct rfapi_nexthop *pLnh = NULL;
- for (ALL_LIST_ELEMENTS_RO(bi->extra->vnc.export.local_nexthops,
+ for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc.export.local_nexthops,
node, pLnh)) {
if (prefix_same(&pLnh->addr, &lnh->addr)) {
@@ -438,7 +439,7 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
}
if (pLnh) {
- listnode_delete(bi->extra->vnc.export.local_nexthops,
+ listnode_delete(bpi->extra->vnc.export.local_nexthops,
pLnh);
/* silly rabbit, listnode_delete doesn't invoke
@@ -458,7 +459,7 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
*/
rfapiProcessWithdraw(peer, rfd, p, prd, NULL, afi, safi, type, kill);
- if (bi) {
+ if (bpi) {
prefix2str(p, buf, sizeof(buf));
vnc_zlog_debug_verbose(
"%s: Found route (safi=%d) to delete at prefix %s",
@@ -474,7 +475,7 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, bi);
+ bgp, prd, table, p, bpi);
}
bgp_unlock_node(prn);
}
@@ -482,13 +483,11 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
/*
* Delete local_nexthops list
*/
- if (bi->extra && bi->extra->vnc.export.local_nexthops) {
- list_delete(
- &bi->extra->vnc.export.local_nexthops);
- }
+ if (bpi->extra && bpi->extra->vnc.export.local_nexthops)
+ list_delete(&bpi->extra->vnc.export.local_nexthops);
- bgp_aggregate_decrement(bgp, p, bi, afi, safi);
- bgp_info_delete(bn, bi);
+ bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
+ bgp_path_info_delete(bn, bpi);
bgp_process(bgp, bn, afi, safi);
} else {
vnc_zlog_debug_verbose(
@@ -575,8 +574,8 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
int flags)
{
afi_t afi; /* of the VN address */
- struct bgp_info *new;
- struct bgp_info *bi;
+ struct bgp_path_info *new;
+ struct bgp_path_info *bpi;
struct bgp_node *bn;
struct attr attr = {0};
@@ -946,29 +945,29 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
* ecommunity: POINTS TO interned/refcounted dynamic 2-part AS attr
* aspath: POINTS TO interned/refcounted hashed block
*/
- for (bi = bn->info; bi; bi = bi->next) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
/* probably only need to check
- * bi->extra->vnc.export.rfapi_handle */
- if (bi->peer == rfd->peer && bi->type == type
- && bi->sub_type == sub_type && bi->extra
- && bi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+ * bpi->extra->vnc.export.rfapi_handle */
+ if (bpi->peer == rfd->peer && bpi->type == type
+ && bpi->sub_type == sub_type && bpi->extra
+ && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
break;
}
}
- if (bi) {
+ if (bpi) {
/*
* Adding new local_nexthop, which does not by itself change
* what is advertised via BGP
*/
if (lnh) {
- if (!bi->extra->vnc.export.local_nexthops) {
+ if (!bpi->extra->vnc.export.local_nexthops) {
/* TBD make arrangements to free when needed */
- bi->extra->vnc.export.local_nexthops =
+ bpi->extra->vnc.export.local_nexthops =
list_new();
- bi->extra->vnc.export.local_nexthops->del =
+ bpi->extra->vnc.export.local_nexthops->del =
rfapi_nexthop_free;
}
@@ -979,8 +978,8 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
struct rfapi_nexthop *pLnh = NULL;
for (ALL_LIST_ELEMENTS_RO(
- bi->extra->vnc.export.local_nexthops, node,
- pLnh)) {
+ bpi->extra->vnc.export.local_nexthops,
+ node, pLnh)) {
if (prefix_same(&pLnh->addr, &lnh->addr)) {
break;
@@ -993,13 +992,13 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
if (!pLnh) {
pLnh = rfapi_nexthop_new(lnh);
listnode_add(
- bi->extra->vnc.export.local_nexthops,
+ bpi->extra->vnc.export.local_nexthops,
pLnh);
}
}
- if (attrhash_cmp(bi->attr, new_attr)
- && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ if (attrhash_cmp(bpi->attr, new_attr)
+ && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
bgp_attr_unintern(&new_attr);
bgp_unlock_node(bn);
@@ -1010,7 +1009,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
goto done;
} else {
/* The attribute is changed. */
- bgp_info_set_flag(bn, bi, BGP_INFO_ATTR_CHANGED);
+ bgp_path_info_set_flag(bn, bpi, BGP_PATH_ATTR_CHANGED);
if (safi == SAFI_MPLS_VPN) {
struct bgp_node *prn = NULL;
@@ -1022,19 +1021,19 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, bi);
+ bgp, prd, table, p, bpi);
}
bgp_unlock_node(prn);
}
/* Rewrite BGP route information. */
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
- bgp_info_restore(bn, bi);
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
+ bgp_path_info_restore(bn, bpi);
else
- bgp_aggregate_decrement(bgp, p, bi, afi, safi);
- bgp_attr_unintern(&bi->attr);
- bi->attr = new_attr;
- bi->uptime = bgp_clock();
+ bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
+ bgp_attr_unintern(&bpi->attr);
+ bpi->attr = new_attr;
+ bpi->uptime = bgp_clock();
if (safi == SAFI_MPLS_VPN) {
@@ -1047,13 +1046,13 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
table = (struct bgp_table *)(prn->info);
vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
- bgp, prd, table, p, bi);
+ bgp, prd, table, p, bpi);
}
bgp_unlock_node(prn);
}
/* Process change. */
- bgp_aggregate_increment(bgp, p, bi, afi, safi);
+ bgp_aggregate_increment(bgp, p, bpi, afi, safi);
bgp_process(bgp, bn, afi, safi);
bgp_unlock_node(bn);
@@ -1066,16 +1065,16 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
}
- new = bgp_info_new();
+ new = bgp_path_info_new();
new->type = type;
new->sub_type = sub_type;
new->peer = rfd->peer;
- SET_FLAG(new->flags, BGP_INFO_VALID);
+ SET_FLAG(new->flags, BGP_PATH_VALID);
new->attr = new_attr;
new->uptime = bgp_clock();
/* save backref to rfapi handle */
- assert(bgp_info_extra_get(new));
+ assert(bgp_path_info_extra_get(new));
new->extra->vnc.export.rfapi_handle = (void *)rfd;
encode_label(label_val, &new->extra->label[0]);
@@ -1087,7 +1086,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
}
bgp_aggregate_increment(bgp, p, new, afi, safi);
- bgp_info_add(bn, new);
+ bgp_path_info_add(bn, new);
if (safi == SAFI_MPLS_VPN) {
struct bgp_node *prn = NULL;
@@ -3690,7 +3689,7 @@ static void rfapi_print_exported(struct bgp *bgp)
{
struct bgp_node *rdn;
struct bgp_node *rn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
if (!bgp)
return;
@@ -3705,8 +3704,8 @@ static void rfapi_print_exported(struct bgp *bgp)
if (!rn->info)
continue;
fprintf(stderr, "%s: rn=%p\n", __func__, rn);
- for (bi = rn->info; bi; bi = bi->next) {
- rfapiPrintBi((void *)2, bi); /* 2 => stderr */
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
}
}
}
@@ -3720,8 +3719,8 @@ static void rfapi_print_exported(struct bgp *bgp)
if (!rn->info)
continue;
fprintf(stderr, "%s: rn=%p\n", __func__, rn);
- for (bi = rn->info; bi; bi = bi->next) {
- rfapiPrintBi((void *)2, bi); /* 2 => stderr */
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
}
}
}
diff --git a/bgpd/rfapi/rfapi_backend.h b/bgpd/rfapi/rfapi_backend.h
index bcd894b884..96e464d2ae 100644
--- a/bgpd/rfapi/rfapi_backend.h
+++ b/bgpd/rfapi/rfapi_backend.h
@@ -48,14 +48,16 @@ extern void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p,
extern void rfapiProcessPeerDown(struct peer *peer);
-extern void vnc_zebra_announce(struct prefix *p, struct bgp_info *new_select,
+extern void vnc_zebra_announce(struct prefix *p,
+ struct bgp_path_info *new_select,
struct bgp *bgp);
-extern void vnc_zebra_withdraw(struct prefix *p, struct bgp_info *old_select);
+extern void vnc_zebra_withdraw(struct prefix *p,
+ struct bgp_path_info *old_select);
extern void rfapi_vty_out_vncinfo(struct vty *vty, struct prefix *p,
- struct bgp_info *bi, safi_t safi);
+ struct bgp_path_info *bpi, safi_t safi);
extern void vnc_direct_bgp_vpn_enable(struct bgp *bgp, afi_t afi);
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 398de6b3a1..7b304c7fbc 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -79,7 +79,7 @@
struct rfapi_withdraw {
struct rfapi_import_table *import_table;
struct agg_node *node;
- struct bgp_info *info;
+ struct bgp_path_info *info;
safi_t safi; /* used only for bulk operations */
/*
* For import table node reference count checking (i.e., debugging).
@@ -150,22 +150,22 @@ void rfapiCheckRouteCount()
for (rn = agg_route_top(rt); rn;
rn = agg_route_next(rn)) {
- struct bgp_info *bi;
- struct bgp_info *next;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info *next;
- for (bi = rn->info; bi; bi = next) {
- next = bi->next;
+ for (bpi = rn->info; bpi; bpi = next) {
+ next = bpi->next;
- if (CHECK_FLAG(bi->flags,
- BGP_INFO_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags,
+ BGP_PATH_REMOVED)) {
++holddown_count;
} else {
- if (RFAPI_LOCAL_BI(bi)) {
+ if (RFAPI_LOCAL_BI(bpi)) {
++local_count;
} else {
if (RFAPI_DIRECT_IMPORT_BI(
- bi)) {
+ bpi)) {
++imported_count;
} else {
++remote_count;
@@ -216,14 +216,14 @@ void rfapiCheckRouteCount()
*/
void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, int lockoffset)
{
- unsigned int count_bi = 0;
+ unsigned int count_bpi = 0;
unsigned int count_monitor = 0;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct rfapi_monitor_encap *hme;
struct rfapi_monitor_vpn *hmv;
- for (bi = rn->info; bi; bi = bi->next)
- ++count_bi;
+ for (bpi = rn->info; bpi; bpi = bpi->next)
+ ++count_bpi;
if (rn->aggregate) {
@@ -265,10 +265,10 @@ void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, int lockoffset)
}
}
- if (count_bi + count_monitor + lockoffset != rn->lock) {
+ if (count_bpi + count_monitor + lockoffset != rn->lock) {
vnc_zlog_debug_verbose(
- "%s: count_bi=%d, count_monitor=%d, lockoffset=%d, rn->lock=%d",
- __func__, count_bi, count_monitor, lockoffset,
+ "%s: count_bpi=%d, count_monitor=%d, lockoffset=%d, rn->lock=%d",
+ __func__, count_bpi, count_monitor, lockoffset,
rn->lock);
assert(0);
}
@@ -457,28 +457,28 @@ int rfapiGetVncTunnelUnAddr(struct attr *attr, struct prefix *p)
/*
* Get UN address wherever it might be
*/
-int rfapiGetUnAddrOfVpnBi(struct bgp_info *bi, struct prefix *p)
+int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p)
{
/* If it's in this route's VNC attribute, we're done */
- if (!rfapiGetVncTunnelUnAddr(bi->attr, p))
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, p))
return 0;
/*
* Otherwise, see if it's cached from a corresponding ENCAP SAFI
* advertisement
*/
- if (bi->extra) {
- switch (bi->extra->vnc.import.un_family) {
+ if (bpi->extra) {
+ switch (bpi->extra->vnc.import.un_family) {
case AF_INET:
if (p) {
- p->family = bi->extra->vnc.import.un_family;
- p->u.prefix4 = bi->extra->vnc.import.un.addr4;
+ p->family = bpi->extra->vnc.import.un_family;
+ p->u.prefix4 = bpi->extra->vnc.import.un.addr4;
p->prefixlen = 32;
}
return 0;
case AF_INET6:
if (p) {
- p->family = bi->extra->vnc.import.un_family;
- p->u.prefix6 = bi->extra->vnc.import.un.addr6;
+ p->family = bpi->extra->vnc.import.un_family;
+ p->u.prefix6 = bpi->extra->vnc.import.un.addr6;
p->prefixlen = 128;
}
return 0;
@@ -487,7 +487,7 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_info *bi, struct prefix *p)
p->family = 0;
#if DEBUG_ENCAP_MONITOR
vnc_zlog_debug_verbose(
- "%s: bi->extra->vnc.import.un_family is 0, no UN addr",
+ "%s: bpi->extra->vnc.import.un_family is 0, no UN addr",
__func__);
#endif
break;
@@ -499,23 +499,24 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_info *bi, struct prefix *p)
/*
- * Make a new bgp_info from gathered parameters
+ * Make a new bgp_path_info from gathered parameters
*/
-static struct bgp_info *rfapiBgpInfoCreate(struct attr *attr, struct peer *peer,
- void *rfd, struct prefix_rd *prd,
- uint8_t type, uint8_t sub_type,
- uint32_t *label)
+static struct bgp_path_info *rfapiBgpInfoCreate(struct attr *attr,
+ struct peer *peer, void *rfd,
+ struct prefix_rd *prd,
+ uint8_t type, uint8_t sub_type,
+ uint32_t *label)
{
- struct bgp_info *new;
+ struct bgp_path_info *new;
- new = bgp_info_new();
+ new = bgp_path_info_new();
assert(new);
if (attr) {
if (!new->attr)
new->attr = bgp_attr_intern(attr);
}
- bgp_info_extra_get(new);
+ bgp_path_info_extra_get(new);
if (prd) {
new->extra->vnc.import.rd = *prd;
rfapi_time(&new->extra->vnc.import.create_time);
@@ -531,10 +532,10 @@ static struct bgp_info *rfapiBgpInfoCreate(struct attr *attr, struct peer *peer,
}
/*
- * Frees bgp_info as used in import tables (parts are not
+ * Frees bgp_path_info as used in import tables (parts are not
* allocated exactly the way they are in the main RIBs)
*/
-static void rfapiBgpInfoFree(struct bgp_info *goner)
+static void rfapiBgpInfoFree(struct bgp_path_info *goner)
{
if (!goner)
return;
@@ -634,7 +635,7 @@ struct rfapi_import_table *rfapiMacImportTableGet(struct bgp *bgp, uint32_t lni)
static struct rfapi_monitor_vpn *
rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
{
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct agg_node *par;
struct rfapi_monitor_vpn *m;
struct rfapi_monitor_vpn *mlast;
@@ -655,14 +656,14 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
#endif
/*
- * 1. If there is at least one bi (either regular route or
+ * 1. If there is at least one bpi (either regular route or
* route marked as withdrawn, with a pending timer) at
* original_node with a valid UN address, we're done. Return.
*/
- for (bi = original_vpn_node->info; bi; bi = bi->next) {
+ for (bpi = original_vpn_node->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- if (!rfapiGetUnAddrOfVpnBi(bi, &pfx)) {
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx)) {
#if DEBUG_MONITOR_MOVE_SHORTER
vnc_zlog_debug_verbose(
"%s: have valid UN at original node, no change",
@@ -680,13 +681,13 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
*/
for (par = agg_node_parent(original_vpn_node); par;
par = agg_node_parent(par)) {
- for (bi = par->info; bi; bi = bi->next) {
+ for (bpi = par->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- if (!rfapiGetUnAddrOfVpnBi(bi, &pfx)) {
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx)) {
break;
}
}
- if (bi)
+ if (bpi)
break;
}
@@ -801,7 +802,7 @@ static void rfapiMonitorMoveLonger(struct agg_node *new_vpn_node)
{
struct rfapi_monitor_vpn *monitor;
struct rfapi_monitor_vpn *mlast;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct agg_node *par;
RFAPI_CHECK_REFCOUNT(new_vpn_node, SAFI_MPLS_VPN, 0);
@@ -809,13 +810,13 @@ static void rfapiMonitorMoveLonger(struct agg_node *new_vpn_node)
/*
* Make sure we have at least one valid route at the new node
*/
- for (bi = new_vpn_node->info; bi; bi = bi->next) {
+ for (bpi = new_vpn_node->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- if (!rfapiGetUnAddrOfVpnBi(bi, &pfx))
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx))
break;
}
- if (!bi) {
+ if (!bpi) {
vnc_zlog_debug_verbose(
"%s: no valid routes at node %p, so not attempting moves",
__func__, new_vpn_node);
@@ -881,31 +882,31 @@ static void rfapiMonitorMoveLonger(struct agg_node *new_vpn_node)
}
-static void rfapiBgpInfoChainFree(struct bgp_info *bi)
+static void rfapiBgpInfoChainFree(struct bgp_path_info *bpi)
{
- struct bgp_info *next;
+ struct bgp_path_info *next;
- while (bi) {
+ while (bpi) {
/*
- * If there is a timer waiting to delete this bi, cancel
+ * If there is a timer waiting to delete this bpi, cancel
* the timer and delete immediately
*/
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)
- && bi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc.import.timer;
+ (struct thread *)bpi->extra->vnc.import.timer;
struct rfapi_withdraw *wcb = t->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t);
}
- next = bi->next;
- bi->next = NULL;
- rfapiBgpInfoFree(bi);
- bi = next;
+ next = bpi->next;
+ bpi->next = NULL;
+ rfapiBgpInfoFree(bpi);
+ bpi = next;
}
}
@@ -929,9 +930,9 @@ static void rfapiImportTableFlush(struct rfapi_import_table *it)
* Each route_node has:
* aggregate: points to rfapi_it_extra with monitor
* chain(s)
- * info: points to chain of bgp_info
+ * info: points to chain of bgp_path_info
*/
- /* free bgp_info and its children */
+ /* free bgp_path_info and its children */
rfapiBgpInfoChainFree(rn->info);
rn->info = NULL;
@@ -940,7 +941,7 @@ static void rfapiImportTableFlush(struct rfapi_import_table *it)
for (rn = agg_route_top(it->imported_encap[afi]); rn;
rn = agg_route_next(rn)) {
- /* free bgp_info and its children */
+ /* free bgp_path_info and its children */
rfapiBgpInfoChainFree(rn->info);
rn->info = NULL;
@@ -1100,27 +1101,28 @@ int rfapiEcommunityGetEthernetTag(struct ecommunity *ecom, uint16_t *tag_id)
return ENOENT;
}
-static int rfapiVpnBiNhEqualsPt(struct bgp_info *bi, struct rfapi_ip_addr *hpt)
+static int rfapiVpnBiNhEqualsPt(struct bgp_path_info *bpi,
+ struct rfapi_ip_addr *hpt)
{
uint8_t family;
- if (!hpt || !bi)
+ if (!hpt || !bpi)
return 0;
- family = BGP_MP_NEXTHOP_FAMILY(bi->attr->mp_nexthop_len);
+ family = BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len);
if (hpt->addr_family != family)
return 0;
switch (family) {
case AF_INET:
- if (bi->attr->mp_nexthop_global_in.s_addr
+ if (bpi->attr->mp_nexthop_global_in.s_addr
!= hpt->addr.v4.s_addr)
return 0;
break;
case AF_INET6:
- if (IPV6_ADDR_CMP(&bi->attr->mp_nexthop_global, &hpt->addr.v6))
+ if (IPV6_ADDR_CMP(&bpi->attr->mp_nexthop_global, &hpt->addr.v6))
return 0;
break;
@@ -1136,36 +1138,37 @@ static int rfapiVpnBiNhEqualsPt(struct bgp_info *bi, struct rfapi_ip_addr *hpt)
/*
* Compare 2 VPN BIs. Return true if they have the same VN and UN addresses
*/
-static int rfapiVpnBiSamePtUn(struct bgp_info *bi1, struct bgp_info *bi2)
+static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
+ struct bgp_path_info *bpi2)
{
struct prefix pfx_un1;
struct prefix pfx_un2;
- if (!bi1 || !bi2)
+ if (!bpi1 || !bpi2)
return 0;
- if (!bi1->attr || !bi2->attr)
+ if (!bpi1->attr || !bpi2->attr)
return 0;
/*
* VN address comparisons
*/
- if (BGP_MP_NEXTHOP_FAMILY(bi1->attr->mp_nexthop_len)
- != BGP_MP_NEXTHOP_FAMILY(bi2->attr->mp_nexthop_len)) {
+ if (BGP_MP_NEXTHOP_FAMILY(bpi1->attr->mp_nexthop_len)
+ != BGP_MP_NEXTHOP_FAMILY(bpi2->attr->mp_nexthop_len)) {
return 0;
}
- switch (BGP_MP_NEXTHOP_FAMILY(bi1->attr->mp_nexthop_len)) {
+ switch (BGP_MP_NEXTHOP_FAMILY(bpi1->attr->mp_nexthop_len)) {
case AF_INET:
- if (bi1->attr->mp_nexthop_global_in.s_addr
- != bi2->attr->mp_nexthop_global_in.s_addr)
+ if (bpi1->attr->mp_nexthop_global_in.s_addr
+ != bpi2->attr->mp_nexthop_global_in.s_addr)
return 0;
break;
case AF_INET6:
- if (IPV6_ADDR_CMP(&bi1->attr->mp_nexthop_global,
- &bi2->attr->mp_nexthop_global))
+ if (IPV6_ADDR_CMP(&bpi1->attr->mp_nexthop_global,
+ &bpi2->attr->mp_nexthop_global))
return 0;
break;
@@ -1177,17 +1180,17 @@ static int rfapiVpnBiSamePtUn(struct bgp_info *bi1, struct bgp_info *bi2)
/*
* UN address comparisons
*/
- if (rfapiGetVncTunnelUnAddr(bi1->attr, &pfx_un1)) {
- if (bi1->extra) {
- pfx_un1.family = bi1->extra->vnc.import.un_family;
- switch (bi1->extra->vnc.import.un_family) {
+ if (rfapiGetVncTunnelUnAddr(bpi1->attr, &pfx_un1)) {
+ if (bpi1->extra) {
+ pfx_un1.family = bpi1->extra->vnc.import.un_family;
+ switch (bpi1->extra->vnc.import.un_family) {
case AF_INET:
pfx_un1.u.prefix4 =
- bi1->extra->vnc.import.un.addr4;
+ bpi1->extra->vnc.import.un.addr4;
break;
case AF_INET6:
pfx_un1.u.prefix6 =
- bi1->extra->vnc.import.un.addr6;
+ bpi1->extra->vnc.import.un.addr6;
break;
default:
pfx_un1.family = 0;
@@ -1196,17 +1199,17 @@ static int rfapiVpnBiSamePtUn(struct bgp_info *bi1, struct bgp_info *bi2)
}
}
- if (rfapiGetVncTunnelUnAddr(bi2->attr, &pfx_un2)) {
- if (bi2->extra) {
- pfx_un2.family = bi2->extra->vnc.import.un_family;
- switch (bi2->extra->vnc.import.un_family) {
+ if (rfapiGetVncTunnelUnAddr(bpi2->attr, &pfx_un2)) {
+ if (bpi2->extra) {
+ pfx_un2.family = bpi2->extra->vnc.import.un_family;
+ switch (bpi2->extra->vnc.import.un_family) {
case AF_INET:
pfx_un2.u.prefix4 =
- bi2->extra->vnc.import.un.addr4;
+ bpi2->extra->vnc.import.un.addr4;
break;
case AF_INET6:
pfx_un2.u.prefix6 =
- bi2->extra->vnc.import.un.addr6;
+ bpi2->extra->vnc.import.un.addr6;
break;
default:
pfx_un2.family = 0;
@@ -1295,15 +1298,15 @@ int rfapi_extract_l2o(
static struct rfapi_next_hop_entry *
rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
- struct bgp_info *bi, /* route to encode */
- uint32_t lifetime, /* use this in nhe */
- struct agg_node *rn) /* req for L2 eth addr */
+ struct bgp_path_info *bpi, /* route to encode */
+ uint32_t lifetime, /* use this in nhe */
+ struct agg_node *rn) /* req for L2 eth addr */
{
struct rfapi_next_hop_entry *new;
int have_vnc_tunnel_un = 0;
#if DEBUG_ENCAP_MONITOR
- vnc_zlog_debug_verbose("%s: entry, bi %p, rn %p", __func__, bi, rn);
+ vnc_zlog_debug_verbose("%s: entry, bpi %p, rn %p", __func__, bpi, rn);
#endif
new = XCALLOC(MTYPE_RFAPI_NEXTHOP, sizeof(struct rfapi_next_hop_entry));
@@ -1311,8 +1314,8 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
new->prefix = *rprefix;
- if (bi->extra
- && decode_rd_type(bi->extra->vnc.import.rd.val)
+ if (bpi->extra
+ && decode_rd_type(bpi->extra->vnc.import.rd.val)
== RD_TYPE_VNC_ETH) {
/* ethernet */
@@ -1327,19 +1330,19 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
memcpy(&vo->v.l2addr.macaddr, &rn->p.u.prefix_eth.octet,
ETH_ALEN);
/* only low 3 bytes of this are significant */
- if (bi->attr) {
+ if (bpi->attr) {
(void)rfapiEcommunityGetLNI(
- bi->attr->ecommunity,
+ bpi->attr->ecommunity,
&vo->v.l2addr.logical_net_id);
(void)rfapiEcommunityGetEthernetTag(
- bi->attr->ecommunity, &vo->v.l2addr.tag_id);
+ bpi->attr->ecommunity, &vo->v.l2addr.tag_id);
}
/* local_nve_id comes from lower byte of RD type */
- vo->v.l2addr.local_nve_id = bi->extra->vnc.import.rd.val[1];
+ vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
/* label comes from MP_REACH_NLRI label */
- vo->v.l2addr.label = decode_label(&bi->extra->label[0]);
+ vo->v.l2addr.label = decode_label(&bpi->extra->label[0]);
new->vn_options = vo;
@@ -1347,38 +1350,38 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
* If there is an auxiliary prefix (i.e., host IP address),
* use it as the nexthop prefix instead of the query prefix
*/
- if (bi->extra->vnc.import.aux_prefix.family) {
- rfapiQprefix2Rprefix(&bi->extra->vnc.import.aux_prefix,
+ if (bpi->extra->vnc.import.aux_prefix.family) {
+ rfapiQprefix2Rprefix(&bpi->extra->vnc.import.aux_prefix,
&new->prefix);
}
}
- if (bi->attr) {
+ if (bpi->attr) {
bgp_encap_types tun_type;
- new->prefix.cost = rfapiRfpCost(bi->attr);
+ new->prefix.cost = rfapiRfpCost(bpi->attr);
struct bgp_attr_encap_subtlv *pEncap;
- switch (BGP_MP_NEXTHOP_FAMILY(bi->attr->mp_nexthop_len)) {
+ switch (BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len)) {
case AF_INET:
new->vn_address.addr_family = AF_INET;
new->vn_address.addr.v4 =
- bi->attr->mp_nexthop_global_in;
+ bpi->attr->mp_nexthop_global_in;
break;
case AF_INET6:
new->vn_address.addr_family = AF_INET6;
- new->vn_address.addr.v6 = bi->attr->mp_nexthop_global;
+ new->vn_address.addr.v6 = bpi->attr->mp_nexthop_global;
break;
default:
zlog_warn("%s: invalid vpn nexthop length: %d",
- __func__, bi->attr->mp_nexthop_len);
+ __func__, bpi->attr->mp_nexthop_len);
rfapi_free_next_hop_list(new);
return NULL;
}
- for (pEncap = bi->attr->vnc_subtlvs; pEncap;
+ for (pEncap = bpi->attr->vnc_subtlvs; pEncap;
pEncap = pEncap->next) {
switch (pEncap->type) {
case BGP_VNC_SUBTLV_TYPE_LIFETIME:
@@ -1394,18 +1397,18 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
}
}
- rfapiGetTunnelType(bi->attr, &tun_type);
+ rfapiGetTunnelType(bpi->attr, &tun_type);
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
struct prefix p;
/* MPLS carries UN address in next hop */
- rfapiNexthop2Prefix(bi->attr, &p);
+ rfapiNexthop2Prefix(bpi->attr, &p);
if (p.family != 0) {
rfapiQprefix2Raddr(&p, &new->un_address);
have_vnc_tunnel_un = 1;
}
}
- for (pEncap = bi->attr->encap_subtlvs; pEncap;
+ for (pEncap = bpi->attr->encap_subtlvs; pEncap;
pEncap = pEncap->next) {
switch (pEncap->type) {
case BGP_ENCAP_SUBTLV_TYPE_REMOTE_ENDPOINT:
@@ -1430,8 +1433,8 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
default:
zlog_warn(
- "%s: invalid tunnel subtlv UN addr length (%d) for bi %p",
- __func__, pEncap->length, bi);
+ "%s: invalid tunnel subtlv UN addr length (%d) for bpi %p",
+ __func__, pEncap->length, bpi);
}
break;
@@ -1445,33 +1448,33 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
}
}
- new->un_options = rfapi_encap_tlv_to_un_option(bi->attr);
+ new->un_options = rfapi_encap_tlv_to_un_option(bpi->attr);
#if DEBUG_ENCAP_MONITOR
vnc_zlog_debug_verbose("%s: line %d: have_vnc_tunnel_un=%d",
__func__, __LINE__, have_vnc_tunnel_un);
#endif
- if (!have_vnc_tunnel_un && bi->extra) {
+ if (!have_vnc_tunnel_un && bpi->extra) {
/*
* use cached UN address from ENCAP route
*/
new->un_address.addr_family =
- bi->extra->vnc.import.un_family;
+ bpi->extra->vnc.import.un_family;
switch (new->un_address.addr_family) {
case AF_INET:
new->un_address.addr.v4 =
- bi->extra->vnc.import.un.addr4;
+ bpi->extra->vnc.import.un.addr4;
break;
case AF_INET6:
new->un_address.addr.v6 =
- bi->extra->vnc.import.un.addr6;
+ bpi->extra->vnc.import.un.addr6;
break;
default:
zlog_warn(
- "%s: invalid UN addr family (%d) for bi %p",
+ "%s: invalid UN addr family (%d) for bpi %p",
__func__, new->un_address.addr_family,
- bi);
+ bpi);
rfapi_free_next_hop_list(new);
return NULL;
break;
@@ -1485,13 +1488,13 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
int rfapiHasNonRemovedRoutes(struct agg_node *rn)
{
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- if (!CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)
- && (bi->extra && !rfapiGetUnAddrOfVpnBi(bi, &pfx))) {
+ if (!CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && (bpi->extra && !rfapiGetUnAddrOfVpnBi(bpi, &pfx))) {
return 1;
}
@@ -1505,16 +1508,16 @@ int rfapiHasNonRemovedRoutes(struct agg_node *rn)
*/
void rfapiDumpNode(struct agg_node *rn)
{
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
vnc_zlog_debug_verbose("%s: rn=%p", __func__, rn);
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
struct prefix pfx;
- int ctrc = rfapiGetUnAddrOfVpnBi(bi, &pfx);
+ int ctrc = rfapiGetUnAddrOfVpnBi(bpi, &pfx);
int nr;
- if (!CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)
- && (bi->extra && !ctrc)) {
+ if (!CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && (bpi->extra && !ctrc)) {
nr = 1;
} else {
@@ -1522,8 +1525,8 @@ void rfapiDumpNode(struct agg_node *rn)
}
vnc_zlog_debug_verbose(
- " bi=%p, nr=%d, flags=0x%x, extra=%p, ctrc=%d", bi, nr,
- bi->flags, bi->extra, ctrc);
+ " bpi=%p, nr=%d, flags=0x%x, extra=%p, ctrc=%d", bpi,
+ nr, bpi->flags, bpi->extra, ctrc);
}
}
#endif
@@ -1539,7 +1542,7 @@ static int rfapiNhlAddNodeRoutes(
struct agg_node *rfd_rib_node, /* preload this NVE rib node */
struct prefix *pfx_target_original) /* query target */
{
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct rfapi_next_hop_entry *new;
struct prefix pfx_un;
struct skiplist *seen_nexthops;
@@ -1562,12 +1565,12 @@ static int rfapiNhlAddNodeRoutes(
seen_nexthops =
skiplist_new(0, vnc_prefix_cmp, (void (*)(void *))prefix_free);
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
struct prefix pfx_vn;
struct prefix *newpfx;
- if (removed && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ if (removed && !CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
#if DEBUG_RETURNED_NHL
vnc_zlog_debug_verbose(
"%s: want holddown, this route not holddown, skip",
@@ -1575,18 +1578,18 @@ static int rfapiNhlAddNodeRoutes(
#endif
continue;
}
- if (!removed && CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ if (!removed && CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
continue;
}
- if (!bi->extra) {
+ if (!bpi->extra) {
continue;
}
/*
* Check for excluded VN address
*/
- if (rfapiVpnBiNhEqualsPt(bi, exclude_vnaddr))
+ if (rfapiVpnBiNhEqualsPt(bpi, exclude_vnaddr))
continue;
/*
@@ -1595,9 +1598,9 @@ static int rfapiNhlAddNodeRoutes(
if (is_l2) {
/* L2 routes: semantic nexthop in aux_prefix; VN addr
* ain't it */
- pfx_vn = bi->extra->vnc.import.aux_prefix;
+ pfx_vn = bpi->extra->vnc.import.aux_prefix;
} else {
- rfapiNexthop2Prefix(bi->attr, &pfx_vn);
+ rfapiNexthop2Prefix(bpi->attr, &pfx_vn);
}
if (!skiplist_search(seen_nexthops, &pfx_vn, NULL)) {
#if DEBUG_RETURNED_NHL
@@ -1611,10 +1614,10 @@ static int rfapiNhlAddNodeRoutes(
continue;
}
- if (rfapiGetUnAddrOfVpnBi(bi, &pfx_un)) {
+ if (rfapiGetUnAddrOfVpnBi(bpi, &pfx_un)) {
#if DEBUG_ENCAP_MONITOR
vnc_zlog_debug_verbose(
- "%s: failed to get UN address of this VPN bi",
+ "%s: failed to get UN address of this VPN bpi",
__func__);
#endif
continue;
@@ -1624,10 +1627,10 @@ static int rfapiNhlAddNodeRoutes(
*newpfx = pfx_vn;
skiplist_insert(seen_nexthops, newpfx, newpfx);
- new = rfapiRouteInfo2NextHopEntry(rprefix, bi, lifetime, rn);
+ new = rfapiRouteInfo2NextHopEntry(rprefix, bpi, lifetime, rn);
if (new) {
if (rfapiRibPreloadBi(rfd_rib_node, &pfx_vn, &pfx_un,
- lifetime, bi)) {
+ lifetime, bpi)) {
/* duplicate filtered by RIB */
rfapi_free_next_hop_list(new);
new = NULL;
@@ -1748,8 +1751,8 @@ static int rfapiNhlAddSubtree(
* Construct an rfapi nexthop list based on the routes attached to
* the specified node.
*
- * If there are any routes that do NOT have BGP_INFO_REMOVED set,
- * return those only. If there are ONLY routes with BGP_INFO_REMOVED,
+ * If there are any routes that do NOT have BGP_PATH_REMOVED set,
+ * return those only. If there are ONLY routes with BGP_PATH_REMOVED,
* then return those, and also include all the non-removed routes from the
* next less-specific node (i.e., this node's parent) at the end.
*/
@@ -1991,16 +1994,16 @@ struct rfapi_next_hop_entry *rfapiEthRouteTable2NextHopList(
}
/*
- * Insert a new bi to the imported route table node,
- * keeping the list of BIs sorted best route first
+ * Insert a new bpi to the imported route table node,
+ * keeping the list of BPIs sorted best route first
*/
static void rfapiBgpInfoAttachSorted(struct agg_node *rn,
- struct bgp_info *info_new, afi_t afi,
+ struct bgp_path_info *info_new, afi_t afi,
safi_t safi)
{
struct bgp *bgp;
- struct bgp_info *prev;
- struct bgp_info *next;
+ struct bgp_path_info *prev;
+ struct bgp_path_info *next;
char pfx_buf[PREFIX2STR_BUFFER];
@@ -2015,10 +2018,11 @@ static void rfapiBgpInfoAttachSorted(struct agg_node *rn,
for (prev = NULL, next = rn->info; next;
prev = next, next = next->next) {
- if (!bgp || (!CHECK_FLAG(info_new->flags, BGP_INFO_REMOVED)
- && CHECK_FLAG(next->flags, BGP_INFO_REMOVED))
- || bgp_info_cmp_compatible(bgp, info_new, next, pfx_buf,
- afi, safi)
+ if (!bgp
+ || (!CHECK_FLAG(info_new->flags, BGP_PATH_REMOVED)
+ && CHECK_FLAG(next->flags, BGP_PATH_REMOVED))
+ || bgp_path_info_cmp_compatible(bgp, info_new, next,
+ pfx_buf, afi, safi)
== -1) { /* -1 if 1st is better */
break;
}
@@ -2036,18 +2040,18 @@ static void rfapiBgpInfoAttachSorted(struct agg_node *rn,
bgp_attr_intern(info_new->attr);
}
-static void rfapiBgpInfoDetach(struct agg_node *rn, struct bgp_info *bi)
+static void rfapiBgpInfoDetach(struct agg_node *rn, struct bgp_path_info *bpi)
{
/*
* Remove the route (doubly-linked)
*/
- // bgp_attr_unintern (&bi->attr);
- if (bi->next)
- bi->next->prev = bi->prev;
- if (bi->prev)
- bi->prev->next = bi->next;
+ // bgp_attr_unintern (&bpi->attr);
+ if (bpi->next)
+ bpi->next->prev = bpi->prev;
+ if (bpi->prev)
+ bpi->prev->next = bpi->next;
else
- rn->info = bi->next;
+ rn->info = bpi->next;
}
/*
@@ -2055,48 +2059,48 @@ static void rfapiBgpInfoDetach(struct agg_node *rn, struct bgp_info *bi)
*/
static int rfapi_bi_peer_rd_cmp(void *b1, void *b2)
{
- struct bgp_info *bi1 = b1;
- struct bgp_info *bi2 = b2;
+ struct bgp_path_info *bpi1 = b1;
+ struct bgp_path_info *bpi2 = b2;
/*
* Compare peers
*/
- if (bi1->peer < bi2->peer)
+ if (bpi1->peer < bpi2->peer)
return -1;
- if (bi1->peer > bi2->peer)
+ if (bpi1->peer > bpi2->peer)
return 1;
/*
* compare RDs
*/
- return vnc_prefix_cmp((struct prefix *)&bi1->extra->vnc.import.rd,
- (struct prefix *)&bi2->extra->vnc.import.rd);
+ return vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc.import.rd,
+ (struct prefix *)&bpi2->extra->vnc.import.rd);
}
/*
* For L2-indexed import tables
- * The BIs in these tables should ALWAYS have an aux_prefix set because
+ * The BPIs in these tables should ALWAYS have an aux_prefix set because
* they arrive via IPv4 or IPv6 advertisements.
*/
static int rfapi_bi_peer_rd_aux_cmp(void *b1, void *b2)
{
- struct bgp_info *bi1 = b1;
- struct bgp_info *bi2 = b2;
+ struct bgp_path_info *bpi1 = b1;
+ struct bgp_path_info *bpi2 = b2;
int rc;
/*
* Compare peers
*/
- if (bi1->peer < bi2->peer)
+ if (bpi1->peer < bpi2->peer)
return -1;
- if (bi1->peer > bi2->peer)
+ if (bpi1->peer > bpi2->peer)
return 1;
/*
* compare RDs
*/
- rc = vnc_prefix_cmp((struct prefix *)&bi1->extra->vnc.import.rd,
- (struct prefix *)&bi2->extra->vnc.import.rd);
+ rc = vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc.import.rd,
+ (struct prefix *)&bpi2->extra->vnc.import.rd);
if (rc) {
return rc;
}
@@ -2107,16 +2111,16 @@ static int rfapi_bi_peer_rd_aux_cmp(void *b1, void *b2)
*
* Use presence of aux_prefix with AF=ethernet and prefixlen=1
* as magic value to signify explicit wildcarding of the aux_prefix.
- * This magic value will not appear in bona fide bi entries in
- * the import table, but is allowed in the "fake" bi used to
+ * This magic value will not appear in bona fide bpi entries in
+ * the import table, but is allowed in the "fake" bpi used to
* probe the table when searching. (We have to test both b1 and b2
* because there is no guarantee of the order the test key and
* the real key will be passed)
*/
- if ((bi1->extra->vnc.import.aux_prefix.family == AF_ETHERNET
- && (bi1->extra->vnc.import.aux_prefix.prefixlen == 1))
- || (bi2->extra->vnc.import.aux_prefix.family == AF_ETHERNET
- && (bi2->extra->vnc.import.aux_prefix.prefixlen == 1))) {
+ if ((bpi1->extra->vnc.import.aux_prefix.family == AF_ETHERNET
+ && (bpi1->extra->vnc.import.aux_prefix.prefixlen == 1))
+ || (bpi2->extra->vnc.import.aux_prefix.family == AF_ETHERNET
+ && (bpi2->extra->vnc.import.aux_prefix.prefixlen == 1))) {
/*
* wildcard aux address specified
@@ -2124,8 +2128,8 @@ static int rfapi_bi_peer_rd_aux_cmp(void *b1, void *b2)
return 0;
}
- return vnc_prefix_cmp(&bi1->extra->vnc.import.aux_prefix,
- &bi2->extra->vnc.import.aux_prefix);
+ return vnc_prefix_cmp(&bpi1->extra->vnc.import.aux_prefix,
+ &bpi2->extra->vnc.import.aux_prefix);
}
@@ -2133,20 +2137,20 @@ static int rfapi_bi_peer_rd_aux_cmp(void *b1, void *b2)
* Index on RD and Peer
*/
static void rfapiItBiIndexAdd(struct agg_node *rn, /* Import table VPN node */
- struct bgp_info *bi) /* new BI */
+ struct bgp_path_info *bpi) /* new BPI */
{
struct skiplist *sl;
assert(rn);
- assert(bi);
- assert(bi->extra);
+ assert(bpi);
+ assert(bpi->extra);
{
char buf[RD_ADDRSTRLEN];
- vnc_zlog_debug_verbose("%s: bi %p, peer %p, rd %s", __func__,
- bi, bi->peer,
- prefix_rd2str(&bi->extra->vnc.import.rd,
+ vnc_zlog_debug_verbose("%s: bpi %p, peer %p, rd %s", __func__,
+ bpi, bpi->peer,
+ prefix_rd2str(&bpi->extra->vnc.import.rd,
buf, sizeof(buf)));
}
@@ -2160,18 +2164,18 @@ static void rfapiItBiIndexAdd(struct agg_node *rn, /* Import table VPN node */
RFAPI_IT_EXTRA_GET(rn)->u.vpn.idx_rd = sl;
agg_lock_node(rn); /* for skiplist */
}
- assert(!skiplist_insert(sl, (void *)bi, (void *)bi));
+ assert(!skiplist_insert(sl, (void *)bpi, (void *)bpi));
agg_lock_node(rn); /* for skiplist entry */
- /* NB: BIs in import tables are not refcounted */
+ /* NB: BPIs in import tables are not refcounted */
}
static void rfapiItBiIndexDump(struct agg_node *rn)
{
struct skiplist *sl;
void *cursor = NULL;
- struct bgp_info *k;
- struct bgp_info *v;
+ struct bgp_path_info *k;
+ struct bgp_path_info *v;
int rc;
sl = RFAPI_RDINDEX(rn);
@@ -2191,21 +2195,21 @@ static void rfapiItBiIndexDump(struct agg_node *rn)
} else
strncpy(buf_aux_pfx, "(none)", PREFIX_STRLEN);
- vnc_zlog_debug_verbose("bi %p, peer %p, rd %s, aux_prefix %s",
+ vnc_zlog_debug_verbose("bpi %p, peer %p, rd %s, aux_prefix %s",
k, k->peer, buf, buf_aux_pfx);
}
}
-static struct bgp_info *rfapiItBiIndexSearch(
+static struct bgp_path_info *rfapiItBiIndexSearch(
struct agg_node *rn, /* Import table VPN node */
struct prefix_rd *prd, struct peer *peer,
struct prefix *aux_prefix) /* optional L3 addr for L2 ITs */
{
struct skiplist *sl;
int rc;
- struct bgp_info bi_fake;
- struct bgp_info_extra bi_extra;
- struct bgp_info *bi_result;
+ struct bgp_path_info bpi_fake;
+ struct bgp_path_info_extra bpi_extra;
+ struct bgp_path_info *bpi_result;
sl = RFAPI_RDINDEX(rn);
if (!sl)
@@ -2236,22 +2240,22 @@ static struct bgp_info *rfapiItBiIndexSearch(
vnc_zlog_debug_verbose("%s: short list algorithm", __func__);
#endif
/* if short list, linear search might be faster */
- for (bi_result = rn->info; bi_result;
- bi_result = bi_result->next) {
+ for (bpi_result = rn->info; bpi_result;
+ bpi_result = bpi_result->next) {
#if DEBUG_BI_SEARCH
{
char buf[RD_ADDRSTRLEN];
vnc_zlog_debug_verbose(
- "%s: bi has prd=%s, peer=%p", __func__,
- prefix_rd2str(&bi_result->extra->vnc
+ "%s: bpi has prd=%s, peer=%p", __func__,
+ prefix_rd2str(&bpi_result->extra->vnc
.import.rd,
buf, sizeof(buf)),
- bi_result->peer);
+ bpi_result->peer);
}
#endif
- if (peer == bi_result->peer
- && !prefix_cmp((struct prefix *)&bi_result->extra
+ if (peer == bpi_result->peer
+ && !prefix_cmp((struct prefix *)&bpi_result->extra
->vnc.import.rd,
(struct prefix *)prd)) {
@@ -2261,9 +2265,10 @@ static struct bgp_info *rfapiItBiIndexSearch(
__func__);
#endif
if (!aux_prefix
- || !prefix_cmp(aux_prefix,
- &bi_result->extra->vnc.import
- .aux_prefix)) {
+ || !prefix_cmp(
+ aux_prefix,
+ &bpi_result->extra->vnc.import
+ .aux_prefix)) {
#if DEBUG_BI_SEARCH
vnc_zlog_debug_verbose("%s: match",
@@ -2273,21 +2278,21 @@ static struct bgp_info *rfapiItBiIndexSearch(
}
}
}
- return bi_result;
+ return bpi_result;
}
- bi_fake.peer = peer;
- bi_fake.extra = &bi_extra;
- bi_fake.extra->vnc.import.rd = *(struct prefix_rd *)prd;
+ bpi_fake.peer = peer;
+ bpi_fake.extra = &bpi_extra;
+ bpi_fake.extra->vnc.import.rd = *(struct prefix_rd *)prd;
if (aux_prefix) {
- bi_fake.extra->vnc.import.aux_prefix = *aux_prefix;
+ bpi_fake.extra->vnc.import.aux_prefix = *aux_prefix;
} else {
/* wildcard */
- bi_fake.extra->vnc.import.aux_prefix.family = AF_ETHERNET;
- bi_fake.extra->vnc.import.aux_prefix.prefixlen = 1;
+ bpi_fake.extra->vnc.import.aux_prefix.family = AF_ETHERNET;
+ bpi_fake.extra->vnc.import.aux_prefix.prefixlen = 1;
}
- rc = skiplist_search(sl, (void *)&bi_fake, (void *)&bi_result);
+ rc = skiplist_search(sl, (void *)&bpi_fake, (void *)&bpi_result);
if (rc) {
#if DEBUG_BI_SEARCH
@@ -2297,14 +2302,14 @@ static struct bgp_info *rfapiItBiIndexSearch(
}
#if DEBUG_BI_SEARCH
- vnc_zlog_debug_verbose("%s: matched bi=%p", __func__, bi_result);
+ vnc_zlog_debug_verbose("%s: matched bpi=%p", __func__, bpi_result);
#endif
- return bi_result;
+ return bpi_result;
}
static void rfapiItBiIndexDel(struct agg_node *rn, /* Import table VPN node */
- struct bgp_info *bi) /* old BI */
+ struct bgp_path_info *bpi) /* old BPI */
{
struct skiplist *sl;
int rc;
@@ -2312,16 +2317,16 @@ static void rfapiItBiIndexDel(struct agg_node *rn, /* Import table VPN node */
{
char buf[RD_ADDRSTRLEN];
- vnc_zlog_debug_verbose("%s: bi %p, peer %p, rd %s", __func__,
- bi, bi->peer,
- prefix_rd2str(&bi->extra->vnc.import.rd,
+ vnc_zlog_debug_verbose("%s: bpi %p, peer %p, rd %s", __func__,
+ bpi, bpi->peer,
+ prefix_rd2str(&bpi->extra->vnc.import.rd,
buf, sizeof(buf)));
}
sl = RFAPI_RDINDEX(rn);
assert(sl);
- rc = skiplist_delete(sl, (void *)(bi), (void *)bi);
+ rc = skiplist_delete(sl, (void *)(bpi), (void *)bpi);
if (rc) {
rfapiItBiIndexDump(rn);
}
@@ -2329,17 +2334,18 @@ static void rfapiItBiIndexDel(struct agg_node *rn, /* Import table VPN node */
agg_unlock_node(rn); /* for skiplist entry */
- /* NB: BIs in import tables are not refcounted */
+ /* NB: BPIs in import tables are not refcounted */
}
/*
* Add a backreference at the ENCAP node to the VPN route that
* refers to it
*/
-static void rfapiMonitorEncapAdd(struct rfapi_import_table *import_table,
- struct prefix *p, /* VN address */
- struct agg_node *vpn_rn, /* VPN node */
- struct bgp_info *vpn_bi) /* VPN bi/route */
+static void
+rfapiMonitorEncapAdd(struct rfapi_import_table *import_table,
+ struct prefix *p, /* VN address */
+ struct agg_node *vpn_rn, /* VPN node */
+ struct bgp_path_info *vpn_bpi) /* VPN bpi/route */
{
afi_t afi = family2afi(p->family);
struct agg_node *rn;
@@ -2354,7 +2360,7 @@ static void rfapiMonitorEncapAdd(struct rfapi_import_table *import_table,
assert(m);
m->node = vpn_rn;
- m->bi = vpn_bi;
+ m->bpi = vpn_bpi;
m->rn = rn;
/* insert to encap node's list */
@@ -2364,24 +2370,25 @@ static void rfapiMonitorEncapAdd(struct rfapi_import_table *import_table,
RFAPI_MONITOR_ENCAP_W_ALLOC(rn) = m;
/* for easy lookup when deleting vpn route */
- vpn_bi->extra->vnc.import.hme = m;
+ vpn_bpi->extra->vnc.import.hme = m;
vnc_zlog_debug_verbose(
- "%s: it=%p, vpn_bi=%p, afi=%d, encap rn=%p, setting vpn_bi->extra->vnc.import.hme=%p",
- __func__, import_table, vpn_bi, afi, rn, m);
+ "%s: it=%p, vpn_bpi=%p, afi=%d, encap rn=%p, setting vpn_bpi->extra->vnc.import.hme=%p",
+ __func__, import_table, vpn_bpi, afi, rn, m);
RFAPI_CHECK_REFCOUNT(rn, SAFI_ENCAP, 0);
- bgp_attr_intern(vpn_bi->attr);
+ bgp_attr_intern(vpn_bpi->attr);
}
-static void rfapiMonitorEncapDelete(struct bgp_info *vpn_bi)
+static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
{
/*
* Remove encap monitor
*/
- vnc_zlog_debug_verbose("%s: vpn_bi=%p", __func__, vpn_bi);
- if (vpn_bi->extra) {
- struct rfapi_monitor_encap *hme = vpn_bi->extra->vnc.import.hme;
+ vnc_zlog_debug_verbose("%s: vpn_bpi=%p", __func__, vpn_bpi);
+ if (vpn_bpi->extra) {
+ struct rfapi_monitor_encap *hme =
+ vpn_bpi->extra->vnc.import.hme;
if (hme) {
@@ -2405,7 +2412,7 @@ static void rfapiMonitorEncapDelete(struct bgp_info *vpn_bi)
agg_unlock_node(hme->rn); /* decr ref count */
XFREE(MTYPE_RFAPI_MONITOR_ENCAP, hme);
- vpn_bi->extra->vnc.import.hme = NULL;
+ vpn_bpi->extra->vnc.import.hme = NULL;
}
}
}
@@ -2417,16 +2424,16 @@ static void rfapiMonitorEncapDelete(struct bgp_info *vpn_bi)
static int rfapiWithdrawTimerVPN(struct thread *t)
{
struct rfapi_withdraw *wcb = t->arg;
- struct bgp_info *bi = wcb->info;
+ struct bgp_path_info *bpi = wcb->info;
struct bgp *bgp = bgp_get_default();
struct rfapi_monitor_vpn *moved;
afi_t afi;
assert(wcb->node);
- assert(bi);
+ assert(bpi);
assert(wcb->import_table);
- assert(bi->extra);
+ assert(bpi->extra);
RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_MPLS_VPN, wcb->lockoffset);
@@ -2434,7 +2441,7 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
char buf[BUFSIZ];
vnc_zlog_debug_verbose(
- "%s: removing bi %p at prefix %s/%d", __func__, bi,
+ "%s: removing bpi %p at prefix %s/%d", __func__, bpi,
rfapi_ntop(wcb->node->p.family, &wcb->node->p.u.prefix,
buf, BUFSIZ),
wcb->node->p.prefixlen);
@@ -2443,17 +2450,17 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
/*
* Remove the route (doubly-linked)
*/
- if (CHECK_FLAG(bi->flags, BGP_INFO_VALID)
- && VALID_INTERIOR_TYPE(bi->type))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_VALID)
+ && VALID_INTERIOR_TYPE(bpi->type))
RFAPI_MONITOR_EXTERIOR(wcb->node)->valid_interior_count--;
afi = family2afi(wcb->node->p.family);
wcb->import_table->holddown_count[afi] -= 1; /* keep count consistent */
- rfapiItBiIndexDel(wcb->node, bi);
- rfapiBgpInfoDetach(wcb->node, bi); /* with removed bi */
+ rfapiItBiIndexDel(wcb->node, bpi);
+ rfapiBgpInfoDetach(wcb->node, bpi); /* with removed bpi */
vnc_import_bgp_exterior_del_route_interior(bgp, wcb->import_table,
- wcb->node, bi);
+ wcb->node, bpi);
/*
@@ -2465,7 +2472,7 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
& BGP_VNC_CONFIG_RESPONSE_REMOVAL_DISABLE)) {
int has_valid_duplicate = 0;
- struct bgp_info *bii;
+ struct bgp_path_info *bpii;
/*
* First check if there are any OTHER routes at this node
@@ -2473,8 +2480,8 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
* there are (e.g., from other peers), then the route isn't
* really gone, so skip sending a response removal message.
*/
- for (bii = wcb->node->info; bii; bii = bii->next) {
- if (rfapiVpnBiSamePtUn(bi, bii)) {
+ for (bpii = wcb->node->info; bpii; bpii = bpii->next) {
+ if (rfapiVpnBiSamePtUn(bpi, bpii)) {
has_valid_duplicate = 1;
break;
}
@@ -2489,7 +2496,7 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
}
}
- rfapiMonitorEncapDelete(bi);
+ rfapiMonitorEncapDelete(bpi);
/*
* If there are no VPN monitors at this VPN Node A,
@@ -2514,9 +2521,9 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
done:
/*
- * Free VPN bi
+ * Free VPN bpi
*/
- rfapiBgpInfoFree(bi);
+ rfapiBgpInfoFree(bpi);
wcb->info = NULL;
/*
@@ -2613,48 +2620,48 @@ static int rfapiAttrNexthopAddrDifferent(struct prefix *p1, struct prefix *p2)
return 1;
}
-static void rfapiCopyUnEncap2VPN(struct bgp_info *encap_bi,
- struct bgp_info *vpn_bi)
+static void rfapiCopyUnEncap2VPN(struct bgp_path_info *encap_bpi,
+ struct bgp_path_info *vpn_bpi)
{
- if (!encap_bi->attr) {
- zlog_warn("%s: no encap bi attr/extra, can't copy UN address",
+ if (!encap_bpi->attr) {
+ zlog_warn("%s: no encap bpi attr/extra, can't copy UN address",
__func__);
return;
}
- if (!vpn_bi || !vpn_bi->extra) {
- zlog_warn("%s: no vpn bi attr/extra, can't copy UN address",
+ if (!vpn_bpi || !vpn_bpi->extra) {
+ zlog_warn("%s: no vpn bpi attr/extra, can't copy UN address",
__func__);
return;
}
- switch (BGP_MP_NEXTHOP_FAMILY(encap_bi->attr->mp_nexthop_len)) {
+ switch (BGP_MP_NEXTHOP_FAMILY(encap_bpi->attr->mp_nexthop_len)) {
case AF_INET:
/*
* instrumentation to debug segfault of 091127
*/
- vnc_zlog_debug_verbose("%s: vpn_bi=%p", __func__, vpn_bi);
- if (vpn_bi) {
- vnc_zlog_debug_verbose("%s: vpn_bi->extra=%p", __func__,
- vpn_bi->extra);
+ vnc_zlog_debug_verbose("%s: vpn_bpi=%p", __func__, vpn_bpi);
+ if (vpn_bpi) {
+ vnc_zlog_debug_verbose("%s: vpn_bpi->extra=%p",
+ __func__, vpn_bpi->extra);
}
- vpn_bi->extra->vnc.import.un_family = AF_INET;
- vpn_bi->extra->vnc.import.un.addr4 =
- encap_bi->attr->mp_nexthop_global_in;
+ vpn_bpi->extra->vnc.import.un_family = AF_INET;
+ vpn_bpi->extra->vnc.import.un.addr4 =
+ encap_bpi->attr->mp_nexthop_global_in;
break;
case AF_INET6:
- vpn_bi->extra->vnc.import.un_family = AF_INET6;
- vpn_bi->extra->vnc.import.un.addr6 =
- encap_bi->attr->mp_nexthop_global;
+ vpn_bpi->extra->vnc.import.un_family = AF_INET6;
+ vpn_bpi->extra->vnc.import.un.addr6 =
+ encap_bpi->attr->mp_nexthop_global;
break;
default:
zlog_warn("%s: invalid encap nexthop length: %d", __func__,
- encap_bi->attr->mp_nexthop_len);
- vpn_bi->extra->vnc.import.un_family = 0;
+ encap_bpi->attr->mp_nexthop_len);
+ vpn_bpi->extra->vnc.import.un_family = 0;
break;
}
}
@@ -2662,55 +2669,57 @@ static void rfapiCopyUnEncap2VPN(struct bgp_info *encap_bi,
/*
* returns 0 on success, nonzero on error
*/
-static int rfapiWithdrawEncapUpdateCachedUn(
- struct rfapi_import_table *import_table, struct bgp_info *encap_bi,
- struct agg_node *vpn_rn, struct bgp_info *vpn_bi)
+static int
+rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
+ struct bgp_path_info *encap_bpi,
+ struct agg_node *vpn_rn,
+ struct bgp_path_info *vpn_bpi)
{
- if (!encap_bi) {
+ if (!encap_bpi) {
/*
* clear cached UN address
*/
- if (!vpn_bi || !vpn_bi->extra) {
+ if (!vpn_bpi || !vpn_bpi->extra) {
zlog_warn(
- "%s: missing VPN bi/extra, can't clear UN addr",
+ "%s: missing VPN bpi/extra, can't clear UN addr",
__func__);
return 1;
}
- vpn_bi->extra->vnc.import.un_family = 0;
- memset(&vpn_bi->extra->vnc.import.un, 0,
- sizeof(vpn_bi->extra->vnc.import.un));
- if (CHECK_FLAG(vpn_bi->flags, BGP_INFO_VALID)) {
- if (rfapiGetVncTunnelUnAddr(vpn_bi->attr, NULL)) {
- UNSET_FLAG(vpn_bi->flags, BGP_INFO_VALID);
- if (VALID_INTERIOR_TYPE(vpn_bi->type))
+ vpn_bpi->extra->vnc.import.un_family = 0;
+ memset(&vpn_bpi->extra->vnc.import.un, 0,
+ sizeof(vpn_bpi->extra->vnc.import.un));
+ if (CHECK_FLAG(vpn_bpi->flags, BGP_PATH_VALID)) {
+ if (rfapiGetVncTunnelUnAddr(vpn_bpi->attr, NULL)) {
+ UNSET_FLAG(vpn_bpi->flags, BGP_PATH_VALID);
+ if (VALID_INTERIOR_TYPE(vpn_bpi->type))
RFAPI_MONITOR_EXTERIOR(vpn_rn)
->valid_interior_count--;
/* signal interior route withdrawal to
* import-exterior */
vnc_import_bgp_exterior_del_route_interior(
bgp_get_default(), import_table, vpn_rn,
- vpn_bi);
+ vpn_bpi);
}
}
} else {
- if (!vpn_bi) {
- zlog_warn("%s: missing VPN bi, can't clear UN addr",
+ if (!vpn_bpi) {
+ zlog_warn("%s: missing VPN bpi, can't clear UN addr",
__func__);
return 1;
}
- rfapiCopyUnEncap2VPN(encap_bi, vpn_bi);
- if (!CHECK_FLAG(vpn_bi->flags, BGP_INFO_VALID)) {
- SET_FLAG(vpn_bi->flags, BGP_INFO_VALID);
- if (VALID_INTERIOR_TYPE(vpn_bi->type))
+ rfapiCopyUnEncap2VPN(encap_bpi, vpn_bpi);
+ if (!CHECK_FLAG(vpn_bpi->flags, BGP_PATH_VALID)) {
+ SET_FLAG(vpn_bpi->flags, BGP_PATH_VALID);
+ if (VALID_INTERIOR_TYPE(vpn_bpi->type))
RFAPI_MONITOR_EXTERIOR(vpn_rn)
->valid_interior_count++;
/* signal interior route withdrawal to import-exterior
*/
vnc_import_bgp_exterior_add_route_interior(
bgp_get_default(), import_table, vpn_rn,
- vpn_bi);
+ vpn_bpi);
}
}
return 0;
@@ -2719,25 +2728,25 @@ static int rfapiWithdrawEncapUpdateCachedUn(
static int rfapiWithdrawTimerEncap(struct thread *t)
{
struct rfapi_withdraw *wcb = t->arg;
- struct bgp_info *bi = wcb->info;
+ struct bgp_path_info *bpi = wcb->info;
int was_first_route = 0;
struct rfapi_monitor_encap *em;
struct skiplist *vpn_node_sl = skiplist_new(0, NULL, NULL);
assert(wcb->node);
- assert(bi);
+ assert(bpi);
assert(wcb->import_table);
RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_ENCAP, 0);
- if (wcb->node->info == bi)
+ if (wcb->node->info == bpi)
was_first_route = 1;
/*
- * Remove the route/bi and free it
+ * Remove the route/bpi and free it
*/
- rfapiBgpInfoDetach(wcb->node, bi);
- rfapiBgpInfoFree(bi);
+ rfapiBgpInfoDetach(wcb->node, bpi);
+ rfapiBgpInfoFree(bpi);
if (!was_first_route)
goto done;
@@ -2745,13 +2754,13 @@ static int rfapiWithdrawTimerEncap(struct thread *t)
for (em = RFAPI_MONITOR_ENCAP(wcb->node); em; em = em->next) {
/*
- * Update monitoring VPN BIs with new encap info at the
- * head of the encap bi chain (which could be NULL after
- * removing the expiring bi above)
+ * Update monitoring VPN BPIs with new encap info at the
+ * head of the encap bpi chain (which could be NULL after
+ * removing the expiring bpi above)
*/
if (rfapiWithdrawEncapUpdateCachedUn(wcb->import_table,
wcb->node->info, em->node,
- em->bi))
+ em->bpi))
continue;
/*
@@ -2800,14 +2809,14 @@ done:
*/
static void
rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
- struct agg_node *rn, struct bgp_info *bi, afi_t afi,
- safi_t safi,
+ struct agg_node *rn, struct bgp_path_info *bpi,
+ afi_t afi, safi_t safi,
int (*timer_service_func)(struct thread *))
{
uint32_t lifetime;
struct rfapi_withdraw *wcb;
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
/*
* Already on the path to being withdrawn,
* should already have a timer set up to
@@ -2818,13 +2827,13 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
return;
}
- rfapiGetVncLifetime(bi->attr, &lifetime);
+ rfapiGetVncLifetime(bpi->attr, &lifetime);
vnc_zlog_debug_verbose("%s: VNC lifetime is %u", __func__, lifetime);
/*
* withdrawn routes get to hang around for a while
*/
- SET_FLAG(bi->flags, BGP_INFO_REMOVED);
+ SET_FLAG(bpi->flags, BGP_PATH_REMOVED);
/* set timer to remove the route later */
lifetime = rfapiGetHolddownFromLifetime(lifetime);
@@ -2837,24 +2846,24 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
wcb = XCALLOC(MTYPE_RFAPI_WITHDRAW, sizeof(struct rfapi_withdraw));
assert(wcb);
wcb->node = rn;
- wcb->info = bi;
+ wcb->info = bpi;
wcb->import_table = import_table;
- bgp_attr_intern(bi->attr);
+ bgp_attr_intern(bpi->attr);
if (VNC_DEBUG(VERBOSE)) {
vnc_zlog_debug_verbose(
- "%s: wcb values: node=%p, info=%p, import_table=%p (bi follows)",
+ "%s: wcb values: node=%p, info=%p, import_table=%p (bpi follows)",
__func__, wcb->node, wcb->info, wcb->import_table);
- rfapiPrintBi(NULL, bi);
+ rfapiPrintBi(NULL, bpi);
}
- assert(bi->extra);
+ assert(bpi->extra);
if (lifetime > UINT32_MAX / 1001) {
/* sub-optimal case, but will probably never happen */
- bi->extra->vnc.import.timer = NULL;
+ bpi->extra->vnc.import.timer = NULL;
thread_add_timer(bm->master, timer_service_func, wcb, lifetime,
- &bi->extra->vnc.import.timer);
+ &bpi->extra->vnc.import.timer);
} else {
static uint32_t jitter;
uint32_t lifetime_msec;
@@ -2868,16 +2877,16 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
lifetime_msec = (lifetime * 1000) + jitter;
- bi->extra->vnc.import.timer = NULL;
+ bpi->extra->vnc.import.timer = NULL;
thread_add_timer_msec(bm->master, timer_service_func, wcb,
lifetime_msec,
- &bi->extra->vnc.import.timer);
+ &bpi->extra->vnc.import.timer);
}
- /* re-sort route list (BGP_INFO_REMOVED routes are last) */
- if (((struct bgp_info *)rn->info)->next) {
- rfapiBgpInfoDetach(rn, bi);
- rfapiBgpInfoAttachSorted(rn, bi, afi, safi);
+ /* re-sort route list (BGP_PATH_REMOVED routes are last) */
+ if (((struct bgp_path_info *)rn->info)->next) {
+ rfapiBgpInfoDetach(rn, bpi);
+ rfapiBgpInfoAttachSorted(rn, bpi, afi, safi);
}
}
@@ -2890,7 +2899,7 @@ typedef void(rfapi_bi_filtered_import_f)(struct rfapi_import_table *, int,
static void rfapiExpireEncapNow(struct rfapi_import_table *it,
- struct agg_node *rn, struct bgp_info *bi)
+ struct agg_node *rn, struct bgp_path_info *bpi)
{
struct rfapi_withdraw *wcb;
struct thread t;
@@ -2899,7 +2908,7 @@ static void rfapiExpireEncapNow(struct rfapi_import_table *it,
* pretend we're an expiring timer
*/
wcb = XCALLOC(MTYPE_RFAPI_WITHDRAW, sizeof(struct rfapi_withdraw));
- wcb->info = bi;
+ wcb->info = bpi;
wcb->node = rn;
wcb->import_table = it;
memset(&t, 0, sizeof(t));
@@ -2929,7 +2938,7 @@ static int rfapiGetNexthop(struct attr *attr, struct prefix *prefix)
}
/*
- * import a bgp_info if its route target list intersects with the
+ * import a bgp_path_info if its route target list intersects with the
* import table's route target list
*/
static void rfapiBgpInfoFilteredImportEncap(
@@ -2938,20 +2947,20 @@ static void rfapiBgpInfoFilteredImportEncap(
struct prefix *p,
struct prefix *aux_prefix, /* Unused for encap routes */
afi_t afi, struct prefix_rd *prd,
- struct attr *attr, /* part of bgp_info */
- uint8_t type, /* part of bgp_info */
- uint8_t sub_type, /* part of bgp_info */
- uint32_t *label) /* part of bgp_info */
+ struct attr *attr, /* part of bgp_path_info */
+ uint8_t type, /* part of bgp_path_info */
+ uint8_t sub_type, /* part of bgp_path_info */
+ uint32_t *label) /* part of bgp_path_info */
{
struct agg_table *rt = NULL;
struct agg_node *rn;
- struct bgp_info *info_new;
- struct bgp_info *bi;
- struct bgp_info *next;
+ struct bgp_path_info *info_new;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info *next;
char buf[BUFSIZ];
- struct prefix p_firstbi_old;
- struct prefix p_firstbi_new;
+ struct prefix p_firstbpi_old;
+ struct prefix p_firstbpi_new;
int replacing = 0;
const char *action_str = NULL;
struct prefix un_prefix;
@@ -2978,8 +2987,8 @@ static void rfapiBgpInfoFilteredImportEncap(
"%s: entry: %s: prefix %s/%d", __func__, action_str,
inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ), p->prefixlen);
- memset(&p_firstbi_old, 0, sizeof(p_firstbi_old));
- memset(&p_firstbi_new, 0, sizeof(p_firstbi_new));
+ memset(&p_firstbpi_old, 0, sizeof(p_firstbpi_old));
+ memset(&p_firstbpi_new, 0, sizeof(p_firstbpi_new));
if (action == FIF_ACTION_UPDATE) {
/*
@@ -3055,37 +3064,37 @@ static void rfapiBgpInfoFilteredImportEncap(
/*
- * capture nexthop of first bi
+ * capture nexthop of first bpi
*/
if (rn->info) {
rfapiNexthop2Prefix(
- ((struct bgp_info *)(rn->info))->attr,
- &p_firstbi_old);
+ ((struct bgp_path_info *)(rn->info))->attr,
+ &p_firstbpi_old);
}
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
/*
- * Does this bgp_info refer to the same route
+ * Does this bgp_path_info refer to the same route
* as we are trying to add?
*/
- vnc_zlog_debug_verbose("%s: comparing BI %p", __func__,
- bi);
+ vnc_zlog_debug_verbose("%s: comparing BPI %p", __func__,
+ bpi);
/*
* Compare RDs
*
- * RD of import table bi is in bi->extra->vnc.import.rd
- * RD of info_orig is in prd
+ * RD of import table bpi is in
+ * bpi->extra->vnc.import.rd RD of info_orig is in prd
*/
- if (!bi->extra) {
- vnc_zlog_debug_verbose("%s: no bi->extra",
+ if (!bpi->extra) {
+ vnc_zlog_debug_verbose("%s: no bpi->extra",
__func__);
continue;
}
if (prefix_cmp(
- (struct prefix *)&bi->extra->vnc.import.rd,
+ (struct prefix *)&bpi->extra->vnc.import.rd,
(struct prefix *)prd)) {
vnc_zlog_debug_verbose("%s: prd does not match",
@@ -3096,16 +3105,16 @@ static void rfapiBgpInfoFilteredImportEncap(
/*
* Compare peers
*/
- if (bi->peer != peer) {
+ if (bpi->peer != peer) {
vnc_zlog_debug_verbose(
"%s: peer does not match", __func__);
continue;
}
- vnc_zlog_debug_verbose("%s: found matching bi",
+ vnc_zlog_debug_verbose("%s: found matching bpi",
__func__);
- /* Same route. Delete this bi, replace with new one */
+ /* Same route. Delete this bpi, replace with new one */
if (action == FIF_ACTION_WITHDRAW) {
@@ -3117,7 +3126,7 @@ static void rfapiBgpInfoFilteredImportEncap(
rn->p.prefixlen);
rfapiBiStartWithdrawTimer(
- import_table, rn, bi, afi, SAFI_ENCAP,
+ import_table, rn, bpi, afi, SAFI_ENCAP,
rfapiWithdrawTimerEncap);
} else {
@@ -3136,11 +3145,11 @@ static void rfapiBgpInfoFilteredImportEncap(
* a previous withdraw, we must cancel its
* timer.
*/
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)
- && bi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc
+ (struct thread *)bpi->extra->vnc
.import.timer;
struct rfapi_withdraw *wcb = t->arg;
@@ -3149,13 +3158,13 @@ static void rfapiBgpInfoFilteredImportEncap(
}
if (action == FIF_ACTION_UPDATE) {
- rfapiBgpInfoDetach(rn, bi);
- rfapiBgpInfoFree(bi);
+ rfapiBgpInfoDetach(rn, bpi);
+ rfapiBgpInfoFree(bpi);
replacing = 1;
} else {
/*
* Kill: do export stuff when removing
- * bi
+ * bpi
*/
struct rfapi_withdraw *wcb;
struct thread t;
@@ -3166,7 +3175,7 @@ static void rfapiBgpInfoFilteredImportEncap(
wcb = XCALLOC(
MTYPE_RFAPI_WITHDRAW,
sizeof(struct rfapi_withdraw));
- wcb->info = bi;
+ wcb->info = bpi;
wcb->node = rn;
wcb->import_table = import_table;
memset(&t, 0, sizeof(t));
@@ -3191,7 +3200,7 @@ static void rfapiBgpInfoFilteredImportEncap(
if (rn) {
if (!replacing)
- agg_lock_node(rn); /* incr ref count for new BI */
+ agg_lock_node(rn); /* incr ref count for new BPI */
} else {
rn = agg_node_get(rt, p);
}
@@ -3207,13 +3216,13 @@ static void rfapiBgpInfoFilteredImportEncap(
* Delete holddown routes from same NVE. See details in
* rfapiBgpInfoFilteredImportVPN()
*/
- for (bi = info_new->next; bi; bi = next) {
+ for (bpi = info_new->next; bpi; bpi = next) {
struct prefix pfx_un;
int un_match = 0;
- next = bi->next;
- if (!CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ next = bpi->next;
+ if (!CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
/*
@@ -3221,7 +3230,7 @@ static void rfapiBgpInfoFilteredImportEncap(
* of the route node)
*/
- if (!rfapiGetNexthop(bi->attr, &pfx_un)
+ if (!rfapiGetNexthop(bpi->attr, &pfx_un)
&& prefix_same(&pfx_un, &un_prefix)) {
un_match = 1;
@@ -3231,21 +3240,21 @@ static void rfapiBgpInfoFilteredImportEncap(
continue;
vnc_zlog_debug_verbose(
- "%s: removing holddown bi matching NVE of new route",
+ "%s: removing holddown bpi matching NVE of new route",
__func__);
- if (bi->extra->vnc.import.timer) {
+ if (bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc.import.timer;
+ (struct thread *)bpi->extra->vnc.import.timer;
struct rfapi_withdraw *wcb = t->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t);
}
- rfapiExpireEncapNow(import_table, rn, bi);
+ rfapiExpireEncapNow(import_table, rn, bpi);
}
- rfapiNexthop2Prefix(((struct bgp_info *)(rn->info))->attr,
- &p_firstbi_new);
+ rfapiNexthop2Prefix(((struct bgp_path_info *)(rn->info))->attr,
+ &p_firstbpi_new);
/*
* If the nexthop address of the selected Encap route (i.e.,
@@ -3253,7 +3262,7 @@ static void rfapiBgpInfoFilteredImportEncap(
* routes that refer to this Encap route and possibly force
* rfapi callbacks.
*/
- if (rfapiAttrNexthopAddrDifferent(&p_firstbi_old, &p_firstbi_new)) {
+ if (rfapiAttrNexthopAddrDifferent(&p_firstbpi_old, &p_firstbpi_new)) {
struct rfapi_monitor_encap *m;
struct rfapi_monitor_encap *mnext;
@@ -3284,19 +3293,19 @@ static void rfapiBgpInfoFilteredImportEncap(
for (m = RFAPI_MONITOR_ENCAP(rn); m; m = m->next) {
/*
- * For each referenced bi/route, copy the ENCAP route's
+ * For each referenced bpi/route, copy the ENCAP route's
* nexthop to the VPN route's cached UN address field
* and set
* the address family of the cached UN address field.
*/
- rfapiCopyUnEncap2VPN(info_new, m->bi);
- if (!CHECK_FLAG(m->bi->flags, BGP_INFO_VALID)) {
- SET_FLAG(m->bi->flags, BGP_INFO_VALID);
- if (VALID_INTERIOR_TYPE(m->bi->type))
+ rfapiCopyUnEncap2VPN(info_new, m->bpi);
+ if (!CHECK_FLAG(m->bpi->flags, BGP_PATH_VALID)) {
+ SET_FLAG(m->bpi->flags, BGP_PATH_VALID);
+ if (VALID_INTERIOR_TYPE(m->bpi->type))
RFAPI_MONITOR_EXTERIOR(m->node)
->valid_interior_count++;
vnc_import_bgp_exterior_add_route_interior(
- bgp, import_table, m->node, m->bi);
+ bgp, import_table, m->node, m->bpi);
}
/*
@@ -3369,7 +3378,7 @@ static void rfapiBgpInfoFilteredImportEncap(
}
static void rfapiExpireVpnNow(struct rfapi_import_table *it,
- struct agg_node *rn, struct bgp_info *bi,
+ struct agg_node *rn, struct bgp_path_info *bpi,
int lockoffset)
{
struct rfapi_withdraw *wcb;
@@ -3379,7 +3388,7 @@ static void rfapiExpireVpnNow(struct rfapi_import_table *it,
* pretend we're an expiring timer
*/
wcb = XCALLOC(MTYPE_RFAPI_WITHDRAW, sizeof(struct rfapi_withdraw));
- wcb->info = bi;
+ wcb->info = bpi;
wcb->node = rn;
wcb->import_table = it;
wcb->lockoffset = lockoffset;
@@ -3390,7 +3399,7 @@ static void rfapiExpireVpnNow(struct rfapi_import_table *it,
/*
- * import a bgp_info if its route target list intersects with the
+ * import a bgp_path_info if its route target list intersects with the
* import table's route target list
*/
void rfapiBgpInfoFilteredImportVPN(
@@ -3399,17 +3408,17 @@ void rfapiBgpInfoFilteredImportVPN(
struct prefix *p,
struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
afi_t afi, struct prefix_rd *prd,
- struct attr *attr, /* part of bgp_info */
- uint8_t type, /* part of bgp_info */
- uint8_t sub_type, /* part of bgp_info */
- uint32_t *label) /* part of bgp_info */
+ struct attr *attr, /* part of bgp_path_info */
+ uint8_t type, /* part of bgp_path_info */
+ uint8_t sub_type, /* part of bgp_path_info */
+ uint32_t *label) /* part of bgp_path_info */
{
struct agg_table *rt = NULL;
struct agg_node *rn;
struct agg_node *n;
- struct bgp_info *info_new;
- struct bgp_info *bi;
- struct bgp_info *next;
+ struct bgp_path_info *info_new;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info *next;
char buf[BUFSIZ];
struct prefix vn_prefix;
struct prefix un_prefix;
@@ -3524,25 +3533,25 @@ void rfapiBgpInfoFilteredImportVPN(
/*
* Look for same route (will have same RD and peer)
*/
- bi = rfapiItBiIndexSearch(rn, prd, peer, aux_prefix);
+ bpi = rfapiItBiIndexSearch(rn, prd, peer, aux_prefix);
- if (bi) {
+ if (bpi) {
/*
* This was an old test when we iterated over the
- * BIs linearly. Since we're now looking up with
+ * BPIs linearly. Since we're now looking up with
* RD and peer, comparing types should not be
* needed. Changed to assertion.
*
* Compare types. Doing so prevents a RFP-originated
* route from matching an imported route, for example.
*/
- if (VNC_DEBUG(VERBOSE) && bi->type != type)
+ if (VNC_DEBUG(VERBOSE) && bpi->type != type)
/* should be handled by RDs, but warn for now */
- zlog_warn("%s: type mismatch! (bi=%d, arg=%d)",
- __func__, bi->type, type);
+ zlog_warn("%s: type mismatch! (bpi=%d, arg=%d)",
+ __func__, bpi->type, type);
- vnc_zlog_debug_verbose("%s: found matching bi",
+ vnc_zlog_debug_verbose("%s: found matching bpi",
__func__);
/*
@@ -3550,15 +3559,15 @@ void rfapiBgpInfoFilteredImportVPN(
* holddown
*/
if (import_table == bgp->rfapi->it_ce) {
- vnc_direct_bgp_del_route_ce(bgp, rn, bi);
+ vnc_direct_bgp_del_route_ce(bgp, rn, bpi);
if (action == FIF_ACTION_WITHDRAW)
action = FIF_ACTION_KILL;
}
if (action == FIF_ACTION_WITHDRAW) {
- int washolddown =
- CHECK_FLAG(bi->flags, BGP_INFO_REMOVED);
+ int washolddown = CHECK_FLAG(bpi->flags,
+ BGP_PATH_REMOVED);
vnc_zlog_debug_verbose(
"%s: withdrawing at prefix %s/%d%s",
@@ -3573,12 +3582,12 @@ void rfapiBgpInfoFilteredImportVPN(
VNC_ITRCCK;
if (!washolddown) {
rfapiBiStartWithdrawTimer(
- import_table, rn, bi, afi,
+ import_table, rn, bpi, afi,
SAFI_MPLS_VPN,
rfapiWithdrawTimerVPN);
RFAPI_UPDATE_ITABLE_COUNT(
- bi, import_table, afi, -1);
+ bpi, import_table, afi, -1);
import_table->holddown_count[afi] += 1;
}
VNC_ITRCCK;
@@ -3599,11 +3608,11 @@ void rfapiBgpInfoFilteredImportVPN(
* a previous withdraw, we must cancel its
* timer.
*/
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)
- && bi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
+ && bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc
+ (struct thread *)bpi->extra->vnc
.import.timer;
struct rfapi_withdraw *wcb = t->arg;
@@ -3612,15 +3621,15 @@ void rfapiBgpInfoFilteredImportVPN(
import_table->holddown_count[afi] -= 1;
RFAPI_UPDATE_ITABLE_COUNT(
- bi, import_table, afi, 1);
+ bpi, import_table, afi, 1);
}
/*
* decrement remote count (if route is remote)
* because
* we are going to remove it below
*/
- RFAPI_UPDATE_ITABLE_COUNT(bi, import_table, afi,
- -1);
+ RFAPI_UPDATE_ITABLE_COUNT(bpi, import_table,
+ afi, -1);
if (action == FIF_ACTION_UPDATE) {
replacing = 1;
@@ -3628,31 +3637,31 @@ void rfapiBgpInfoFilteredImportVPN(
* make copy of original nexthop so we
* can see if it changed
*/
- rfapiGetNexthop(bi->attr,
+ rfapiGetNexthop(bpi->attr,
&original_nexthop);
/*
- * remove bi without doing any export
+ * remove bpi without doing any export
* processing
*/
- if (CHECK_FLAG(bi->flags,
- BGP_INFO_VALID)
- && VALID_INTERIOR_TYPE(bi->type))
+ if (CHECK_FLAG(bpi->flags,
+ BGP_PATH_VALID)
+ && VALID_INTERIOR_TYPE(bpi->type))
RFAPI_MONITOR_EXTERIOR(rn)
->valid_interior_count--;
- rfapiItBiIndexDel(rn, bi);
- rfapiBgpInfoDetach(rn, bi);
- rfapiMonitorEncapDelete(bi);
+ rfapiItBiIndexDel(rn, bpi);
+ rfapiBgpInfoDetach(rn, bpi);
+ rfapiMonitorEncapDelete(bpi);
vnc_import_bgp_exterior_del_route_interior(
- bgp, import_table, rn, bi);
- rfapiBgpInfoFree(bi);
+ bgp, import_table, rn, bpi);
+ rfapiBgpInfoFree(bpi);
} else {
/* Kill */
/*
- * remove bi and do export processing
+ * remove bpi and do export processing
*/
import_table->holddown_count[afi] += 1;
- rfapiExpireVpnNow(import_table, rn, bi,
+ rfapiExpireVpnNow(import_table, rn, bpi,
0);
}
}
@@ -3700,16 +3709,17 @@ void rfapiBgpInfoFilteredImportVPN(
/*
* For ethernet routes, if there is an accompanying IP address,
- * save it in the bi
+ * save it in the bpi
*/
if ((AFI_L2VPN == afi) && aux_prefix) {
- vnc_zlog_debug_verbose("%s: setting BI's aux_prefix", __func__);
+ vnc_zlog_debug_verbose("%s: setting BPI's aux_prefix",
+ __func__);
info_new->extra->vnc.import.aux_prefix = *aux_prefix;
}
vnc_zlog_debug_verbose(
- "%s: inserting bi %p at prefix %s/%d #%d", __func__, info_new,
+ "%s: inserting bpi %p at prefix %s/%d #%d", __func__, info_new,
rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
rn->p.prefixlen, rn->lock);
@@ -3718,7 +3728,7 @@ void rfapiBgpInfoFilteredImportVPN(
if (!rfapiGetUnAddrOfVpnBi(info_new, NULL)) {
if (VALID_INTERIOR_TYPE(info_new->type))
RFAPI_MONITOR_EXTERIOR(rn)->valid_interior_count++;
- SET_FLAG(info_new->flags, BGP_INFO_VALID);
+ SET_FLAG(info_new->flags, BGP_PATH_VALID);
}
RFAPI_UPDATE_ITABLE_COUNT(info_new, import_table, afi, 1);
vnc_import_bgp_exterior_add_route_interior(bgp, import_table, rn,
@@ -3779,40 +3789,40 @@ void rfapiBgpInfoFilteredImportVPN(
* by the fresh route).
*/
/*
- * We know that the new bi will have been inserted before any routes
+ * We know that the new bpi will have been inserted before any routes
* in holddown, so we can skip any that came before it
*/
- for (bi = info_new->next; bi; bi = next) {
+ for (bpi = info_new->next; bpi; bpi = next) {
struct prefix pfx_vn;
struct prefix pfx_un;
int un_match = 0;
int remote_peer_match = 0;
- next = bi->next;
+ next = bpi->next;
/*
* Must be holddown
*/
- if (!CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ if (!CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
/*
* Must match VN address (nexthop of VPN route)
*/
- if (rfapiGetNexthop(bi->attr, &pfx_vn))
+ if (rfapiGetNexthop(bpi->attr, &pfx_vn))
continue;
if (!prefix_same(&pfx_vn, &vn_prefix))
continue;
if (un_prefix_valid && /* new route UN addr */
- !rfapiGetUnAddrOfVpnBi(bi, &pfx_un)
+ !rfapiGetUnAddrOfVpnBi(bpi, &pfx_un)
&& /* old route UN addr */
prefix_same(&pfx_un, &un_prefix)) { /* compare */
un_match = 1;
}
- if (!RFAPI_LOCAL_BI(bi) && !RFAPI_LOCAL_BI(info_new)
- && sockunion_same(&bi->peer->su, &info_new->peer->su)) {
+ if (!RFAPI_LOCAL_BI(bpi) && !RFAPI_LOCAL_BI(info_new)
+ && sockunion_same(&bpi->peer->su, &info_new->peer->su)) {
/* old & new are both remote, same peer */
remote_peer_match = 1;
}
@@ -3821,17 +3831,17 @@ void rfapiBgpInfoFilteredImportVPN(
continue;
vnc_zlog_debug_verbose(
- "%s: removing holddown bi matching NVE of new route",
+ "%s: removing holddown bpi matching NVE of new route",
__func__);
- if (bi->extra->vnc.import.timer) {
+ if (bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi->extra->vnc.import.timer;
+ (struct thread *)bpi->extra->vnc.import.timer;
struct rfapi_withdraw *wcb = t->arg;
XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
thread_cancel(t);
}
- rfapiExpireVpnNow(import_table, rn, bi, 0);
+ rfapiExpireVpnNow(import_table, rn, bpi, 0);
}
if (!original_had_routes) {
@@ -3877,10 +3887,10 @@ static void rfapiBgpInfoFilteredImportBadSafi(
struct prefix *p,
struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
afi_t afi, struct prefix_rd *prd,
- struct attr *attr, /* part of bgp_info */
- uint8_t type, /* part of bgp_info */
- uint8_t sub_type, /* part of bgp_info */
- uint32_t *label) /* part of bgp_info */
+ struct attr *attr, /* part of bgp_path_info */
+ uint8_t type, /* part of bgp_path_info */
+ uint8_t sub_type, /* part of bgp_path_info */
+ uint32_t *label) /* part of bgp_path_info */
{
vnc_zlog_debug_verbose("%s: Error, bad safi", __func__);
}
@@ -4088,22 +4098,22 @@ void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p,
* routes expiring at the same time due to peer drop.
*/
/*
- * 1. Visit all BIs in all ENCAP import tables.
+ * 1. Visit all BPIs in all ENCAP import tables.
*
- * a. If a bi's peer is the failed peer, remove the bi.
- * b. If the removed ENCAP bi was first in the list of
- * BIs at this ENCAP node, loop over all monitors
+ * a. If a bpi's peer is the failed peer, remove the bpi.
+ * b. If the removed ENCAP bpi was first in the list of
+ * BPIs at this ENCAP node, loop over all monitors
* at this node:
*
* (1) for each ENCAP monitor, loop over all its
* VPN node monitors and set their RFAPI_MON_FLAG_NEEDCALLBACK
* flags.
*
- * 2. Visit all BIs in all VPN import tables.
- * a. If a bi's peer is the failed peer, remove the bi.
+ * 2. Visit all BPIs in all VPN import tables.
+ * a. If a bpi's peer is the failed peer, remove the bpi.
* b. loop over all the VPN node monitors and set their
* RFAPI_MON_FLAG_NEEDCALLBACK flags
- * c. If there are no BIs left at this VPN node,
+ * c. If there are no BPIs left at this VPN node,
*
*/
@@ -4114,7 +4124,7 @@ static void rfapiProcessPeerDownRt(struct peer *peer,
afi_t afi, safi_t safi)
{
struct agg_node *rn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct agg_table *rt;
int (*timer_service_func)(struct thread *);
@@ -4137,20 +4147,20 @@ static void rfapiProcessPeerDownRt(struct peer *peer,
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
- for (bi = rn->info; bi; bi = bi->next) {
- if (bi->peer == peer) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ if (bpi->peer == peer) {
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
/* already in holddown, skip */
continue;
}
if (safi == SAFI_MPLS_VPN) {
RFAPI_UPDATE_ITABLE_COUNT(
- bi, import_table, afi, -1);
+ bpi, import_table, afi, -1);
import_table->holddown_count[afi] += 1;
}
- rfapiBiStartWithdrawTimer(import_table, rn, bi,
+ rfapiBiStartWithdrawTimer(import_table, rn, bpi,
afi, safi,
timer_service_func);
}
@@ -4182,11 +4192,11 @@ void rfapiProcessPeerDown(struct peer *peer)
return;
/*
- * 1. Visit all BIs in all ENCAP import tables.
- * Start withdraw timer on the BIs that match peer.
+ * 1. Visit all BPIs in all ENCAP import tables.
+ * Start withdraw timer on the BPIs that match peer.
*
- * 2. Visit All BIs in all VPN import tables.
- * Start withdraw timer on the BIs that match peer.
+ * 2. Visit All BPIs in all VPN import tables.
+ * Start withdraw timer on the BPIs that match peer.
*/
bgp = bgp_get_default(); /* assume 1 instance for now */
@@ -4238,27 +4248,27 @@ static void rfapiBgpTableFilteredImport(struct bgp *bgp,
for (rn2 = bgp_table_top(rn1->info); rn2;
rn2 = bgp_route_next(rn2)) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn2->info; bi; bi = bi->next) {
+ for (bpi = rn2->info; bpi; bpi = bpi->next) {
uint32_t label = 0;
- if (CHECK_FLAG(bi->flags,
- BGP_INFO_REMOVED))
+ if (CHECK_FLAG(bpi->flags,
+ BGP_PATH_REMOVED))
continue;
- if (bi->extra)
+ if (bpi->extra)
label = decode_label(
- &bi->extra->label[0]);
+ &bpi->extra->label[0]);
(*rfapiBgpInfoFilteredImportFunction(
safi))(
it, /* which import table */
- FIF_ACTION_UPDATE, bi->peer,
+ FIF_ACTION_UPDATE, bpi->peer,
NULL, &rn2->p, /* prefix */
NULL, afi,
(struct prefix_rd *)&rn1->p,
- bi->attr, bi->type,
- bi->sub_type, &label);
+ bpi->attr, bpi->type,
+ bpi->sub_type, &label);
}
}
}
@@ -4472,8 +4482,8 @@ static void rfapiDeleteRemotePrefixesIt(
afi);
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
- struct bgp_info *bi;
- struct bgp_info *next;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info *next;
if (VNC_DEBUG(IMPORT_DEL_REMOTE)) {
char p1line[PREFIX_STRLEN];
@@ -4499,8 +4509,8 @@ static void rfapiDeleteRemotePrefixesIt(
/* TBD is this valid for afi == AFI_L2VPN? */
RFAPI_CHECK_REFCOUNT(rn, SAFI_MPLS_VPN, 1);
- for (bi = rn->info; bi; bi = next) {
- next = bi->next;
+ for (bpi = rn->info; bpi; bpi = next) {
+ next = bpi->next;
struct prefix qpt;
struct prefix qct;
@@ -4508,11 +4518,11 @@ static void rfapiDeleteRemotePrefixesIt(
int qct_valid = 0;
int is_active = 0;
- vnc_zlog_debug_verbose("%s: examining bi %p",
- __func__, bi);
+ vnc_zlog_debug_verbose("%s: examining bpi %p",
+ __func__, bpi);
- if (bi->attr) {
- if (!rfapiGetNexthop(bi->attr, &qpt))
+ if (bpi->attr) {
+ if (!rfapiGetNexthop(bpi->attr, &qpt))
qpt_valid = 1;
}
if (vn) {
@@ -4527,7 +4537,7 @@ static void rfapiDeleteRemotePrefixesIt(
}
}
- if (!rfapiGetUnAddrOfVpnBi(bi, &qct))
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &qct))
qct_valid = 1;
if (un) {
@@ -4544,7 +4554,7 @@ static void rfapiDeleteRemotePrefixesIt(
/*
- * Blow bi away
+ * Blow bpi away
*/
/*
* If this route is waiting to be deleted
@@ -4552,13 +4562,13 @@ static void rfapiDeleteRemotePrefixesIt(
* a previous withdraw, we must cancel its
* timer.
*/
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
if (!delete_holddown)
continue;
- if (bi->extra->vnc.import.timer) {
+ if (bpi->extra->vnc.import.timer) {
struct thread *t =
- (struct thread *)bi
+ (struct thread *)bpi
->extra->vnc
.import.timer;
struct rfapi_withdraw *wcb =
@@ -4568,7 +4578,7 @@ static void rfapiDeleteRemotePrefixesIt(
->holddown_count[afi] -=
1;
RFAPI_UPDATE_ITABLE_COUNT(
- bi, wcb->import_table,
+ bpi, wcb->import_table,
afi, 1);
XFREE(MTYPE_RFAPI_WITHDRAW,
wcb);
@@ -4581,8 +4591,8 @@ static void rfapiDeleteRemotePrefixesIt(
}
vnc_zlog_debug_verbose(
- "%s: deleting bi %p (qct_valid=%d, qpt_valid=%d, delete_holddown=%d, delete_active=%d)",
- __func__, bi, qct_valid, qpt_valid,
+ "%s: deleting bpi %p (qct_valid=%d, qpt_valid=%d, delete_holddown=%d, delete_active=%d)",
+ __func__, bpi, qct_valid, qpt_valid,
delete_holddown, delete_active);
@@ -4628,11 +4638,11 @@ static void rfapiDeleteRemotePrefixesIt(
}
vnc_direct_bgp_rh_del_route(bgp, afi, &rn->p,
- bi->peer);
+ bpi->peer);
- RFAPI_UPDATE_ITABLE_COUNT(bi, it, afi, -1);
+ RFAPI_UPDATE_ITABLE_COUNT(bpi, it, afi, -1);
it->holddown_count[afi] += 1;
- rfapiExpireVpnNow(it, rn, bi, 1);
+ rfapiExpireVpnNow(it, rn, bpi, 1);
vnc_zlog_debug_verbose(
"%s: incrementing count (is_active=%d)",
diff --git a/bgpd/rfapi/rfapi_import.h b/bgpd/rfapi/rfapi_import.h
index ae3d248367..1ab9cc5193 100644
--- a/bgpd/rfapi/rfapi_import.h
+++ b/bgpd/rfapi/rfapi_import.h
@@ -31,7 +31,7 @@
/*
* These are per-rt-import-list
*
- * routes are not segregated by RD - the RD is stored in bgp_info_extra
+ * routes are not segregated by RD - the RD is stored in bgp_path_info_extra
* and is needed to determine if two prefixes are the same.
*/
struct rfapi_import_table {
@@ -51,18 +51,18 @@ struct rfapi_import_table {
int imported_count[AFI_MAX];
};
-#define RFAPI_LOCAL_BI(bi) \
- (((bi)->type == ZEBRA_ROUTE_BGP) && ((bi)->sub_type == BGP_ROUTE_RFP))
+#define RFAPI_LOCAL_BI(bpi) \
+ (((bpi)->type == ZEBRA_ROUTE_BGP) && ((bpi)->sub_type == BGP_ROUTE_RFP))
-#define RFAPI_DIRECT_IMPORT_BI(bi) \
- (((bi)->type == ZEBRA_ROUTE_BGP_DIRECT) \
- || ((bi)->type == ZEBRA_ROUTE_BGP_DIRECT_EXT))
+#define RFAPI_DIRECT_IMPORT_BI(bpi) \
+ (((bpi)->type == ZEBRA_ROUTE_BGP_DIRECT) \
+ || ((bpi)->type == ZEBRA_ROUTE_BGP_DIRECT_EXT))
-#define RFAPI_UPDATE_ITABLE_COUNT(bi, itable, afi, cnt) \
- if (RFAPI_LOCAL_BI(bi)) { \
+#define RFAPI_UPDATE_ITABLE_COUNT(bpi, itable, afi, cnt) \
+ if (RFAPI_LOCAL_BI(bpi)) { \
(itable)->local_count[(afi)] += (cnt); \
} else { \
- if (RFAPI_DIRECT_IMPORT_BI(bi)) \
+ if (RFAPI_DIRECT_IMPORT_BI(bpi)) \
(itable)->imported_count[(afi)] += (cnt); \
else \
(itable)->remote_count[(afi)] += (cnt); \
@@ -75,9 +75,9 @@ extern void rfapiDebugBacktrace(void);
extern void rfapiCheckRouteCount(void);
/*
- * Print BI in an Import Table
+ * Print BPI in an Import Table
*/
-extern void rfapiPrintBi(void *stream, struct bgp_info *bi);
+extern void rfapiPrintBi(void *stream, struct bgp_path_info *bpi);
extern void rfapiShowImportTable(void *stream, const char *label,
struct agg_table *rt, int isvpn);
@@ -94,7 +94,7 @@ extern void rfapiImportTableRefDelByIt(struct bgp *bgp,
* Construct an rfapi nexthop list based on the routes attached to
* the specified node.
*
- * If there are any routes that do NOT have BGP_INFO_REMOVED set,
+ * If there are any routes that do NOT have BGP_PATH_REMOVED set,
* return those only. If there are ONLY routes with BGP_INFO_REMOVED,
* then return those, and also include all the non-removed routes from the
* next less-specific node (i.e., this node's parent) at the end.
@@ -128,7 +128,7 @@ extern int rfapiHasNonRemovedRoutes(struct agg_node *rn);
extern int rfapiProcessDeferredClose(struct thread *t);
-extern int rfapiGetUnAddrOfVpnBi(struct bgp_info *bi, struct prefix *p);
+extern int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p);
extern void rfapiNexthop2Prefix(struct attr *attr, struct prefix *p);
@@ -146,10 +146,10 @@ extern void rfapiBgpInfoFilteredImportVPN(
struct prefix *p,
struct prefix *aux_prefix, /* AFI_ETHER: optional IP */
afi_t afi, struct prefix_rd *prd,
- struct attr *attr, /* part of bgp_info */
- uint8_t type, /* part of bgp_info */
- uint8_t sub_type, /* part of bgp_info */
- uint32_t *label); /* part of bgp_info */
+ struct attr *attr, /* part of bgp_path_info */
+ uint8_t type, /* part of bgp_path_info */
+ uint8_t sub_type, /* part of bgp_path_info */
+ uint32_t *label); /* part of bgp_path_info */
extern struct rfapi_next_hop_entry *rfapiEthRouteNode2NextHopList(
struct agg_node *rn, struct rfapi_ip_prefix *rprefix,
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index f18c6bfe12..dc1f7e0fbb 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -226,7 +226,7 @@ void rfapiMonitorExtraFlush(safi_t safi, struct agg_node *rn)
agg_unlock_node(rn);
}
if (hie->u.vpn.idx_rd) {
- /* looping through bi->extra->vnc.import.rd is tbd */
+ /* looping through bpi->extra->vnc.import.rd is tbd */
while (!skiplist_delete_first(hie->u.vpn.idx_rd)) {
agg_unlock_node(rn);
}
@@ -346,16 +346,16 @@ struct agg_node *rfapiMonitorGetAttachNode(struct rfapi_descriptor *rfd,
for (rn = agg_node_match(rfd->import_table->imported_vpn[afi], p);
rn;) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct prefix pfx_dummy;
/* TBD update this code to use new valid_interior_count */
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
/*
* If there is a cached ENCAP UN address, it's a usable
* VPN route
*/
- if (bi->extra && bi->extra->vnc.import.un_family) {
+ if (bpi->extra && bpi->extra->vnc.import.un_family) {
break;
}
@@ -364,11 +364,11 @@ struct agg_node *rfapiMonitorGetAttachNode(struct rfapi_descriptor *rfd,
* address,
* it's a usable VPN route.
*/
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &pfx_dummy)) {
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_dummy)) {
break;
}
}
- if (bi)
+ if (bpi)
break;
agg_unlock_node(rn);
diff --git a/bgpd/rfapi/rfapi_monitor.h b/bgpd/rfapi/rfapi_monitor.h
index 9b85f6248e..b8eec56475 100644
--- a/bgpd/rfapi/rfapi_monitor.h
+++ b/bgpd/rfapi/rfapi_monitor.h
@@ -45,7 +45,7 @@ struct rfapi_monitor_encap {
struct rfapi_monitor_encap *next;
struct rfapi_monitor_encap *prev;
struct agg_node *node; /* VPN node */
- struct bgp_info *bi; /* VPN bi */
+ struct bgp_path_info *bpi; /* VPN bpi */
struct agg_node *rn; /* parent node */
};
@@ -83,7 +83,7 @@ struct rfapi_it_extra {
* Encap TLV */
int valid_interior_count;
- /* unicast exterior routes, key=bi,
+ /* unicast exterior routes, key=bpi,
* val=allocated prefix */
struct skiplist *source;
} e;
diff --git a/bgpd/rfapi/rfapi_private.h b/bgpd/rfapi/rfapi_private.h
index 4d8072a49b..87d9a32f67 100644
--- a/bgpd/rfapi/rfapi_private.h
+++ b/bgpd/rfapi/rfapi_private.h
@@ -212,7 +212,7 @@ struct rfapi {
/*
* when importing bgp-direct routes in resolve-nve mode,
- * this list maps unicast route nexthops to their bgp_infos
+ * this list maps unicast route nexthops to their bgp_path_infos
* in the unicast table
*/
struct skiplist *resolve_nve_nexthop;
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index fa8c038d6f..520cc141c0 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -616,18 +616,18 @@ void rfapiRibFree(struct rfapi_descriptor *rfd)
}
/*
- * Copies struct bgp_info to struct rfapi_info, except for rk fields and un
+ * Copies struct bgp_path_info to struct rfapi_info, except for rk fields and un
*/
-static void rfapiRibBi2Ri(struct bgp_info *bi, struct rfapi_info *ri,
+static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
uint32_t lifetime)
{
struct bgp_attr_encap_subtlv *pEncap;
- ri->cost = rfapiRfpCost(bi->attr);
+ ri->cost = rfapiRfpCost(bpi->attr);
ri->lifetime = lifetime;
/* This loop based on rfapiRouteInfo2NextHopEntry() */
- for (pEncap = bi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) {
+ for (pEncap = bpi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) {
struct bgp_tea_options *hop;
switch (pEncap->type) {
@@ -665,13 +665,13 @@ static void rfapiRibBi2Ri(struct bgp_info *bi, struct rfapi_info *ri,
}
rfapi_un_options_free(ri->un_options); /* maybe free old version */
- ri->un_options = rfapi_encap_tlv_to_un_option(bi->attr);
+ ri->un_options = rfapi_encap_tlv_to_un_option(bpi->attr);
/*
* VN options
*/
- if (bi->extra
- && decode_rd_type(bi->extra->vnc.import.rd.val)
+ if (bpi->extra
+ && decode_rd_type(bpi->extra->vnc.import.rd.val)
== RD_TYPE_VNC_ETH) {
/* ethernet route */
@@ -683,21 +683,21 @@ static void rfapiRibBi2Ri(struct bgp_info *bi, struct rfapi_info *ri,
vo->type = RFAPI_VN_OPTION_TYPE_L2ADDR;
- /* copy from RD already stored in bi, so we don't need it_node
+ /* copy from RD already stored in bpi, so we don't need it_node
*/
- memcpy(&vo->v.l2addr.macaddr, bi->extra->vnc.import.rd.val + 2,
+ memcpy(&vo->v.l2addr.macaddr, bpi->extra->vnc.import.rd.val + 2,
ETH_ALEN);
- (void)rfapiEcommunityGetLNI(bi->attr->ecommunity,
+ (void)rfapiEcommunityGetLNI(bpi->attr->ecommunity,
&vo->v.l2addr.logical_net_id);
- (void)rfapiEcommunityGetEthernetTag(bi->attr->ecommunity,
+ (void)rfapiEcommunityGetEthernetTag(bpi->attr->ecommunity,
&vo->v.l2addr.tag_id);
/* local_nve_id comes from RD */
- vo->v.l2addr.local_nve_id = bi->extra->vnc.import.rd.val[1];
+ vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
/* label comes from MP_REACH_NLRI label */
- vo->v.l2addr.label = decode_label(&bi->extra->label[0]);
+ vo->v.l2addr.label = decode_label(&bpi->extra->label[0]);
rfapi_vn_options_free(
ri->vn_options); /* maybe free old version */
@@ -707,8 +707,8 @@ static void rfapiRibBi2Ri(struct bgp_info *bi, struct rfapi_info *ri,
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
- ri->rk.aux_prefix = bi->extra->vnc.import.aux_prefix;
+ if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
+ ri->rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
}
}
@@ -733,7 +733,7 @@ static void rfapiRibBi2Ri(struct bgp_info *bi, struct rfapi_info *ri,
int rfapiRibPreloadBi(
struct agg_node *rfd_rib_node, /* NULL = don't preload or filter */
struct prefix *pfx_vn, struct prefix *pfx_un, uint32_t lifetime,
- struct bgp_info *bi)
+ struct bgp_path_info *bpi)
{
struct rfapi_descriptor *rfd;
struct skiplist *slRibPt = NULL;
@@ -751,13 +751,13 @@ int rfapiRibPreloadBi(
memset((void *)&rk, 0, sizeof(rk));
rk.vn = *pfx_vn;
- rk.rd = bi->extra->vnc.import.rd;
+ rk.rd = bpi->extra->vnc.import.rd;
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bi->extra->vnc.import.aux_prefix.family) {
- rk.aux_prefix = bi->extra->vnc.import.aux_prefix;
+ if (bpi->extra->vnc.import.aux_prefix.family) {
+ rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
}
/*
@@ -774,13 +774,13 @@ int rfapiRibPreloadBi(
/* found: update contents of existing route in RIB */
ori->un = *pfx_un;
- rfapiRibBi2Ri(bi, ori, lifetime);
+ rfapiRibBi2Ri(bpi, ori, lifetime);
} else {
/* not found: add new route to RIB */
ori = rfapi_info_new();
ori->rk = rk;
ori->un = *pfx_un;
- rfapiRibBi2Ri(bi, ori, lifetime);
+ rfapiRibBi2Ri(bpi, ori, lifetime);
if (!slRibPt) {
slRibPt = skiplist_new(0, rfapi_rib_key_cmp, NULL);
@@ -1590,7 +1590,7 @@ void rfapiRibUpdatePendingNode(
struct agg_node *it_node, uint32_t lifetime)
{
struct prefix *prefix;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct agg_node *pn;
afi_t afi;
uint32_t queued_flag;
@@ -1640,25 +1640,25 @@ void rfapiRibUpdatePendingNode(
}
/*
- * The BIs in the import table are already sorted by cost
+ * The BPIs in the import table are already sorted by cost
*/
- for (bi = it_node->info; bi; bi = bi->next) {
+ for (bpi = it_node->info; bpi; bpi = bpi->next) {
struct rfapi_info *ri;
struct prefix pfx_nh;
- if (!bi->attr) {
+ if (!bpi->attr) {
/* shouldn't happen */
/* TBD increment error stats counter */
continue;
}
- if (!bi->extra) {
+ if (!bpi->extra) {
/* shouldn't happen */
/* TBD increment error stats counter */
continue;
}
- rfapiNexthop2Prefix(bi->attr, &pfx_nh);
+ rfapiNexthop2Prefix(bpi->attr, &pfx_nh);
/*
* Omit route if nexthop is self
@@ -1675,15 +1675,15 @@ void rfapiRibUpdatePendingNode(
ri = rfapi_info_new();
ri->rk.vn = pfx_nh;
- ri->rk.rd = bi->extra->vnc.import.rd;
+ ri->rk.rd = bpi->extra->vnc.import.rd;
/*
* If there is an auxiliary IP address (L2 can have it), copy it
*/
- if (bi->extra->vnc.import.aux_prefix.family) {
- ri->rk.aux_prefix = bi->extra->vnc.import.aux_prefix;
+ if (bpi->extra->vnc.import.aux_prefix.family) {
+ ri->rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
}
- if (rfapiGetUnAddrOfVpnBi(bi, &ri->un)) {
+ if (rfapiGetUnAddrOfVpnBi(bpi, &ri->un)) {
rfapi_info_free(ri);
continue;
}
@@ -1711,7 +1711,7 @@ void rfapiRibUpdatePendingNode(
continue;
}
- rfapiRibBi2Ri(bi, ri, lifetime);
+ rfapiRibBi2Ri(bpi, ri, lifetime);
if (!pn->info) {
pn->info = list_new();
diff --git a/bgpd/rfapi/rfapi_rib.h b/bgpd/rfapi/rfapi_rib.h
index a8872295cd..38a6df9fbf 100644
--- a/bgpd/rfapi/rfapi_rib.h
+++ b/bgpd/rfapi/rfapi_rib.h
@@ -105,7 +105,7 @@ extern void rfapiRibUpdatePendingNodeSubtree(struct bgp *bgp,
extern int rfapiRibPreloadBi(struct agg_node *rfd_rib_node,
struct prefix *pfx_vn, struct prefix *pfx_un,
- uint32_t lifetime, struct bgp_info *bi);
+ uint32_t lifetime, struct bgp_path_info *bpi);
extern struct rfapi_next_hop_entry *
rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index 1af9479a6a..cdf281f240 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -394,7 +394,7 @@ int rfapiStream2Vty(void *stream, /* input */
/* called from bgpd/bgp_vty.c'route_vty_out() */
void rfapi_vty_out_vncinfo(struct vty *vty, struct prefix *p,
- struct bgp_info *bi, safi_t safi)
+ struct bgp_path_info *bpi, safi_t safi)
{
char *s;
uint32_t lifetime;
@@ -410,7 +410,7 @@ void rfapi_vty_out_vncinfo(struct vty *vty, struct prefix *p,
if (safi == SAFI_MPLS_VPN) {
struct prefix pfx_un;
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &pfx_un)) {
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_un)) {
char buf[BUFSIZ];
vty_out(vty, "UN=%s",
inet_ntop(pfx_un.family, pfx_un.u.val, buf,
@@ -418,27 +418,27 @@ void rfapi_vty_out_vncinfo(struct vty *vty, struct prefix *p,
}
}
- if (bi->attr && bi->attr->ecommunity) {
- s = ecommunity_ecom2str(bi->attr->ecommunity,
+ if (bpi->attr && bpi->attr->ecommunity) {
+ s = ecommunity_ecom2str(bpi->attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
vty_out(vty, " EC{%s}", s);
XFREE(MTYPE_ECOMMUNITY_STR, s);
}
- if (bi->extra != NULL) {
- if (bi->extra->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
+ if (bpi->extra != NULL) {
+ if (bpi->extra->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
vty_out(vty, " label=VRF2VRF");
else
vty_out(vty, " label=%u",
- decode_label(&bi->extra->label[0]));
+ decode_label(&bpi->extra->label[0]));
}
- if (!rfapiGetVncLifetime(bi->attr, &lifetime)) {
+ if (!rfapiGetVncLifetime(bpi->attr, &lifetime)) {
vty_out(vty, " life=%d", lifetime);
}
- vty_out(vty, " type=%s, subtype=%d", zebra_route_string(bi->type),
- bi->sub_type);
+ vty_out(vty, " type=%s, subtype=%d", zebra_route_string(bpi->type),
+ bpi->sub_type);
vty_out(vty, "%s", HVTYNL);
}
@@ -477,9 +477,9 @@ void rfapiPrintAttrPtrs(void *stream, struct attr *attr)
}
/*
- * Print BI in an Import Table
+ * Print BPI in an Import Table
*/
-void rfapiPrintBi(void *stream, struct bgp_info *bi)
+void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
{
char buf[BUFSIZ];
char *s;
@@ -503,12 +503,13 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- if (!bi)
+ if (!bpi)
return;
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) && bi->extra
- && bi->extra->vnc.import.timer) {
- struct thread *t = (struct thread *)bi->extra->vnc.import.timer;
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra
+ && bpi->extra->vnc.import.timer) {
+ struct thread *t =
+ (struct thread *)bpi->extra->vnc.import.timer;
r = snprintf(p, REMAIN, " [%4lu] ",
thread_timer_remain_second(t));
INCP;
@@ -518,14 +519,14 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
INCP;
}
- if (bi->extra) {
+ if (bpi->extra) {
/* TBD This valid only for SAFI_MPLS_VPN, but not for encap */
- if (decode_rd_type(bi->extra->vnc.import.rd.val)
+ if (decode_rd_type(bpi->extra->vnc.import.rd.val)
== RD_TYPE_VNC_ETH) {
has_macaddr = 1;
- memcpy(macaddr.octet, bi->extra->vnc.import.rd.val + 2,
+ memcpy(macaddr.octet, bpi->extra->vnc.import.rd.val + 2,
6);
- l2hid = bi->extra->vnc.import.rd.val[1];
+ l2hid = bpi->extra->vnc.import.rd.val[1];
}
}
@@ -537,24 +538,24 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
* RFP option sizes (they are opaque values)
* extended communities (RTs)
*/
- if (bi->attr) {
+ if (bpi->attr) {
uint32_t lifetime;
int printed_1st_gol = 0;
struct bgp_attr_encap_subtlv *pEncap;
struct prefix pfx_un;
- int af = BGP_MP_NEXTHOP_FAMILY(bi->attr->mp_nexthop_len);
+ int af = BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len);
/* Nexthop */
if (af == AF_INET) {
r = snprintf(p, REMAIN, "%s",
inet_ntop(AF_INET,
- &bi->attr->mp_nexthop_global_in,
+ &bpi->attr->mp_nexthop_global_in,
buf, BUFSIZ));
INCP;
} else if (af == AF_INET6) {
r = snprintf(p, REMAIN, "%s",
inet_ntop(AF_INET6,
- &bi->attr->mp_nexthop_global,
+ &bpi->attr->mp_nexthop_global,
buf, BUFSIZ));
INCP;
} else {
@@ -565,7 +566,7 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
/*
* VNC tunnel subtlv, if present, contains UN address
*/
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &pfx_un)) {
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &pfx_un)) {
r = snprintf(p, REMAIN, " un=%s",
inet_ntop(pfx_un.family, pfx_un.u.val, buf,
BUFSIZ));
@@ -573,7 +574,7 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
}
/* Lifetime */
- if (rfapiGetVncLifetime(bi->attr, &lifetime)) {
+ if (rfapiGetVncLifetime(bpi->attr, &lifetime)) {
r = snprintf(p, REMAIN, " nolife");
INCP;
} else {
@@ -585,7 +586,7 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
}
/* RFP option lengths */
- for (pEncap = bi->attr->vnc_subtlvs; pEncap;
+ for (pEncap = bpi->attr->vnc_subtlvs; pEncap;
pEncap = pEncap->next) {
if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION) {
@@ -604,8 +605,8 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
}
/* RT list */
- if (bi->attr->ecommunity) {
- s = ecommunity_ecom2str(bi->attr->ecommunity,
+ if (bpi->attr->ecommunity) {
+ s = ecommunity_ecom2str(bpi->attr->ecommunity,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
r = snprintf(p, REMAIN, " %s", s);
INCP;
@@ -613,13 +614,13 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
}
}
- r = snprintf(p, REMAIN, " bi@%p", bi);
+ r = snprintf(p, REMAIN, " bpi@%p", bpi);
INCP;
- r = snprintf(p, REMAIN, " p@%p", bi->peer);
+ r = snprintf(p, REMAIN, " p@%p", bpi->peer);
INCP;
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED)) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
r = snprintf(p, REMAIN, " HD=yes");
INCP;
} else {
@@ -627,15 +628,16 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
INCP;
}
- if (bi->attr) {
+ if (bpi->attr) {
- if (bi->attr->weight) {
- r = snprintf(p, REMAIN, " W=%d", bi->attr->weight);
+ if (bpi->attr->weight) {
+ r = snprintf(p, REMAIN, " W=%d", bpi->attr->weight);
INCP;
}
- if (bi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
- r = snprintf(p, REMAIN, " LP=%d", bi->attr->local_pref);
+ if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
+ r = snprintf(p, REMAIN, " LP=%d",
+ bpi->attr->local_pref);
INCP;
} else {
r = snprintf(p, REMAIN, " LP=unset");
@@ -643,8 +645,8 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
}
}
- r = snprintf(p, REMAIN, " %c:%u", zebra_route_char(bi->type),
- bi->sub_type);
+ r = snprintf(p, REMAIN, " %c:%u", zebra_route_char(bpi->type),
+ bpi->sub_type);
INCP;
fp(out, "%s%s", line, HVTYNL);
@@ -656,7 +658,7 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
HVTYNL);
}
- if (!rfapiGetL2o(bi->attr, &l2o_buf)) {
+ if (!rfapiGetL2o(bpi->attr, &l2o_buf)) {
fp(out,
" L2O ETH=%02x:%02x:%02x:%02x:%02x:%02x LBL=%d LNI=%d LHI=%hhu%s",
l2o_buf.macaddr.octet[0], l2o_buf.macaddr.octet[1],
@@ -665,12 +667,12 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
l2o_buf.label, l2o_buf.logical_net_id, l2o_buf.local_nve_id,
HVTYNL);
}
- if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
+ if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
const char *sp;
- sp = rfapi_ntop(bi->extra->vnc.import.aux_prefix.family,
- &bi->extra->vnc.import.aux_prefix.u.prefix, buf,
- BUFSIZ);
+ sp = rfapi_ntop(bpi->extra->vnc.import.aux_prefix.family,
+ &bpi->extra->vnc.import.aux_prefix.u.prefix,
+ buf, BUFSIZ);
buf[BUFSIZ - 1] = 0;
if (sp) {
fp(out, " IP: %s%s", sp, HVTYNL);
@@ -678,7 +680,7 @@ void rfapiPrintBi(void *stream, struct bgp_info *bi)
}
{
struct rfapi_un_option *uo =
- rfapi_encap_tlv_to_un_option(bi->attr);
+ rfapi_encap_tlv_to_un_option(bpi->attr);
if (uo) {
rfapi_print_tunneltype_option(stream, 8, &uo->v.tunnel);
rfapi_un_options_free(uo);
@@ -734,13 +736,13 @@ static void rfapiDebugPrintMonitorEncap(void *stream,
if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- fp(out, " Mon m=%p, next=%p, node=%p, bi=%p%s", m, m->next, m->node,
- m->bi, HVTYNL);
+ fp(out, " Mon m=%p, next=%p, node=%p, bpi=%p%s", m, m->next, m->node,
+ m->bpi, HVTYNL);
}
void rfapiShowItNode(void *stream, struct agg_node *rn)
{
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
char buf[BUFSIZ];
int (*fp)(void *, const char *, ...);
@@ -755,8 +757,8 @@ void rfapiShowItNode(void *stream, struct agg_node *rn)
rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
rn->p.prefixlen, rn, rn->lock, HVTYNL);
- for (bi = rn->info; bi; bi = bi->next) {
- rfapiPrintBi(stream, bi);
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ rfapiPrintBi(stream, bpi);
}
/* doesn't show montors */
@@ -779,7 +781,7 @@ void rfapiShowImportTable(void *stream, const char *label, struct agg_table *rt,
fp(out, "Import Table [%s]%s", label, HVTYNL);
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
if (rn->p.family == AF_ETHERNET) {
rfapiEthAddr2Str(&rn->p.u.prefix_eth, buf, BUFSIZ);
@@ -791,8 +793,8 @@ void rfapiShowImportTable(void *stream, const char *label, struct agg_table *rt,
rn->lock - 1, /* account for loop iterator locking */
HVTYNL);
- for (bi = rn->info; bi; bi = bi->next) {
- rfapiPrintBi(stream, bi);
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
+ rfapiPrintBi(stream, bpi);
}
if (isvpn) {
@@ -1008,7 +1010,7 @@ int rfapiShowVncQueries(void *stream, struct prefix *pfx_match)
}
static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
- struct agg_node *rn, struct bgp_info *bi)
+ struct agg_node *rn, struct bgp_path_info *bpi)
{
int (*fp)(void *, const char *, ...);
struct vty *vty;
@@ -1047,26 +1049,26 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
* UN addr
*/
buf_un[0] = 0;
- if (!rfapiGetUnAddrOfVpnBi(bi, &pfx_un)) {
+ if (!rfapiGetUnAddrOfVpnBi(bpi, &pfx_un)) {
snprintf(buf_un, BUFSIZ, "%s",
inet_ntop(pfx_un.family, &pfx_un.u.prefix, buf_ntop,
BUFSIZ));
}
- rfapiGetTunnelType(bi->attr, &tun_type);
+ rfapiGetTunnelType(bpi->attr, &tun_type);
/*
* VN addr
*/
buf_vn[0] = 0;
- rfapiNexthop2Prefix(bi->attr, &pfx_vn);
+ rfapiNexthop2Prefix(bpi->attr, &pfx_vn);
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
/* MPLS carries un in nrli next hop (same as vn for IP tunnels)
*/
snprintf(buf_un, BUFSIZ, "%s",
inet_ntop(pfx_vn.family, &pfx_vn.u.prefix, buf_ntop,
BUFSIZ));
- if (bi->extra) {
- uint32_t l = decode_label(&bi->extra->label[0]);
+ if (bpi->extra) {
+ uint32_t l = decode_label(&bpi->extra->label[0]);
snprintf(buf_vn, BUFSIZ, "Label: %d", l);
} else /* should never happen */
{
@@ -1085,10 +1087,10 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
* See rfapi_import.c'rfapiRouteInfo2NextHopEntry() for conversion
* back to cost.
*/
- if (bi->attr) {
+ if (bpi->attr) {
uint32_t local_pref;
- if (bi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
- local_pref = bi->attr->local_pref;
+ if (bpi->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
+ local_pref = bpi->attr->local_pref;
else
local_pref = 0;
cost = (local_pref > 255) ? 0 : 255 - local_pref;
@@ -1103,7 +1105,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
/* Lifetime */
/* NB rfapiGetVncLifetime sets infinite value when returning !0 */
- if (rfapiGetVncLifetime(bi->attr, &lifetime)
+ if (rfapiGetVncLifetime(bpi->attr, &lifetime)
|| (lifetime == RFAPI_INFINITE_LIFETIME)) {
fp(out, "%-10s ", "infinite");
@@ -1113,20 +1115,21 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
fp(out, "%-10s ", buf_lifetime);
}
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED) && bi->extra
- && bi->extra->vnc.import.timer) {
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra
+ && bpi->extra->vnc.import.timer) {
uint32_t remaining;
time_t age;
char buf_age[BUFSIZ];
- struct thread *t = (struct thread *)bi->extra->vnc.import.timer;
+ struct thread *t =
+ (struct thread *)bpi->extra->vnc.import.timer;
remaining = thread_timer_remain_second(t);
#if RFAPI_REGISTRATIONS_REPORT_AGE
/*
* Calculate when the timer started. Doing so here saves
- * us a timestamp field in "struct bgp_info".
+ * us a timestamp field in "struct bgp_path_info".
*
* See rfapi_import.c'rfapiBiStartWithdrawTimer() for the
* original calculation.
@@ -1140,12 +1143,12 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
fp(out, "%-10s ", buf_age);
- } else if (RFAPI_LOCAL_BI(bi)) {
+ } else if (RFAPI_LOCAL_BI(bpi)) {
char buf_age[BUFSIZ];
- if (bi->extra && bi->extra->vnc.import.create_time) {
- rfapiFormatAge(bi->extra->vnc.import.create_time,
+ if (bpi->extra && bpi->extra->vnc.import.create_time) {
+ rfapiFormatAge(bpi->extra->vnc.import.create_time,
buf_age, BUFSIZ);
} else {
buf_age[0] = '?';
@@ -1161,12 +1164,12 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
* print that on the next line
*/
- if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
+ if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
const char *sp;
sp = rfapi_ntop(
- bi->extra->vnc.import.aux_prefix.family,
- &bi->extra->vnc.import.aux_prefix.u.prefix,
+ bpi->extra->vnc.import.aux_prefix.family,
+ &bpi->extra->vnc.import.aux_prefix.u.prefix,
buf_ntop, BUFSIZ);
buf_ntop[BUFSIZ - 1] = 0;
@@ -1177,8 +1180,8 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
}
}
}
- if (tun_type != BGP_ENCAP_TYPE_MPLS && bi->extra) {
- uint32_t l = decode_label(&bi->extra->label[0]);
+ if (tun_type != BGP_ENCAP_TYPE_MPLS && bpi->extra) {
+ uint32_t l = decode_label(&bpi->extra->label[0]);
if (!MPLS_LABEL_IS_NULL(l)) {
fp(out, " Label: %d", l);
if (nlines == 1)
@@ -1222,7 +1225,7 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream,
for (rn = agg_route_top(it->imported_vpn[afi]); rn;
rn = agg_route_next(rn)) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
int count_only;
/* allow for wider or more narrow mask from user */
@@ -1232,30 +1235,32 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream,
else
count_only = 0;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (!show_local && RFAPI_LOCAL_BI(bi)) {
+ if (!show_local && RFAPI_LOCAL_BI(bpi)) {
/* local route from RFP */
continue;
}
- if (!show_remote && !RFAPI_LOCAL_BI(bi)) {
+ if (!show_remote && !RFAPI_LOCAL_BI(bpi)) {
/* remote route */
continue;
}
if (show_expiring
- && !CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ && !CHECK_FLAG(bpi->flags,
+ BGP_PATH_REMOVED))
continue;
if (!show_expiring
- && CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ && CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
- if (bi->type == ZEBRA_ROUTE_BGP_DIRECT
- || bi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT) {
+ if (bpi->type == ZEBRA_ROUTE_BGP_DIRECT
+ || bpi->type
+ == ZEBRA_ROUTE_BGP_DIRECT_EXT) {
if (!show_imported)
continue;
} else {
@@ -1277,7 +1282,7 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream,
type = "Holddown";
} else {
if (RFAPI_LOCAL_BI(
- bi)) {
+ bpi)) {
type = "Local";
} else {
type = "Remote";
@@ -1327,7 +1332,7 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream,
"Lifetime", agetype, HVTYNL);
}
printed += rfapiPrintRemoteRegBi(bgp, stream,
- rn, bi);
+ rn, bpi);
}
}
}
@@ -1535,7 +1540,7 @@ void rfapiPrintAdvertisedInfo(struct vty *vty, struct rfapi_descriptor *rfd,
{
afi_t afi; /* of the VN address */
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
uint8_t type = ZEBRA_ROUTE_BGP;
struct bgp *bgp;
int printed = 0;
@@ -1543,7 +1548,7 @@ void rfapiPrintAdvertisedInfo(struct vty *vty, struct rfapi_descriptor *rfd,
struct prefix_rd *prd;
/*
- * Find the bgp_info in the RIB corresponding to this
+ * Find the bgp_path in the RIB corresponding to this
* prefix and rfd
*/
@@ -1565,12 +1570,12 @@ void rfapiPrintAdvertisedInfo(struct vty *vty, struct rfapi_descriptor *rfd,
vty_out(vty, " bn=%p%s", bn, HVTYNL);
- for (bi = bn->info; bi; bi = bi->next) {
- if (bi->peer == rfd->peer && bi->type == type
- && bi->sub_type == BGP_ROUTE_RFP && bi->extra
- && bi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
+ if (bpi->peer == rfd->peer && bpi->type == type
+ && bpi->sub_type == BGP_ROUTE_RFP && bpi->extra
+ && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
- rfapiPrintBi(vty, bi);
+ rfapiPrintBi(vty, bpi);
printed = 1;
}
}
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index 6fcae17a8a..3d010e25f8 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -173,14 +173,14 @@ static int getce(struct bgp *bgp, struct attr *attr, struct prefix *pfx_ce)
void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
- struct bgp_info *bi)
+ struct bgp_path_info *bpi)
{
- struct attr *attr = bi->attr;
- struct peer *peer = bi->peer;
+ struct attr *attr = bpi->attr;
+ struct peer *peer = bpi->peer;
struct prefix *prefix = &rn->p;
afi_t afi = family2afi(prefix->family);
struct bgp_node *urn;
- struct bgp_info *ubi;
+ struct bgp_path_info *ubpi;
struct attr hattr;
struct attr *iattr;
struct prefix ce_nexthop;
@@ -193,10 +193,10 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
return;
}
- if ((bi->type != ZEBRA_ROUTE_BGP)
- || (bi->sub_type != BGP_ROUTE_NORMAL
- && bi->sub_type != BGP_ROUTE_RFP
- && bi->sub_type != BGP_ROUTE_STATIC)) {
+ if ((bpi->type != ZEBRA_ROUTE_BGP)
+ || (bpi->sub_type != BGP_ROUTE_NORMAL
+ && bpi->sub_type != BGP_ROUTE_RFP
+ && bpi->sub_type != BGP_ROUTE_STATIC)) {
vnc_zlog_debug_verbose(
"%s: wrong route type/sub_type for export, skipping",
@@ -256,17 +256,17 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
*/
urn = bgp_afi_node_get(bgp->rib[afi][SAFI_UNICAST], afi, SAFI_UNICAST,
prefix, NULL);
- for (ubi = urn->info; ubi; ubi = ubi->next) {
+ for (ubpi = urn->info; ubpi; ubpi = ubpi->next) {
struct prefix unicast_nexthop;
- if (CHECK_FLAG(ubi->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(ubpi->flags, BGP_PATH_REMOVED))
continue;
- rfapiUnicastNexthop2Prefix(afi, ubi->attr, &unicast_nexthop);
+ rfapiUnicastNexthop2Prefix(afi, ubpi->attr, &unicast_nexthop);
- if (ubi->type == ZEBRA_ROUTE_VNC_DIRECT
- && ubi->sub_type == BGP_ROUTE_REDISTRIBUTE
- && ubi->peer == peer
+ if (ubpi->type == ZEBRA_ROUTE_VNC_DIRECT
+ && ubpi->sub_type == BGP_ROUTE_REDISTRIBUTE
+ && ubpi->peer == peer
&& prefix_same(&unicast_nexthop, &ce_nexthop)) {
vnc_zlog_debug_verbose(
@@ -282,7 +282,7 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
*/
encap_attr_export_ce(&hattr, attr, &ce_nexthop);
if (bgp->rfapi_cfg->routemap_export_bgp) {
- struct bgp_info info;
+ struct bgp_path_info info;
route_map_result_t ret;
memset(&info, 0, sizeof(info));
@@ -328,10 +328,10 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
* "Withdrawing a Route" export process
*/
void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
- struct bgp_info *bi)
+ struct bgp_path_info *bpi)
{
afi_t afi = family2afi(rn->p.family);
- struct bgp_info *vbi;
+ struct bgp_path_info *vbpi;
struct prefix ce_nexthop;
if (!afi) {
@@ -364,7 +364,7 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
* This works only for IPv4 because IPv6 addresses are too big
* to fit in an extended community
*/
- if (getce(bgp, bi->attr, &ce_nexthop)) {
+ if (getce(bgp, bpi->attr, &ce_nexthop)) {
vnc_zlog_debug_verbose("%s: EC has no encoded CE, skipping",
__func__);
return;
@@ -376,13 +376,13 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
* route from the unicast RIB
*/
- for (vbi = rn->info; vbi; vbi = vbi->next) {
+ for (vbpi = rn->info; vbpi; vbpi = vbpi->next) {
struct prefix ce;
- if (bi == vbi)
+ if (bpi == vbpi)
continue;
- if (bi->peer != vbi->peer)
+ if (bpi->peer != vbpi->peer)
continue;
- if (getce(bgp, vbi->attr, &ce))
+ if (getce(bgp, vbpi->attr, &ce))
continue;
if (prefix_same(&ce, &ce_nexthop)) {
vnc_zlog_debug_verbose(
@@ -395,8 +395,8 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
/*
* withdraw the route
*/
- bgp_withdraw(bi->peer, &rn->p, 0, /* addpath_id */
- NULL, /* attr, ignored */
+ bgp_withdraw(bpi->peer, &rn->p, 0, /* addpath_id */
+ NULL, /* attr, ignored */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */
NULL, 0, NULL); /* tag not used for unicast */
@@ -405,7 +405,7 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
static void vnc_direct_bgp_vpn_enable_ce(struct bgp *bgp, afi_t afi)
{
struct agg_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *ri;
vnc_zlog_debug_verbose("%s: entry, afi=%d", __func__, afi);
@@ -480,8 +480,8 @@ static void vnc_direct_bgp_vpn_disable_ce(struct bgp *bgp, afi_t afi)
for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- struct bgp_info *ri;
- struct bgp_info *next;
+ struct bgp_path_info *ri;
+ struct bgp_path_info *next;
for (ri = rn->info, next = NULL; ri; ri = next) {
@@ -516,24 +516,24 @@ static void vnc_direct_bgp_vpn_disable_ce(struct bgp *bgp, afi_t afi)
static struct ecommunity *vnc_route_origin_ecom(struct agg_node *rn)
{
struct ecommunity *new;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
if (!rn->info)
return NULL;
new = ecommunity_new();
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
struct ecommunity_val roec;
- switch (BGP_MP_NEXTHOP_FAMILY(bi->attr->mp_nexthop_len)) {
+ switch (BGP_MP_NEXTHOP_FAMILY(bpi->attr->mp_nexthop_len)) {
case AF_INET:
memset(&roec, 0, sizeof(roec));
roec.val[0] = 0x01;
roec.val[1] = 0x03;
memcpy(roec.val + 2,
- &bi->attr->mp_nexthop_global_in.s_addr, 4);
+ &bpi->attr->mp_nexthop_global_in.s_addr, 4);
roec.val[6] = 0;
roec.val[7] = 0;
ecommunity_add_val(new, &roec);
@@ -996,7 +996,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
struct rfapi_descriptor *irfd = rfd;
struct attr hattr;
struct attr *iattr;
- struct bgp_info info;
+ struct bgp_path_info info;
if (rfapiRaddr2Qprefix(&irfd->vn_addr,
&nhp))
@@ -1165,7 +1165,7 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
afi_t afi, struct rfapi_descriptor *irfd)
{
struct prefix nhp;
- struct bgp_info info;
+ struct bgp_path_info info;
struct attr hattr;
struct attr *iattr;
@@ -1629,7 +1629,7 @@ void vnc_direct_bgp_vpn_disable(struct bgp *bgp, afi_t afi)
/*
* "Adding a Route" export process
- * TBD do we need to check bi->type and bi->sub_type here, or does
+ * TBD do we need to check bpi->type and bpi->sub_type here, or does
* caller do it?
*/
void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
@@ -1684,7 +1684,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
if (encap_attr_export(&hattr, attr, NULL, NULL))
return;
if (hc->routemap_export_bgp) {
- struct bgp_info info;
+ struct bgp_path_info info;
route_map_result_t ret;
memset(&info, 0, sizeof(info));
@@ -1753,7 +1753,7 @@ static int vncExportWithdrawTimer(struct thread *t)
/*
* "Withdrawing a Route" export process
- * TBD do we need to check bi->type and bi->sub_type here, or does
+ * TBD do we need to check bpi->type and bpi->sub_type here, or does
* caller do it?
*/
void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
@@ -1839,7 +1839,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
struct bgp_table *table;
struct bgp_node *rn;
- struct bgp_info *ri;
+ struct bgp_path_info *ri;
memset(&prd, 0, sizeof(prd));
prd.family = AF_UNSPEC;
@@ -1910,7 +1910,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
}
if (hc->routemap_export_bgp) {
- struct bgp_info info;
+ struct bgp_path_info info;
route_map_result_t ret;
memset(&info, 0, sizeof(info));
@@ -2001,8 +2001,8 @@ void vnc_direct_bgp_rh_vpn_disable(struct bgp *bgp, afi_t afi)
for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- struct bgp_info *ri;
- struct bgp_info *next;
+ struct bgp_path_info *ri;
+ struct bgp_path_info *next;
for (ri = rn->info, next = NULL; ri; ri = next) {
diff --git a/bgpd/rfapi/vnc_export_bgp_p.h b/bgpd/rfapi/vnc_export_bgp_p.h
index e074c3eaad..a1cb972740 100644
--- a/bgpd/rfapi/vnc_export_bgp_p.h
+++ b/bgpd/rfapi/vnc_export_bgp_p.h
@@ -30,10 +30,10 @@
#include "rfapi_private.h"
extern void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
- struct bgp_info *bi);
+ struct bgp_path_info *bpi);
extern void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
- struct bgp_info *bi);
+ struct bgp_path_info *bpi);
extern void vnc_direct_bgp_add_prefix(struct bgp *bgp,
struct rfapi_import_table *import_table,
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 8a286d1377..2f634f6f40 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -122,7 +122,7 @@ static int is_host_prefix(struct prefix *p)
struct prefix_bag {
struct prefix hpfx; /* ce address = unicast nexthop */
struct prefix upfx; /* unicast prefix */
- struct bgp_info *ubi; /* unicast route */
+ struct bgp_path_info *ubpi; /* unicast route */
};
static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
@@ -217,8 +217,8 @@ static void print_rhn_list(const char *tag1, const char *tag2)
prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
vnc_zlog_debug_verbose(
- "RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubi=%p",
- ++count, p, kbuf, ubuf, hbuf, pb->ubi);
+ "RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubpi=%p",
+ ++count, p, kbuf, ubuf, hbuf, pb->ubpi);
}
}
#endif
@@ -253,10 +253,10 @@ static void vnc_rhnck(char *tag)
afi = family2afi(pb->upfx.family);
- rfapiUnicastNexthop2Prefix(afi, pb->ubi->attr,
+ rfapiUnicastNexthop2Prefix(afi, pb->ubpi->attr,
&pfx_orig_nexthop);
- /* pb->hpfx, pb->ubi nexthop, pkey should all reflect the same
+ /* pb->hpfx, pb->ubpi nexthop, pkey should all reflect the same
* pfx */
assert(!vnc_prefix_cmp(&pb->hpfx, pkey));
if (vnc_prefix_cmp(&pb->hpfx, &pfx_orig_nexthop)) {
@@ -267,7 +267,7 @@ static void vnc_rhnck(char *tag)
prefix2str(&pb->hpfx, str_nve_pfx, sizeof(str_nve_pfx));
vnc_zlog_debug_verbose(
- "%s: %s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s",
+ "%s: %s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
__func__, tag, str_onh, str_nve_pfx);
assert(0);
}
@@ -300,7 +300,7 @@ static void vnc_rhnck(char *tag)
static int process_unicast_route(struct bgp *bgp, /* in */
afi_t afi, /* in */
struct prefix *prefix, /* in */
- struct bgp_info *info, /* in */
+ struct bgp_path_info *info, /* in */
struct ecommunity **ecom, /* OUT */
struct prefix *unicast_nexthop) /* OUT */
{
@@ -359,7 +359,7 @@ static int process_unicast_route(struct bgp *bgp, /* in */
bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */
if (rmap) {
- struct bgp_info info;
+ struct bgp_path_info info;
route_map_result_t ret;
memset(&info, 0, sizeof(info));
@@ -422,8 +422,8 @@ static int process_unicast_route(struct bgp *bgp, /* in */
static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
- struct bgp *bgp, afi_t afi, struct bgp_info *bi, /* VPN bi */
- struct prefix_rd *prd, /* RD */
+ struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */
+ struct prefix_rd *prd, /* RD */
struct prefix *prefix, /* unicast route prefix */
uint32_t *local_pref, /* NULL = no local_pref */
uint32_t *med, /* NULL = no med */
@@ -443,20 +443,22 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
vnc_zlog_debug_verbose("%s: entry", __func__);
- if (bi->type != ZEBRA_ROUTE_BGP && bi->type != ZEBRA_ROUTE_BGP_DIRECT) {
+ if (bpi->type != ZEBRA_ROUTE_BGP
+ && bpi->type != ZEBRA_ROUTE_BGP_DIRECT) {
return;
}
- if (bi->sub_type != BGP_ROUTE_NORMAL && bi->sub_type != BGP_ROUTE_STATIC
- && bi->sub_type != BGP_ROUTE_RFP) {
+ if (bpi->sub_type != BGP_ROUTE_NORMAL
+ && bpi->sub_type != BGP_ROUTE_STATIC
+ && bpi->sub_type != BGP_ROUTE_RFP) {
return;
}
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
return;
- vncHDResolveNve.peer = bi->peer;
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &un)) {
+ vncHDResolveNve.peer = bpi->peer;
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &un)) {
if (rfapiQprefix2Raddr(&un, &vncHDResolveNve.un_addr))
return;
} else {
@@ -465,26 +467,26 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
}
/* Use nexthop of VPN route as nexthop of constructed route */
- rfapiNexthop2Prefix(bi->attr, &nexthop);
+ rfapiNexthop2Prefix(bpi->attr, &nexthop);
rfapiQprefix2Raddr(&nexthop, &nexthop_h);
- if (rfapiGetVncLifetime(bi->attr, &lifetime)) {
+ if (rfapiGetVncLifetime(bpi->attr, &lifetime)) {
plifetime = NULL;
} else {
plifetime = &lifetime;
}
- if (bi->attr) {
- encaptlvs = bi->attr->vnc_subtlvs;
- if (bi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED
- && bi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) {
+ if (bpi->attr) {
+ encaptlvs = bpi->attr->vnc_subtlvs;
+ if (bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED
+ && bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) {
if (opt != NULL)
opt->next = &optary[cur_opt];
opt = &optary[cur_opt++];
memset(opt, 0, sizeof(struct rfapi_un_option));
opt->type = RFAPI_UN_OPTION_TYPE_TUNNELTYPE;
- opt->v.tunnel.type = bi->attr->encap_tunneltype;
- /* TBD parse bi->attr->extra->encap_subtlvs */
+ opt->v.tunnel.type = bpi->attr->encap_tunneltype;
+ /* TBD parse bpi->attr->extra->encap_subtlvs */
}
} else {
encaptlvs = NULL;
@@ -492,11 +494,11 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
struct ecommunity *new_ecom = ecommunity_dup(ecom);
- if (bi->attr && bi->attr->ecommunity)
- ecommunity_merge(new_ecom, bi->attr->ecommunity);
+ if (bpi->attr && bpi->attr->ecommunity)
+ ecommunity_merge(new_ecom, bpi->attr->ecommunity);
- if (bi->extra)
- label = decode_label(&bi->extra->label[0]);
+ if (bpi->extra)
+ label = decode_label(&bpi->extra->label[0]);
add_vnc_route(&vncHDResolveNve, bgp, SAFI_MPLS_VPN,
prefix, /* unicast route prefix */
@@ -516,12 +518,12 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
struct bgp_table *table_rd, /* per-rd VPN route table */
afi_t afi, struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
struct ecommunity *ecom, /* generated ecoms */
- uint32_t *local_pref, /* NULL = no local_pref */
- uint32_t *med, /* NULL = no med */
- struct prefix *ubi_nexthop) /* unicast nexthop */
+ uint32_t *local_pref, /* NULL = no local_pref */
+ uint32_t *med, /* NULL = no med */
+ struct prefix *ubpi_nexthop) /* unicast nexthop */
{
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
if (!table_rd)
return;
@@ -529,24 +531,25 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
{
char str_nh[PREFIX_STRLEN];
- prefix2str(ubi_nexthop, str_nh, sizeof(str_nh));
+ prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
- vnc_zlog_debug_verbose("%s: ubi_nexthop=%s", __func__, str_nh);
+ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
}
/* exact match */
- bn = bgp_node_lookup(table_rd, ubi_nexthop);
+ bn = bgp_node_lookup(table_rd, ubpi_nexthop);
if (!bn) {
vnc_zlog_debug_verbose(
- "%s: no match in RD's table for ubi_nexthop", __func__);
+ "%s: no match in RD's table for ubpi_nexthop",
+ __func__);
return;
}
- /* Iterate over bgp_info items at this node */
- for (bi = bn->info; bi; bi = bi->next) {
+ /* Iterate over bgp_path_info items at this node */
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
- bgp, afi, bi, /* VPN bi */
+ bgp, afi, bpi, /* VPN bpi */
prd, prefix, local_pref, med, ecom);
}
@@ -555,7 +558,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
static void vnc_import_bgp_add_route_mode_resolve_nve(
struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
- struct bgp_info *info) /* unicast info */
+ struct bgp_path_info *info) /* unicast info */
{
afi_t afi = family2afi(prefix->family);
@@ -657,10 +660,10 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
pb = XCALLOC(MTYPE_RFAPI_PREFIX_BAG, sizeof(struct prefix_bag));
pb->hpfx = pfx_unicast_nexthop;
- pb->ubi = info;
+ pb->ubpi = info;
pb->upfx = *prefix;
- bgp_info_lock(info); /* skiplist refers to it */
+ bgp_path_info_lock(info); /* skiplist refers to it */
skiplist_insert(bgp->rfapi->resolve_nve_nexthop, &pb->hpfx, pb);
/*
@@ -693,7 +696,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
struct prefix *prefix,
- struct bgp_info *info)
+ struct bgp_path_info *info)
{
afi_t afi = family2afi(prefix->family);
struct peer *peer = info->peer;
@@ -808,7 +811,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */
if (rmap) {
- struct bgp_info info;
+ struct bgp_path_info info;
route_map_result_t ret;
memset(&info, 0, sizeof(info));
@@ -881,7 +884,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
static void
vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
- struct bgp_info *info,
+ struct bgp_path_info *info,
struct rfapi_nve_group_cfg *rfg)
{
afi_t afi = family2afi(prefix->family);
@@ -1010,13 +1013,13 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */
if (rmap) {
- struct bgp_info binfo;
+ struct bgp_path_info path;
route_map_result_t ret;
- memset(&binfo, 0, sizeof(binfo));
- binfo.peer = peer;
- binfo.attr = &hattr;
- ret = route_map_apply(rmap, prefix, RMAP_BGP, &binfo);
+ memset(&path, 0, sizeof(path));
+ path.peer = peer;
+ path.attr = &hattr;
+ ret = route_map_apply(rmap, prefix, RMAP_BGP, &path);
if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr);
vnc_zlog_debug_verbose(
@@ -1085,7 +1088,7 @@ vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix,
static void vnc_import_bgp_del_route_mode_plain(struct bgp *bgp,
struct prefix *prefix,
- struct bgp_info *info)
+ struct bgp_path_info *info)
{
struct prefix_rd prd;
afi_t afi = family2afi(prefix->family);
@@ -1158,7 +1161,7 @@ static void vnc_import_bgp_del_route_mode_plain(struct bgp *bgp,
static void vnc_import_bgp_del_route_mode_nvegroup(struct bgp *bgp,
struct prefix *prefix,
- struct bgp_info *info)
+ struct bgp_path_info *info)
{
struct prefix_rd prd;
afi_t afi = family2afi(prefix->family);
@@ -1238,26 +1241,28 @@ static void vnc_import_bgp_del_route_mode_nvegroup(struct bgp *bgp,
}
static void vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
- struct bgp *bgp, afi_t afi, struct bgp_info *bi, /* VPN bi */
- struct prefix_rd *prd, /* RD */
+ struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */
+ struct prefix_rd *prd, /* RD */
struct prefix *prefix) /* unicast route prefix */
{
struct prefix un;
- if (bi->type != ZEBRA_ROUTE_BGP && bi->type != ZEBRA_ROUTE_BGP_DIRECT) {
+ if (bpi->type != ZEBRA_ROUTE_BGP
+ && bpi->type != ZEBRA_ROUTE_BGP_DIRECT) {
return;
}
- if (bi->sub_type != BGP_ROUTE_NORMAL && bi->sub_type != BGP_ROUTE_STATIC
- && bi->sub_type != BGP_ROUTE_RFP) {
+ if (bpi->sub_type != BGP_ROUTE_NORMAL
+ && bpi->sub_type != BGP_ROUTE_STATIC
+ && bpi->sub_type != BGP_ROUTE_RFP) {
return;
}
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
return;
- vncHDResolveNve.peer = bi->peer;
- if (!rfapiGetVncTunnelUnAddr(bi->attr, &un)) {
+ vncHDResolveNve.peer = bpi->peer;
+ if (!rfapiGetVncTunnelUnAddr(bpi->attr, &un)) {
if (rfapiQprefix2Raddr(&un, &vncHDResolveNve.un_addr))
return;
} else {
@@ -1275,10 +1280,10 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
struct prefix_rd *prd,
struct bgp_table *table_rd, /* per-rd VPN route table */
afi_t afi, struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
- struct prefix *ubi_nexthop) /* unicast bi's nexthop */
+ struct prefix *ubpi_nexthop) /* unicast bpi's nexthop */
{
struct bgp_node *bn;
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
if (!table_rd)
return;
@@ -1286,35 +1291,36 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
{
char str_nh[PREFIX_STRLEN];
- prefix2str(ubi_nexthop, str_nh, sizeof(str_nh));
- vnc_zlog_debug_verbose("%s: ubi_nexthop=%s", __func__, str_nh);
+ prefix2str(ubpi_nexthop, str_nh, sizeof(str_nh));
+ vnc_zlog_debug_verbose("%s: ubpi_nexthop=%s", __func__, str_nh);
}
/* exact match */
- bn = bgp_node_lookup(table_rd, ubi_nexthop);
+ bn = bgp_node_lookup(table_rd, ubpi_nexthop);
if (!bn) {
vnc_zlog_debug_verbose(
- "%s: no match in RD's table for ubi_nexthop", __func__);
+ "%s: no match in RD's table for ubpi_nexthop",
+ __func__);
return;
}
- /* Iterate over bgp_info items at this node */
- for (bi = bn->info; bi; bi = bi->next) {
+ /* Iterate over bgp_path_info items at this node */
+ for (bpi = bn->info; bpi; bpi = bpi->next) {
vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
- bgp, afi, bi, /* VPN bi */
- prd, /* VPN RD */
- prefix); /* unicast route prefix */
+ bgp, afi, bpi, /* VPN bpi */
+ prd, /* VPN RD */
+ prefix); /* unicast route prefix */
}
bgp_unlock_node(bn);
}
-static void vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp,
- afi_t afi,
- struct prefix *prefix,
- struct bgp_info *info)
+static void
+vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi,
+ struct prefix *prefix,
+ struct bgp_path_info *info)
{
struct ecommunity *ecom = NULL;
struct prefix pfx_unicast_nexthop = {0}; /* happy valgrind */
@@ -1352,9 +1358,9 @@ static void vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp,
rc = skiplist_first_value(sl, &pfx_unicast_nexthop, (void *)&pb,
&cursor);
while (!rc) {
- if (pb->ubi == info) {
+ if (pb->ubpi == info) {
skiplist_delete(sl, &pfx_unicast_nexthop, pb);
- bgp_info_unlock(info);
+ bgp_path_info_unlock(info);
break;
}
rc = skiplist_next_value(sl, &pfx_unicast_nexthop, (void *)&pb,
@@ -1391,14 +1397,14 @@ static void vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp,
***********************************************************************/
/*
- * Should be called whan a bi is added to VPN RIB. This function
+ * Should be called whan a bpi is added to VPN RIB. This function
* will check if it is a host route and return immediately if not.
*/
void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */
- struct bgp_info *bi) /* new VPN host route */
+ struct bgp_path_info *bpi) /* new VPN host route */
{
afi_t afi = family2afi(prefix->family);
struct skiplist *sl = NULL;
@@ -1469,11 +1475,11 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
prefix2str(&pb->upfx, ubuf, sizeof(ubuf));
vnc_zlog_debug_any(
- "%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubi=%p",
- __func__, cursor, ubuf, hbuf, pb->ubi);
+ "%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubpi=%p",
+ __func__, cursor, ubuf, hbuf, pb->ubpi);
}
- if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubi, &ecom,
+ if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) {
vnc_zlog_debug_verbose(
@@ -1481,13 +1487,13 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
__func__);
continue;
}
- local_pref = calc_local_pref(pb->ubi->attr, pb->ubi->peer);
+ local_pref = calc_local_pref(pb->ubpi->attr, pb->ubpi->peer);
- if (pb->ubi->attr
- && (pb->ubi->attr->flag
+ if (pb->ubpi->attr
+ && (pb->ubpi->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))) {
- med = &pb->ubi->attr->med;
+ med = &pb->ubpi->attr->med;
}
/*
@@ -1502,13 +1508,13 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
prefix2str(prefix, str_nve_pfx, sizeof(str_nve_pfx));
vnc_zlog_debug_verbose(
- "%s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s",
+ "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
__func__, str_unh, str_nve_pfx);
assert(0);
}
vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
- bgp, afi, bi, /* VPN bi */
+ bgp, afi, bpi, /* VPN bpi */
prd, &pb->upfx, /* unicast prefix */
&local_pref, med, ecom);
@@ -1538,7 +1544,7 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */
- struct bgp_info *bi) /* old VPN host route */
+ struct bgp_path_info *bpi) /* old VPN host route */
{
afi_t afi = family2afi(prefix->family);
struct skiplist *sl = NULL;
@@ -1605,7 +1611,7 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
memset(&pfx_unicast_nexthop, 0,
sizeof(struct prefix)); /* keep valgrind happy */
- if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubi, &ecom,
+ if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) {
vnc_zlog_debug_verbose(
@@ -1626,13 +1632,13 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
prefix2str(prefix, str_nve_pfx, sizeof(str_nve_pfx));
vnc_zlog_debug_verbose(
- "%s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s",
+ "%s: FATAL: resolve_nve_nexthop list item bpi nexthop %s != nve pfx %s",
__func__, str_unh, str_nve_pfx);
assert(0);
}
vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
- bgp, afi, bi, prd, &pb->upfx);
+ bgp, afi, bpi, prd, &pb->upfx);
if (ecom)
ecommunity_free(&ecom);
@@ -1648,19 +1654,19 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
#define DEBUG_IS_USABLE_INTERIOR 1
-static int is_usable_interior_route(struct bgp_info *bi_interior)
+static int is_usable_interior_route(struct bgp_path_info *bpi_interior)
{
- if (!VALID_INTERIOR_TYPE(bi_interior->type)) {
+ if (!VALID_INTERIOR_TYPE(bpi_interior->type)) {
#if DEBUG_IS_USABLE_INTERIOR
vnc_zlog_debug_verbose(
"%s: NO: type %d is not valid interior type", __func__,
- bi_interior->type);
+ bpi_interior->type);
#endif
return 0;
}
- if (!CHECK_FLAG(bi_interior->flags, BGP_INFO_VALID)) {
+ if (!CHECK_FLAG(bpi_interior->flags, BGP_PATH_VALID)) {
#if DEBUG_IS_USABLE_INTERIOR
- vnc_zlog_debug_verbose("%s: NO: BGP_INFO_VALID not set",
+ vnc_zlog_debug_verbose("%s: NO: BGP_PATH_VALID not set",
__func__);
#endif
return 0;
@@ -1680,7 +1686,7 @@ static int is_usable_interior_route(struct bgp_info *bi_interior)
static void vnc_import_bgp_exterior_add_route_it(
struct bgp *bgp, /* exterior instance, we hope */
struct prefix *prefix, /* unicast prefix */
- struct bgp_info *info, /* unicast info */
+ struct bgp_path_info *info, /* unicast info */
struct rfapi_import_table *it_only) /* NULL, or limit to this IT */
{
struct rfapi *h;
@@ -1740,7 +1746,7 @@ static void vnc_import_bgp_exterior_add_route_it(
struct agg_table *table;
struct agg_node *rn;
struct agg_node *par;
- struct bgp_info *bi_interior;
+ struct bgp_path_info *bpi_interior;
int have_usable_route;
vnc_zlog_debug_verbose("%s: doing it %p", __func__, it);
@@ -1760,18 +1766,18 @@ static void vnc_import_bgp_exterior_add_route_it(
vnc_zlog_debug_verbose("%s: it %p trying rn %p",
__func__, it, rn);
- for (bi_interior = rn->info; bi_interior;
- bi_interior = bi_interior->next) {
+ for (bpi_interior = rn->info; bpi_interior;
+ bpi_interior = bpi_interior->next) {
struct prefix_rd *prd;
struct attr new_attr;
uint32_t label = 0;
- if (!is_usable_interior_route(bi_interior))
+ if (!is_usable_interior_route(bpi_interior))
continue;
vnc_zlog_debug_verbose(
- "%s: usable: bi_interior %p", __func__,
- bi_interior);
+ "%s: usable: bpi_interior %p", __func__,
+ bpi_interior);
/*
* have a legitimate route to exterior's nexthop
@@ -1781,17 +1787,17 @@ static void vnc_import_bgp_exterior_add_route_it(
*/
have_usable_route = 1;
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import
.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi_interior->attr);
+ bgp_attr_dup(&new_attr, bpi_interior->attr);
if (info->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
new_attr.local_pref =
@@ -1802,7 +1808,7 @@ static void vnc_import_bgp_exterior_add_route_it(
rfapiBgpInfoFilteredImportVPN(
it, FIF_ACTION_UPDATE,
- bi_interior->peer, NULL, /* rfd */
+ bpi_interior->peer, NULL, /* rfd */
prefix, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
@@ -1829,7 +1835,7 @@ static void vnc_import_bgp_exterior_add_route_it(
RFAPI_MONITOR_EXTERIOR(rn)->source,
info, pfx_mon)) {
- bgp_info_lock(info);
+ bgp_path_info_lock(info);
}
}
par = agg_node_parent(rn);
@@ -1847,16 +1853,16 @@ static void vnc_import_bgp_exterior_add_route_it(
if (!skiplist_insert(it->monitor_exterior_orphans, info,
pfx_mon)) {
- bgp_info_lock(info);
+ bgp_path_info_lock(info);
}
}
}
}
void vnc_import_bgp_exterior_add_route(
- struct bgp *bgp, /* exterior instance, we hope */
- struct prefix *prefix, /* unicast prefix */
- struct bgp_info *info) /* unicast info */
+ struct bgp *bgp, /* exterior instance, we hope */
+ struct prefix *prefix, /* unicast prefix */
+ struct bgp_path_info *info) /* unicast info */
{
vnc_import_bgp_exterior_add_route_it(bgp, prefix, info, NULL);
}
@@ -1872,7 +1878,7 @@ void vnc_import_bgp_exterior_add_route(
*/
void vnc_import_bgp_exterior_del_route(
struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
- struct bgp_info *info) /* unicast info */
+ struct bgp_path_info *info) /* unicast info */
{
struct rfapi *h;
struct rfapi_cfg *hc;
@@ -1931,7 +1937,7 @@ void vnc_import_bgp_exterior_del_route(
struct agg_table *table;
struct agg_node *rn;
struct agg_node *par;
- struct bgp_info *bi_interior;
+ struct bgp_path_info *bpi_interior;
int have_usable_route;
table = it->imported_vpn[afi];
@@ -1940,12 +1946,12 @@ void vnc_import_bgp_exterior_del_route(
have_usable_route = 0;
(!have_usable_route) && rn;) {
- for (bi_interior = rn->info; bi_interior;
- bi_interior = bi_interior->next) {
+ for (bpi_interior = rn->info; bpi_interior;
+ bpi_interior = bpi_interior->next) {
struct prefix_rd *prd;
uint32_t label = 0;
- if (!is_usable_interior_route(bi_interior))
+ if (!is_usable_interior_route(bpi_interior))
continue;
/*
@@ -1956,19 +1962,19 @@ void vnc_import_bgp_exterior_del_route(
*/
have_usable_route = 1;
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import
.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_KILL, bi_interior->peer,
+ it, FIF_ACTION_KILL, bpi_interior->peer,
NULL, /* rfd */
prefix, NULL, afi, prd,
- bi_interior->attr,
+ bpi_interior->attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
@@ -1986,7 +1992,8 @@ void vnc_import_bgp_exterior_del_route(
->source,
info, NULL)) {
- bgp_info_unlock(info);
+ bgp_path_info_unlock(
+ info);
agg_unlock_node(
rn); /* sl entry
*/
@@ -2023,7 +2030,7 @@ void vnc_import_bgp_exterior_del_route(
if (!skiplist_delete(it->monitor_exterior_orphans, info,
NULL)) {
- bgp_info_unlock(info);
+ bgp_path_info_unlock(info);
}
}
}
@@ -2038,12 +2045,12 @@ void vnc_import_bgp_exterior_del_route(
*/
void vnc_import_bgp_exterior_add_route_interior(
struct bgp *bgp, struct rfapi_import_table *it,
- struct agg_node *rn_interior, /* VPN IT node */
- struct bgp_info *bi_interior) /* VPN IT route */
+ struct agg_node *rn_interior, /* VPN IT node */
+ struct bgp_path_info *bpi_interior) /* VPN IT route */
{
afi_t afi = family2afi(rn_interior->p.family);
struct agg_node *par;
- struct bgp_info *bi_exterior;
+ struct bgp_path_info *bpi_exterior;
struct prefix *pfx_exterior; /* exterior pfx */
void *cursor;
int rc;
@@ -2051,7 +2058,7 @@ void vnc_import_bgp_exterior_add_route_interior(
vnc_zlog_debug_verbose("%s: entry", __func__);
- if (!is_usable_interior_route(bi_interior)) {
+ if (!is_usable_interior_route(bpi_interior)) {
vnc_zlog_debug_verbose(
"%s: not usable interior route, skipping", __func__);
return;
@@ -2075,8 +2082,8 @@ void vnc_import_bgp_exterior_add_route_interior(
char str_pfx[PREFIX_STRLEN];
prefix2str(&rn_interior->p, str_pfx, sizeof(str_pfx));
- vnc_zlog_debug_verbose("%s: interior prefix=%s, bi type=%d",
- __func__, str_pfx, bi_interior->type);
+ vnc_zlog_debug_verbose("%s: interior prefix=%s, bpi type=%d",
+ __func__, str_pfx, bpi_interior->type);
}
if (RFAPI_HAS_MONITOR_EXTERIOR(rn_interior)) {
@@ -2095,12 +2102,12 @@ void vnc_import_bgp_exterior_add_route_interior(
cursor = NULL;
for (rc = skiplist_next(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior,
+ (void **)&bpi_exterior, (void **)&pfx_exterior,
&cursor);
!rc; rc = skiplist_next(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior,
- &cursor)) {
+ (void **)&bpi_exterior,
+ (void **)&pfx_exterior, &cursor)) {
struct prefix_rd *prd;
struct attr new_attr;
@@ -2109,30 +2116,30 @@ void vnc_import_bgp_exterior_add_route_interior(
++count; /* debugging */
- assert(bi_exterior);
+ assert(bpi_exterior);
assert(pfx_exterior);
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import.rd;
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi_interior->attr);
- if (bi_exterior
- && (bi_exterior->attr->flag
+ bgp_attr_dup(&new_attr, bpi_interior->attr);
+ if (bpi_exterior
+ && (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
new_attr.local_pref =
- bi_exterior->attr->local_pref;
+ bpi_exterior->attr->local_pref;
new_attr.flag |=
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
}
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_UPDATE, bi_interior->peer,
+ it, FIF_ACTION_UPDATE, bpi_interior->peer,
NULL, /* rfd */
pfx_exterior, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
@@ -2176,11 +2183,11 @@ void vnc_import_bgp_exterior_add_route_interior(
/* check monitors at par for possible pulldown */
cursor = NULL;
for (rc = skiplist_next(RFAPI_MONITOR_EXTERIOR(par)->source,
- (void **)&bi_exterior,
+ (void **)&bpi_exterior,
(void **)&pfx_exterior, &cursor);
!rc;
rc = skiplist_next(RFAPI_MONITOR_EXTERIOR(par)->source,
- (void **)&bi_exterior,
+ (void **)&bpi_exterior,
(void **)&pfx_exterior, &cursor)) {
struct prefix pfx_nexthop;
@@ -2189,12 +2196,12 @@ void vnc_import_bgp_exterior_add_route_interior(
sizeof(struct prefix)); /* keep valgrind happy */
/* check original nexthop for prefix match */
- rfapiUnicastNexthop2Prefix(afi, bi_exterior->attr,
+ rfapiUnicastNexthop2Prefix(afi, bpi_exterior->attr,
&pfx_nexthop);
if (prefix_match(&rn_interior->p, &pfx_nexthop)) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
struct prefix_rd *prd;
struct attr new_attr;
uint32_t label = 0;
@@ -2217,27 +2224,28 @@ void vnc_import_bgp_exterior_add_route_interior(
skiplist_insert(
RFAPI_MONITOR_EXTERIOR(rn_interior)
->source,
- bi_exterior, pfx_mon);
+ bpi_exterior, pfx_mon);
agg_lock_node(rn_interior);
/*
* Delete constructed exterior routes based on
* parent routes.
*/
- for (bi = par->info; bi; bi = bi->next) {
+ for (bpi = par->info; bpi; bpi = bpi->next) {
- if (bi->extra) {
- prd = &bi->extra->vnc.import.rd;
+ if (bpi->extra) {
+ prd = &bpi->extra->vnc.import
+ .rd;
label = decode_label(
- &bi->extra->label[0]);
+ &bpi->extra->label[0]);
} else
prd = NULL;
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_KILL, bi->peer,
+ it, FIF_ACTION_KILL, bpi->peer,
NULL, /* rfd */
pfx_exterior, NULL, afi, prd,
- bi->attr,
+ bpi->attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
}
@@ -2247,29 +2255,29 @@ void vnc_import_bgp_exterior_add_route_interior(
* Add constructed exterior routes based on
* the new interior route at longer prefix.
*/
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import
.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi_interior->attr);
- if (bi_exterior
- && (bi_exterior->attr->flag
+ bgp_attr_dup(&new_attr, bpi_interior->attr);
+ if (bpi_exterior
+ && (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
new_attr.local_pref =
- bi_exterior->attr->local_pref;
+ bpi_exterior->attr->local_pref;
new_attr.flag |= ATTR_FLAG_BIT(
BGP_ATTR_LOCAL_PREF);
}
rfapiBgpInfoFilteredImportVPN(
it, FIF_ACTION_UPDATE,
- bi_interior->peer, NULL, /* rfd */
+ bpi_interior->peer, NULL, /* rfd */
pfx_exterior, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
BGP_ROUTE_REDISTRIBUTE, &label);
@@ -2284,14 +2292,14 @@ void vnc_import_bgp_exterior_add_route_interior(
cursor = NULL;
for (rc = skiplist_next(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, NULL, &cursor);
+ (void **)&bpi_exterior, NULL, &cursor);
!rc; rc = skiplist_next(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, NULL, &cursor)) {
+ (void **)&bpi_exterior, NULL, &cursor)) {
skiplist_delete(RFAPI_MONITOR_EXTERIOR(par)->source,
- bi_exterior, NULL);
+ bpi_exterior, NULL);
agg_unlock_node(par); /* sl entry */
}
if (skiplist_empty(RFAPI_MONITOR_EXTERIOR(par)->source)) {
@@ -2309,10 +2317,10 @@ void vnc_import_bgp_exterior_add_route_interior(
cursor = NULL;
list_adopted = NULL;
for (rc = skiplist_next(it->monitor_exterior_orphans,
- (void **)&bi_exterior, (void **)&pfx_exterior,
+ (void **)&bpi_exterior, (void **)&pfx_exterior,
&cursor);
!rc; rc = skiplist_next(it->monitor_exterior_orphans,
- (void **)&bi_exterior,
+ (void **)&bpi_exterior,
(void **)&pfx_exterior, &cursor)) {
struct prefix pfx_nexthop;
@@ -2332,7 +2340,7 @@ void vnc_import_bgp_exterior_add_route_interior(
}
/* check original nexthop for prefix match */
- rfapiUnicastNexthop2Prefix(afi, bi_exterior->attr,
+ rfapiUnicastNexthop2Prefix(afi, bpi_exterior->attr,
&pfx_nexthop);
if (prefix_match(&rn_interior->p, &pfx_nexthop)) {
@@ -2358,38 +2366,38 @@ void vnc_import_bgp_exterior_add_route_interior(
}
skiplist_insert(
RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- bi_exterior, pfx_mon);
+ bpi_exterior, pfx_mon);
agg_lock_node(rn_interior); /* sl entry */
if (!list_adopted) {
list_adopted = list_new();
}
- listnode_add(list_adopted, bi_exterior);
+ listnode_add(list_adopted, bpi_exterior);
/*
* Add constructed exterior routes based on the
* new interior route at the longer prefix.
*/
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import.rd;
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import.rd;
label = decode_label(
- &bi_interior->extra->label[0]);
+ &bpi_interior->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi_interior->attr);
- if (bi_exterior
- && (bi_exterior->attr->flag
+ bgp_attr_dup(&new_attr, bpi_interior->attr);
+ if (bpi_exterior
+ && (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
new_attr.local_pref =
- bi_exterior->attr->local_pref;
+ bpi_exterior->attr->local_pref;
new_attr.flag |=
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF);
}
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_UPDATE, bi_interior->peer,
+ it, FIF_ACTION_UPDATE, bpi_interior->peer,
NULL, /* rfd */
pfx_exterior, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
@@ -2398,11 +2406,12 @@ void vnc_import_bgp_exterior_add_route_interior(
}
if (list_adopted) {
struct listnode *node;
- struct agg_node *an_bi_exterior;
+ struct agg_node *an_bpi_exterior;
- for (ALL_LIST_ELEMENTS_RO(list_adopted, node, an_bi_exterior)) {
+ for (ALL_LIST_ELEMENTS_RO(list_adopted, node,
+ an_bpi_exterior)) {
skiplist_delete(it->monitor_exterior_orphans,
- an_bi_exterior, NULL);
+ an_bpi_exterior, NULL);
}
list_delete(&list_adopted);
}
@@ -2411,7 +2420,7 @@ void vnc_import_bgp_exterior_add_route_interior(
/*
* This function should be called after an interior VPN route
* has been deleted from an import_table.
- * bi_interior must still be valid, but it must already be detached
+ * bpi_interior must still be valid, but it must already be detached
* from its route node and the route node's valid_interior_count
* must already be decremented.
*
@@ -2420,20 +2429,20 @@ void vnc_import_bgp_exterior_add_route_interior(
*/
void vnc_import_bgp_exterior_del_route_interior(
struct bgp *bgp, struct rfapi_import_table *it,
- struct agg_node *rn_interior, /* VPN IT node */
- struct bgp_info *bi_interior) /* VPN IT route */
+ struct agg_node *rn_interior, /* VPN IT node */
+ struct bgp_path_info *bpi_interior) /* VPN IT route */
{
afi_t afi = family2afi(rn_interior->p.family);
struct agg_node *par;
- struct bgp_info *bi_exterior;
+ struct bgp_path_info *bpi_exterior;
struct prefix *pfx_exterior; /* exterior pfx */
void *cursor;
int rc;
- if (!VALID_INTERIOR_TYPE(bi_interior->type)) {
+ if (!VALID_INTERIOR_TYPE(bpi_interior->type)) {
vnc_zlog_debug_verbose(
"%s: type %d not valid interior type, skipping",
- __func__, bi_interior->type);
+ __func__, bpi_interior->type);
return;
}
@@ -2462,8 +2471,8 @@ void vnc_import_bgp_exterior_del_route_interior(
prefix2str(&rn_interior->p, str_pfx, sizeof(str_pfx));
- vnc_zlog_debug_verbose("%s: interior prefix=%s, bi type=%d",
- __func__, str_pfx, bi_interior->type);
+ vnc_zlog_debug_verbose("%s: interior prefix=%s, bpi type=%d",
+ __func__, str_pfx, bpi_interior->type);
}
/*
@@ -2471,25 +2480,25 @@ void vnc_import_bgp_exterior_del_route_interior(
*/
cursor = NULL;
for (rc = skiplist_next(RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior,
+ (void **)&bpi_exterior, (void **)&pfx_exterior,
&cursor);
!rc;
rc = skiplist_next(RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior,
+ (void **)&bpi_exterior, (void **)&pfx_exterior,
&cursor)) {
struct prefix_rd *prd;
uint32_t label = 0;
- if (bi_interior->extra) {
- prd = &bi_interior->extra->vnc.import.rd;
- label = decode_label(&bi_interior->extra->label[0]);
+ if (bpi_interior->extra) {
+ prd = &bpi_interior->extra->vnc.import.rd;
+ label = decode_label(&bpi_interior->extra->label[0]);
} else
prd = NULL;
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_KILL, bi_interior->peer, NULL, /* rfd */
- pfx_exterior, NULL, afi, prd, bi_interior->attr,
+ it, FIF_ACTION_KILL, bpi_interior->peer, NULL, /* rfd */
+ pfx_exterior, NULL, afi, prd, bpi_interior->attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT, BGP_ROUTE_REDISTRIBUTE,
&label);
}
@@ -2524,7 +2533,8 @@ void vnc_import_bgp_exterior_del_route_interior(
* We will use and delete every element of the source skiplist
*/
while (!skiplist_first(RFAPI_MONITOR_EXTERIOR(rn_interior)->source,
- (void **)&bi_exterior, (void **)&pfx_exterior)) {
+ (void **)&bpi_exterior,
+ (void **)&pfx_exterior)) {
struct prefix *pfx_mon = prefix_new();
@@ -2532,7 +2542,7 @@ void vnc_import_bgp_exterior_del_route_interior(
if (par) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
/*
* Add monitor to parent node
@@ -2545,40 +2555,40 @@ void vnc_import_bgp_exterior_del_route_interior(
agg_lock_node(par); /* sl */
}
skiplist_insert(RFAPI_MONITOR_EXTERIOR(par)->source,
- bi_exterior, pfx_mon);
+ bpi_exterior, pfx_mon);
agg_lock_node(par); /* sl entry */
/* Add constructed exterior routes based on parent */
- for (bi = par->info; bi; bi = bi->next) {
+ for (bpi = par->info; bpi; bpi = bpi->next) {
struct prefix_rd *prd;
struct attr new_attr;
uint32_t label = 0;
- if (bi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT)
+ if (bpi->type == ZEBRA_ROUTE_BGP_DIRECT_EXT)
continue;
- if (bi->extra) {
- prd = &bi->extra->vnc.import.rd;
+ if (bpi->extra) {
+ prd = &bpi->extra->vnc.import.rd;
label = decode_label(
- &bi->extra->label[0]);
+ &bpi->extra->label[0]);
} else
prd = NULL;
/* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr));
- bgp_attr_dup(&new_attr, bi->attr);
- if (bi_exterior
- && (bi_exterior->attr->flag
+ bgp_attr_dup(&new_attr, bpi->attr);
+ if (bpi_exterior
+ && (bpi_exterior->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))) {
new_attr.local_pref =
- bi_exterior->attr->local_pref;
+ bpi_exterior->attr->local_pref;
new_attr.flag |= ATTR_FLAG_BIT(
BGP_ATTR_LOCAL_PREF);
}
rfapiBgpInfoFilteredImportVPN(
- it, FIF_ACTION_UPDATE, bi->peer,
+ it, FIF_ACTION_UPDATE, bpi->peer,
NULL, /* rfd */
pfx_exterior, NULL, afi, prd, &new_attr,
ZEBRA_ROUTE_BGP_DIRECT_EXT,
@@ -2593,7 +2603,7 @@ void vnc_import_bgp_exterior_del_route_interior(
* in orphan list to await future route.
*/
skiplist_insert(it->monitor_exterior_orphans,
- bi_exterior, pfx_mon);
+ bpi_exterior, pfx_mon);
}
skiplist_delete_first(
@@ -2612,7 +2622,7 @@ void vnc_import_bgp_exterior_del_route_interior(
***********************************************************************/
void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
- struct bgp_info *info)
+ struct bgp_path_info *info)
{
afi_t afi = family2afi(prefix->family);
@@ -2681,7 +2691,7 @@ void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
* "Withdrawing a Route" import process
*/
void vnc_import_bgp_del_route(struct bgp *bgp, struct prefix *prefix,
- struct bgp_info *info) /* unicast info */
+ struct bgp_path_info *info) /* unicast info */
{
afi_t afi = family2afi(prefix->family);
@@ -2768,14 +2778,14 @@ void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi)
for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
- vnc_import_bgp_add_route(bgp, &rn->p, bi);
+ vnc_import_bgp_add_route(bgp, &rn->p, bpi);
}
}
vnc_zlog_debug_verbose(
@@ -2808,15 +2818,15 @@ void vnc_import_bgp_exterior_redist_enable(struct bgp *bgp, afi_t afi)
for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_add_route(bgp_exterior, &rn->p,
- bi);
+ bpi);
}
}
vnc_zlog_debug_verbose(
@@ -2853,15 +2863,15 @@ void vnc_import_bgp_exterior_redist_enable_it(
for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]); rn;
rn = bgp_route_next(rn)) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_add_route_it(
- bgp_exterior, &rn->p, bi, it_only);
+ bgp_exterior, &rn->p, bpi, it_only);
}
}
}
@@ -2896,30 +2906,31 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
for (rn2 = bgp_table_top(rn1->info); rn2;
rn2 = bgp_route_next(rn2)) {
- struct bgp_info *bi;
- struct bgp_info *nextbi;
+ struct bgp_path_info *bpi;
+ struct bgp_path_info *nextbpi;
- for (bi = rn2->info; bi; bi = nextbi) {
+ for (bpi = rn2->info; bpi; bpi = nextbpi) {
- nextbi = bi->next;
+ nextbpi = bpi->next;
- if (bi->type
+ if (bpi->type
== ZEBRA_ROUTE_BGP_DIRECT) {
struct rfapi_descriptor *rfd;
- vncHDBgpDirect.peer = bi->peer;
+ vncHDBgpDirect.peer = bpi->peer;
- assert(bi->extra);
+ assert(bpi->extra);
- rfd = bi->extra->vnc.export
+ rfd = bpi->extra->vnc.export
.rfapi_handle;
vnc_zlog_debug_verbose(
- "%s: deleting bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p [passing rfd=%p]",
- __func__, bi, bi->peer,
- bi->type, bi->sub_type,
- (bi->extra
- ? bi->extra
+ "%s: deleting bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p [passing rfd=%p]",
+ __func__, bpi,
+ bpi->peer, bpi->type,
+ bpi->sub_type,
+ (bpi->extra
+ ? bpi->extra
->vnc
.export
.rfapi_handle
@@ -2928,12 +2939,13 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
del_vnc_route(
- rfd, bi->peer, bgp,
+ rfd, bpi->peer, bgp,
SAFI_MPLS_VPN, &rn2->p,
(struct prefix_rd *)&rn1
->p,
- bi->type, bi->sub_type,
- NULL, 1); /* kill */
+ bpi->type,
+ bpi->sub_type, NULL,
+ 1); /* kill */
vncHDBgpDirect.peer = NULL;
}
@@ -2944,12 +2956,12 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
/* Clear RHN list */
if (bgp->rfapi->resolve_nve_nexthop) {
struct prefix_bag *pb;
- struct bgp_info *info;
+ struct bgp_path_info *info;
while (!skiplist_first(bgp->rfapi->resolve_nve_nexthop, NULL,
(void *)&pb)) {
- info = pb->ubi;
+ info = pb->ubpi;
skiplist_delete_first(bgp->rfapi->resolve_nve_nexthop);
- bgp_info_unlock(info);
+ bgp_path_info_unlock(info);
}
}
@@ -2985,15 +2997,15 @@ void vnc_import_bgp_exterior_redist_disable(struct bgp *bgp, afi_t afi)
for (rn = bgp_table_top(bgp_exterior->rib[afi][SAFI_UNICAST]);
rn; rn = bgp_route_next(rn)) {
- struct bgp_info *bi;
+ struct bgp_path_info *bpi;
- for (bi = rn->info; bi; bi = bi->next) {
+ for (bpi = rn->info; bpi; bpi = bpi->next) {
- if (CHECK_FLAG(bi->flags, BGP_INFO_REMOVED))
+ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED))
continue;
vnc_import_bgp_exterior_del_route(bgp_exterior,
- &rn->p, bi);
+ &rn->p, bpi);
}
}
#if DEBUG_RHN_LIST
diff --git a/bgpd/rfapi/vnc_import_bgp.h b/bgpd/rfapi/vnc_import_bgp.h
index 7c15939904..3db6f4010a 100644
--- a/bgpd/rfapi/vnc_import_bgp.h
+++ b/bgpd/rfapi/vnc_import_bgp.h
@@ -35,10 +35,10 @@ extern uint32_t calc_local_pref(struct attr *attr, struct peer *peer);
extern int vnc_prefix_cmp(void *pfx1, void *pfx2);
extern void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
- struct bgp_info *info);
+ struct bgp_path_info *info);
extern void vnc_import_bgp_del_route(struct bgp *bgp, struct prefix *prefix,
- struct bgp_info *info);
+ struct bgp_path_info *info);
extern void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi);
@@ -50,25 +50,24 @@ extern void vnc_import_bgp_exterior_redist_disable(struct bgp *bgp, afi_t afi);
extern void vnc_import_bgp_exterior_add_route(
- struct bgp *bgp, /* exterior instance, we hope */
- struct prefix *prefix, /* unicast prefix */
- struct bgp_info *info); /* unicast info */
+ struct bgp *bgp, /* exterior instance, we hope */
+ struct prefix *prefix, /* unicast prefix */
+ struct bgp_path_info *info); /* unicast info */
-extern void
-vnc_import_bgp_exterior_del_route(struct bgp *bgp,
- struct prefix *prefix, /* unicast prefix */
- struct bgp_info *info); /* unicast info */
+extern void vnc_import_bgp_exterior_del_route(
+ struct bgp *bgp, struct prefix *prefix, /* unicast prefix */
+ struct bgp_path_info *info); /* unicast info */
extern void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */
- struct bgp_info *bi); /* new VPN host route */
+ struct bgp_path_info *bpi); /* new VPN host route */
extern void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */
- struct bgp_info *bi); /* old VPN host route */
+ struct bgp_path_info *bpi); /* old VPN host route */
#endif /* _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_ */
diff --git a/bgpd/rfapi/vnc_import_bgp_p.h b/bgpd/rfapi/vnc_import_bgp_p.h
index a6fcae926d..c6627dfba4 100644
--- a/bgpd/rfapi/vnc_import_bgp_p.h
+++ b/bgpd/rfapi/vnc_import_bgp_p.h
@@ -29,13 +29,13 @@
extern void vnc_import_bgp_exterior_add_route_interior(
struct bgp *bgp, struct rfapi_import_table *it,
- struct agg_node *rn_interior, /* VPN IT node */
- struct bgp_info *bi_interior); /* VPN IT route */
+ struct agg_node *rn_interior, /* VPN IT node */
+ struct bgp_path_info *bpi_interior); /* VPN IT route */
extern void vnc_import_bgp_exterior_del_route_interior(
struct bgp *bgp, struct rfapi_import_table *it,
- struct agg_node *rn_interior, /* VPN IT node */
- struct bgp_info *bi_interior); /* VPN IT route */
+ struct agg_node *rn_interior, /* VPN IT node */
+ struct bgp_path_info *bpi_interior); /* VPN IT route */
extern void
vnc_import_bgp_exterior_redist_enable_it(struct bgp *bgp, afi_t afi,
diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c
index fdd200ac37..a57f908f62 100644
--- a/bgpd/rfapi/vnc_zebra.c
+++ b/bgpd/rfapi/vnc_zebra.c
@@ -316,7 +316,7 @@ static void vnc_redistribute_withdraw(struct bgp *bgp, afi_t afi, uint8_t type)
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
- struct bgp_info *ri;
+ struct bgp_path_info *ri;
for (ri = rn->info; ri; ri = ri->next) {
if (ri->type
diff --git a/bgpd/subdir.am b/bgpd/subdir.am
index 4291388567..83f55939ce 100644
--- a/bgpd/subdir.am
+++ b/bgpd/subdir.am
@@ -208,6 +208,8 @@ bgpd_bgpd_rpki_la_CFLAGS = $(WERROR) $(RTRLIB_CFLAGS)
bgpd_bgpd_rpki_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
bgpd_bgpd_rpki_la_LIBADD = $(RTRLIB_LIBS)
+bgpd/bgp_evpn_vty_clippy.c: $(CLIPPY_DEPS)
+bgpd/bgp_evpn_vty.$(OBJEXT): bgpd/bgp_evpn_vty_clippy.c
bgpd/bgp_vty_clippy.c: $(CLIPPY_DEPS)
bgpd/bgp_vty.$(OBJEXT): bgpd/bgp_vty_clippy.c
bgpd/bgp_route_clippy.c: $(CLIPPY_DEPS)
diff --git a/doc/developer/building-frr-for-centos6.rst b/doc/developer/building-frr-for-centos6.rst
index 5f10f3715d..f085598e08 100644
--- a/doc/developer/building-frr-for-centos6.rst
+++ b/doc/developer/building-frr-for-centos6.rst
@@ -44,8 +44,7 @@ Add packages:
sudo yum install git autoconf automake libtool make gawk \
readline-devel texinfo net-snmp-devel groff pkgconfig \
- json-c-devel pam-devel flex epel-release perl-XML-LibXML \
- c-ares-devel
+ json-c-devel pam-devel flex epel-release c-ares-devel
Install newer version of bison (CentOS 6 package source is too old) from CentOS
7:
@@ -154,19 +153,12 @@ an example.)
--disable-pimd \
--enable-snmp=agentx \
--enable-multipath=64 \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
- --enable-rtadv \
--disable-exampledir \
- --enable-watchfrr \
--disable-ldpd \
--enable-fpm \
- --enable-nhrpd \
- --enable-eigrpd \
- --enable-babeld \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion \
SPHINXBUILD=sphinx-build2.7
diff --git a/doc/developer/building-frr-for-centos7.rst b/doc/developer/building-frr-for-centos7.rst
index b157f540ab..ca62b1239a 100644
--- a/doc/developer/building-frr-for-centos7.rst
+++ b/doc/developer/building-frr-for-centos7.rst
@@ -22,7 +22,7 @@ Add packages:
sudo yum install git autoconf automake libtool make gawk \
readline-devel texinfo net-snmp-devel groff pkgconfig \
json-c-devel pam-devel bison flex pytest c-ares-devel \
- perl-XML-LibXML python-devel systemd-devel python-sphinx
+ python-devel systemd-devel python-sphinx
Get FRR, compile it and install it (from Git)
---------------------------------------------
@@ -59,23 +59,15 @@ an example.)
--libexecdir=/usr/lib/frr \
--localstatedir=/var/run/frr \
--with-moduledir=/usr/lib/frr/modules \
- --enable-pimd \
--enable-snmp=agentx \
--enable-multipath=64 \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
- --enable-rtadv \
--enable-systemd=yes \
--disable-exampledir \
- --enable-watchfrr \
--disable-ldpd \
--enable-fpm \
- --enable-nhrpd \
- --enable-eigrpd \
- --enable-babeld \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
make
diff --git a/doc/developer/building-frr-for-debian8.rst b/doc/developer/building-frr-for-debian8.rst
index d1e65a472d..2b591bf1aa 100644
--- a/doc/developer/building-frr-for-debian8.rst
+++ b/doc/developer/building-frr-for-debian8.rst
@@ -58,21 +58,13 @@ an example.)
--localstatedir=/var/run/frr \
--sbindir=/usr/lib/frr \
--sysconfdir=/etc/frr \
- --enable-vtysh \
- --enable-isisd \
- --enable-pimd \
- --enable-watchfrr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
- --enable-ldpd \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
make
diff --git a/doc/developer/building-frr-for-debian9.rst b/doc/developer/building-frr-for-debian9.rst
index 7dad9a7bd4..db22e4f44e 100644
--- a/doc/developer/building-frr-for-debian9.rst
+++ b/doc/developer/building-frr-for-debian9.rst
@@ -39,28 +39,19 @@ an example.)
git clone https://github.com/frrouting/frr.git frr
cd frr
- git checkout stable/3.0
./bootstrap.sh
./configure \
--enable-exampledir=/usr/share/doc/frr/examples/ \
--localstatedir=/var/opt/frr \
--sbindir=/usr/lib/frr \
--sysconfdir=/etc/frr \
- --enable-vtysh \
- --enable-isisd \
- --enable-pimd \
- --enable-watchfrr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
- --enable-ldpd \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
make
diff --git a/doc/developer/building-frr-for-fedora24.rst b/doc/developer/building-frr-for-fedora24.rst
index 669cc4ae2f..86e0c8d991 100644
--- a/doc/developer/building-frr-for-fedora24.rst
+++ b/doc/developer/building-frr-for-fedora24.rst
@@ -14,8 +14,8 @@ Add packages:
sudo dnf install git autoconf automake libtool make gawk \
readline-devel texinfo net-snmp-devel groff pkgconfig \
- json-c-devel pam-devel perl-XML-LibXML pytest bison flex \
- c-ares-devel python3-devel python3-sphinx
+ json-c-devel pam-devel pytest bison flex c-ares-devel \
+ python3-devel python3-sphinx
Get FRR, compile it and install it (from Git)
---------------------------------------------
@@ -52,22 +52,13 @@ an example.)
--libexecdir=/usr/lib/frr \
--localstatedir=/var/run/frr \
--with-moduledir=/usr/lib/frr/modules \
- --enable-pimd \
--enable-snmp=agentx \
--enable-multipath=64 \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
- --enable-rtadv \
--disable-exampledir \
- --enable-watchfrr \
- --enable-ldpd \
--enable-fpm \
- --enable-nhrpd \
- --enable-eigrpd \
- --enable-babeld \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
make
diff --git a/doc/developer/building-frr-for-freebsd10.rst b/doc/developer/building-frr-for-freebsd10.rst
index 95f09e8c22..e9bc9adb16 100644
--- a/doc/developer/building-frr-for-freebsd10.rst
+++ b/doc/developer/building-frr-for-freebsd10.rst
@@ -59,15 +59,12 @@ an example)
--enable-pkgsrcrcdir=/usr/pkg/share/examples/rc.d \
--localstatedir=/var/run/frr \
--prefix=/usr/local \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
diff --git a/doc/developer/building-frr-for-freebsd11.rst b/doc/developer/building-frr-for-freebsd11.rst
index ce5941440c..f578f085ae 100644
--- a/doc/developer/building-frr-for-freebsd11.rst
+++ b/doc/developer/building-frr-for-freebsd11.rst
@@ -64,15 +64,12 @@ an example)
--enable-pkgsrcrcdir=/usr/pkg/share/examples/rc.d \
--localstatedir=/var/run/frr \
--prefix=/usr/local \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
diff --git a/doc/developer/building-frr-for-freebsd9.rst b/doc/developer/building-frr-for-freebsd9.rst
index 4f859d3510..0efa2ebd80 100644
--- a/doc/developer/building-frr-for-freebsd9.rst
+++ b/doc/developer/building-frr-for-freebsd9.rst
@@ -72,15 +72,12 @@ an example)
--enable-pkgsrcrcdir=/usr/pkg/share/examples/rc.d \
--localstatedir=/var/run/frr \
--prefix=/usr/local \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
diff --git a/doc/developer/building-frr-for-netbsd6.rst b/doc/developer/building-frr-for-netbsd6.rst
index ca0845d0d0..2023a4fafa 100644
--- a/doc/developer/building-frr-for-netbsd6.rst
+++ b/doc/developer/building-frr-for-netbsd6.rst
@@ -72,15 +72,12 @@ an example)
--enable-exampledir=/usr/pkg/share/examples/frr \
--enable-pkgsrcrcdir=/usr/pkg/share/examples/rc.d \
--localstatedir=/var/run/frr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
diff --git a/doc/developer/building-frr-for-netbsd7.rst b/doc/developer/building-frr-for-netbsd7.rst
index 86242ef965..6b31e68e8a 100644
--- a/doc/developer/building-frr-for-netbsd7.rst
+++ b/doc/developer/building-frr-for-netbsd7.rst
@@ -63,15 +63,12 @@ an example)
--enable-exampledir=/usr/pkg/share/examples/frr \
--enable-pkgsrcrcdir=/usr/pkg/share/examples/rc.d \
--localstatedir=/var/run/frr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
diff --git a/doc/developer/building-frr-for-omnios.rst b/doc/developer/building-frr-for-omnios.rst
index 03f3845de8..45df049d39 100644
--- a/doc/developer/building-frr-for-omnios.rst
+++ b/doc/developer/building-frr-for-omnios.rst
@@ -119,17 +119,12 @@ an example)
--enable-exampledir=/usr/share/doc/frr/examples/ \
--localstatedir=/var/run/frr \
--sbindir=/usr/lib/frr \
- --enable-vtysh \
- --enable-watchfrr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
diff --git a/doc/developer/building-frr-for-openbsd6.rst b/doc/developer/building-frr-for-openbsd6.rst
index 46db25a025..c68c18eb7c 100644
--- a/doc/developer/building-frr-for-openbsd6.rst
+++ b/doc/developer/building-frr-for-openbsd6.rst
@@ -57,16 +57,12 @@ an example)
./configure \
--sysconfdir=/etc/frr \
--localstatedir=/var/frr \
- --enable-pimd \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=_frr \
--enable-group=_frr \
--enable-vty-group=_frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
diff --git a/doc/developer/building-frr-for-ubuntu1204.rst b/doc/developer/building-frr-for-ubuntu1204.rst
index 459d411ebc..1afd66c459 100644
--- a/doc/developer/building-frr-for-ubuntu1204.rst
+++ b/doc/developer/building-frr-for-ubuntu1204.rst
@@ -98,17 +98,12 @@ an example.)
--localstatedir=/var/run/frr \
--sbindir=/usr/lib/frr \
--sysconfdir=/etc/frr \
- --enable-pimd \
- --enable-watchfrr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
diff --git a/doc/developer/building-frr-for-ubuntu1404.rst b/doc/developer/building-frr-for-ubuntu1404.rst
index 681cc30a3b..98dbb79002 100644
--- a/doc/developer/building-frr-for-ubuntu1404.rst
+++ b/doc/developer/building-frr-for-ubuntu1404.rst
@@ -52,19 +52,13 @@ an example.)
--localstatedir=/var/run/frr \
--sbindir=/usr/lib/frr \
--sysconfdir=/etc/frr \
- --enable-pimd \
- --enable-watchfrr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
- --enable-ldpd \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
make
diff --git a/doc/developer/building-frr-for-ubuntu1604.rst b/doc/developer/building-frr-for-ubuntu1604.rst
index 1fa0ede201..b2eec49236 100644
--- a/doc/developer/building-frr-for-ubuntu1604.rst
+++ b/doc/developer/building-frr-for-ubuntu1604.rst
@@ -53,17 +53,12 @@ an example.)
--localstatedir=/var/run/frr \
--sbindir=/usr/lib/frr \
--sysconfdir=/etc/frr \
- --enable-pimd \
- --enable-watchfrr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--enable-systemd=yes \
--with-pkg-git-version \
diff --git a/doc/developer/building-frr-for-ubuntu1804.rst b/doc/developer/building-frr-for-ubuntu1804.rst
index 75b31a41f9..f5cf651e22 100644
--- a/doc/developer/building-frr-for-ubuntu1804.rst
+++ b/doc/developer/building-frr-for-ubuntu1804.rst
@@ -78,17 +78,12 @@ Options below are provided as an example.
--localstatedir=/var/run/frr \
--sbindir=/usr/lib/frr \
--sysconfdir=/etc/frr \
- --enable-pimd \
- --enable-watchfrr \
- --enable-ospfclient=yes \
- --enable-ospfapi=yes \
--enable-multipath=64 \
--enable-user=frr \
--enable-group=frr \
--enable-vty-group=frrvty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
- --enable-rtadv \
--enable-fpm \
--enable-systemd=yes \
--with-pkg-git-version \
diff --git a/doc/developer/next-hop-tracking.rst b/doc/developer/next-hop-tracking.rst
index 8a6a4ccb33..e6484102a8 100644
--- a/doc/developer/next-hop-tracking.rst
+++ b/doc/developer/next-hop-tracking.rst
@@ -241,7 +241,7 @@ Legend:
/\ struct bgp_node: a BGP destination/route/prefix
\/
- [ ] struct bgp_info: a BGP path (e.g. route received from a peer)
+ [ ] struct bgp_path_info: a BGP path (e.g. route received from a peer)
_
(_) struct bgp_nexthop_cache: a BGP nexthop
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index f10883b984..e859afca90 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -1171,7 +1171,7 @@ is 4 octet long. The following format is used to define the community value.
``0xFFFF0006`` ``65535:6``.
Assigned and intented only for use with routers supporting the
Long-lived Graceful Restart Capability as described in
- :rfc:`draft-uttaro-idr-bgp-persistence`.
+ [Draft-IETF-uttaro-idr-bgp-persistence]_.
Routers recieving routes with this community may (depending on
implementation) choose allow to reject or modify routes on the
presence or absence of this community.
@@ -1181,7 +1181,7 @@ is 4 octet long. The following format is used to define the community value.
``0xFFFF0007`` ``65535:7``.
Assigned and intented only for use with routers supporting the
Long-lived Graceful Restart Capability as described in
- :rfc:`draft-uttaro-idr-bgp-persistence`.
+ [Draft-IETF-uttaro-idr-bgp-persistence]_.
Routers recieving routes with this community may (depending on
implementation) choose allow to reject or modify routes on the
presence or absence of this community.
@@ -1189,10 +1189,10 @@ is 4 octet long. The following format is used to define the community value.
``accept-own-nexthop``
``accept-own-nexthop`` represents well-known communities value
``accept-own-nexthop`` ``0xFFFF0008`` ``65535:8``.
- :rfc:`draft-agrewal-idr-accept-own-nexthop` describes
+ [Draft-IETF-agrewal-idr-accept-own-nexthop]_ describes
how to tag and label VPN routes to be able to send traffic between VRFs
via an internal layer 2 domain on the same PE device. Refer to
- :rfc:`draft-agrewal-idr-accept-own-nexthop` for full details.
+ [Draft-IETF-agrewal-idr-accept-own-nexthop]_ for full details.
``blackhole``
``blackhole`` represents well-known communities value ``BLACKHOLE``
@@ -1230,6 +1230,9 @@ is 4 octet long. The following format is used to define the community value.
When the communities attribute is received duplicate community values in the
attribute are ignored and value is sorted in numerical order.
+.. [Draft-IETF-uttaro-idr-bgp-persistence] <https://tools.ietf.org/id/draft-uttaro-idr-bgp-persistence-04.txt>
+.. [Draft-IETF-agrewal-idr-accept-own-nexthop] <https://tools.ietf.org/id/draft-agrewal-idr-accept-own-nexthop-00.txt>
+
.. _bgp-community-lists:
Community Lists
diff --git a/doc/user/routemap.rst b/doc/user/routemap.rst
index 57b4875e23..42a8250ae0 100644
--- a/doc/user/routemap.rst
+++ b/doc/user/routemap.rst
@@ -105,10 +105,10 @@ Route Map Match Command
Matches the specified `access_list`
-.. index:: match ip address PREFIX-LIST
-.. clicmd:: match ip address PREFIX-LIST
+.. index:: match ip address prefix-list PREFIX_LIST
+.. clicmd:: match ip address prefix-list PREFIX_LIST
- Matches the specified `prefix-list`
+ Matches the specified `PREFIX_LIST`
.. index:: match ip address prefix-len 0-32
.. clicmd:: match ip address prefix-len 0-32
@@ -120,10 +120,10 @@ Route Map Match Command
Matches the specified `access_list`
-.. index:: match ipv6 address PREFIX-LIST
-.. clicmd:: match ipv6 address PREFIX-LIST
+.. index:: match ipv6 address prefix-list PREFIX_LIST
+.. clicmd:: match ipv6 address prefix-list PREFIX_LIST
- Matches the specified `prefix-list`
+ Matches the specified `PREFIX_LIST`
.. index:: match ipv6 address prefix-len 0-128
.. clicmd:: match ipv6 address prefix-len 0-128
diff --git a/gdb/lib.txt b/gdb/lib.txt
index b703808b48..60a004e1e1 100644
--- a/gdb/lib.txt
+++ b/gdb/lib.txt
@@ -16,7 +16,7 @@
# ...
# (gdb) cont
# Breakpoint 3, bgp_write_packet (peer=0x7fa885199080) at bgp_packet.c:614
-# 614 if (CHECK_FLAG (adv->binfo->peer->cap,PEER_CAP_RESTART_RCV)
+# 614 if (CHECK_FLAG (adv->path->peer->cap,PEER_CAP_RESTART_RCV)
# (gdb) dump_prefix4 &adv->rn->p
# IPv4:10.1.1.0/24
# (gdb) dump_prefix &adv->rn->p
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index a41d6ff815..9013c7c19b 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -122,6 +122,8 @@ struct isis_adjacency *isis_adj_lookup_snpa(const uint8_t *ssnpa,
return NULL;
}
+DEFINE_HOOK(isis_adj_state_change_hook, (struct isis_adjacency *adj), (adj))
+
void isis_delete_adj(void *arg)
{
struct isis_adjacency *adj = arg;
@@ -130,6 +132,10 @@ void isis_delete_adj(void *arg)
return;
THREAD_TIMER_OFF(adj->t_expire);
+ if (adj->adj_state != ISIS_ADJ_DOWN) {
+ adj->adj_state = ISIS_ADJ_DOWN;
+ hook_call(isis_adj_state_change_hook, adj);
+ }
/* remove from SPF trees */
spftree_area_adj_del(adj->circuit->area, adj);
@@ -256,8 +262,7 @@ void isis_adj_state_change(struct isis_adjacency *adj,
continue;
if (new_state == ISIS_ADJ_UP) {
circuit->upadjcount[level - 1]++;
- isis_event_adjacency_state_change(adj,
- new_state);
+ hook_call(isis_adj_state_change_hook, adj);
/* update counter & timers for debugging
* purposes */
adj->last_flap = time(NULL);
@@ -270,8 +275,7 @@ void isis_adj_state_change(struct isis_adjacency *adj,
if (circuit->upadjcount[level - 1] == 0)
isis_tx_queue_clean(circuit->tx_queue);
- isis_event_adjacency_state_change(adj,
- new_state);
+ hook_call(isis_adj_state_change_hook, adj);
del = true;
}
@@ -299,8 +303,7 @@ void isis_adj_state_change(struct isis_adjacency *adj,
continue;
if (new_state == ISIS_ADJ_UP) {
circuit->upadjcount[level - 1]++;
- isis_event_adjacency_state_change(adj,
- new_state);
+ hook_call(isis_adj_state_change_hook, adj);
if (adj->sys_type == ISIS_SYSTYPE_UNKNOWN)
send_hello(circuit, level);
@@ -326,8 +329,7 @@ void isis_adj_state_change(struct isis_adjacency *adj,
if (circuit->upadjcount[level - 1] == 0)
isis_tx_queue_clean(circuit->tx_queue);
- isis_event_adjacency_state_change(adj,
- new_state);
+ hook_call(isis_adj_state_change_hook, adj);
del = true;
}
}
diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h
index 2f39378c00..2a4cb6e614 100644
--- a/isisd/isis_adjacency.h
+++ b/isisd/isis_adjacency.h
@@ -68,6 +68,8 @@ struct isis_dis_record {
time_t last_dis_change; /* timestamp for last dis change */
};
+struct bfd_session;
+
struct isis_adjacency {
uint8_t snpa[ETH_ALEN]; /* NeighbourSNPAAddress */
uint8_t sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */
@@ -100,6 +102,7 @@ struct isis_adjacency {
struct isis_circuit *circuit; /* back pointer */
uint16_t *mt_set; /* Topologies this adjacency is valid for */
unsigned int mt_count; /* Number of entries in mt_set */
+ struct bfd_session *bfd_session;
};
struct isis_threeway_adj;
@@ -114,6 +117,7 @@ void isis_delete_adj(void *adj);
void isis_adj_process_threeway(struct isis_adjacency *adj,
struct isis_threeway_adj *tw_adj,
enum isis_adj_usage adj_usage);
+DECLARE_HOOK(isis_adj_state_change_hook, (struct isis_adjacency *adj), (adj))
void isis_adj_state_change(struct isis_adjacency *adj,
enum isis_adj_state state, const char *reason);
void isis_adj_print(struct isis_adjacency *adj);
diff --git a/isisd/isis_bfd.c b/isisd/isis_bfd.c
new file mode 100644
index 0000000000..81976f8dd2
--- /dev/null
+++ b/isisd/isis_bfd.c
@@ -0,0 +1,350 @@
+/*
+ * IS-IS Rout(e)ing protocol - BFD support
+ * Copyright (C) 2018 Christian Franke
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <zebra.h>
+
+#include "zclient.h"
+#include "bfd.h"
+
+#include "isisd/isis_bfd.h"
+#include "isisd/isis_zebra.h"
+#include "isisd/isis_common.h"
+#include "isisd/isis_constants.h"
+#include "isisd/isis_adjacency.h"
+#include "isisd/isis_circuit.h"
+#include "isisd/isisd.h"
+#include "isisd/fabricd.h"
+
+DEFINE_MTYPE_STATIC(ISISD, BFD_SESSION, "ISIS BFD Session")
+
+struct bfd_session {
+ struct in_addr dst_ip;
+ struct in_addr src_ip;
+ int status;
+};
+
+static struct bfd_session *bfd_session_new(struct in_addr *dst_ip,
+ struct in_addr *src_ip)
+{
+ struct bfd_session *rv;
+
+ rv = XCALLOC(MTYPE_BFD_SESSION, sizeof(*rv));
+ rv->dst_ip = *dst_ip;
+ rv->src_ip = *src_ip;
+ return rv;
+}
+
+static void bfd_session_free(struct bfd_session **session)
+{
+ if (!*session)
+ return;
+
+ XFREE(MTYPE_BFD_SESSION, *session);
+ *session = NULL;
+}
+
+static void bfd_adj_event(struct isis_adjacency *adj, struct prefix *dst,
+ int new_status)
+{
+ if (!adj->bfd_session)
+ return;
+
+ if (adj->bfd_session->dst_ip.s_addr != dst->u.prefix4.s_addr)
+ return;
+
+ int old_status = adj->bfd_session->status;
+
+ adj->bfd_session->status = new_status;
+ if (old_status == new_status)
+ return;
+
+ if (isis->debugs & DEBUG_BFD) {
+ char dst_str[INET6_ADDRSTRLEN];
+
+ inet_ntop(AF_INET, &adj->bfd_session->dst_ip,
+ dst_str, sizeof(dst_str));
+ zlog_debug("ISIS-BFD: Peer %s on %s changed from %s to %s",
+ dst_str, adj->circuit->interface->name,
+ bfd_get_status_str(old_status),
+ bfd_get_status_str(new_status));
+ }
+
+ if (old_status != BFD_STATUS_UP
+ || new_status != BFD_STATUS_DOWN) {
+ return;
+ }
+
+ isis_adj_state_change(adj, ISIS_ADJ_DOWN, "bfd session went down");
+}
+
+static int isis_bfd_interface_dest_update(int command, struct zclient *zclient,
+ zebra_size_t length, vrf_id_t vrf_id)
+{
+ struct interface *ifp;
+ struct prefix dst_ip;
+ int status;
+
+ ifp = bfd_get_peer_info(zclient->ibuf, &dst_ip, NULL, &status, vrf_id);
+ if (!ifp || dst_ip.family != AF_INET)
+ return 0;
+
+ if (isis->debugs & DEBUG_BFD) {
+ char dst_buf[INET6_ADDRSTRLEN];
+
+ inet_ntop(AF_INET, &dst_ip.u.prefix4,
+ dst_buf, sizeof(dst_buf));
+
+ zlog_debug("ISIS-BFD: Received update for %s on %s: Changed state to %s",
+ dst_buf, ifp->name, bfd_get_status_str(status));
+ }
+
+ struct isis_circuit *circuit = circuit_scan_by_ifp(ifp);
+
+ if (!circuit)
+ return 0;
+
+ if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
+ for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) {
+ struct list *adjdb = circuit->u.bc.adjdb[level - 1];
+
+ struct listnode *node, *nnode;
+ struct isis_adjacency *adj;
+
+ for (ALL_LIST_ELEMENTS(adjdb, node, nnode, adj))
+ bfd_adj_event(adj, &dst_ip, status);
+ }
+ } else if (circuit->circ_type == CIRCUIT_T_P2P) {
+ if (circuit->u.p2p.neighbor) {
+ bfd_adj_event(circuit->u.p2p.neighbor,
+ &dst_ip, status);
+ }
+ }
+
+ return 0;
+}
+
+static int isis_bfd_nbr_replay(int command, struct zclient *zclient,
+ zebra_size_t length, vrf_id_t vrf_id)
+{
+ bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER);
+
+ struct listnode *anode;
+ struct isis_area *area;
+
+ if (isis->debugs & DEBUG_BFD)
+ zlog_debug("ISIS-BFD: Got neighbor replay request, resending neighbors.");
+
+ for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
+ struct listnode *cnode;
+ struct isis_circuit *circuit;
+
+ for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit))
+ isis_bfd_circuit_cmd(circuit, ZEBRA_BFD_DEST_UPDATE);
+ }
+
+ if (isis->debugs & DEBUG_BFD)
+ zlog_debug("ISIS-BFD: Done with replay.");
+
+ return 0;
+}
+
+static void (*orig_zebra_connected)(struct zclient *);
+static void isis_bfd_zebra_connected(struct zclient *zclient)
+{
+ if (orig_zebra_connected)
+ orig_zebra_connected(zclient);
+
+ bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER);
+}
+
+static void bfd_debug(struct in_addr *dst, struct in_addr *src,
+ const char *interface, int command)
+{
+ if (!(isis->debugs & DEBUG_BFD))
+ return;
+
+ char dst_str[INET6_ADDRSTRLEN];
+ char src_str[INET6_ADDRSTRLEN];
+
+ inet_ntop(AF_INET, dst, dst_str, sizeof(dst_str));
+ inet_ntop(AF_INET, src, src_str, sizeof(src_str));
+
+ const char *command_str;
+
+ switch (command) {
+ case ZEBRA_BFD_DEST_REGISTER:
+ command_str = "Register";
+ break;
+ case ZEBRA_BFD_DEST_DEREGISTER:
+ command_str = "Deregister";
+ break;
+ case ZEBRA_BFD_DEST_UPDATE:
+ command_str = "Update";
+ break;
+ default:
+ command_str = "Unknown-Cmd";
+ break;
+ }
+
+ zlog_debug("ISIS-BFD: %s peer %s on %s (src %s)",
+ command_str, dst_str, interface, src_str);
+}
+
+static void bfd_handle_adj_down(struct isis_adjacency *adj)
+{
+ if (!adj->bfd_session)
+ return;
+
+ bfd_debug(&adj->bfd_session->dst_ip, &adj->bfd_session->src_ip,
+ adj->circuit->interface->name, ZEBRA_BFD_DEST_DEREGISTER);
+
+ bfd_peer_sendmsg(zclient, NULL, AF_INET,
+ &adj->bfd_session->dst_ip,
+ &adj->bfd_session->src_ip,
+ adj->circuit->interface->name,
+ 0, /* ttl */
+ 0, /* multihop */
+ ZEBRA_BFD_DEST_DEREGISTER,
+ 0, /* set_flag */
+ VRF_DEFAULT);
+ bfd_session_free(&adj->bfd_session);
+}
+
+static void bfd_handle_adj_up(struct isis_adjacency *adj, int command)
+{
+ struct isis_circuit *circuit = adj->circuit;
+
+ if (!circuit->bfd_info
+ || !circuit->ip_router
+ || !adj->ipv4_address_count)
+ goto out;
+
+ struct list *local_ips = fabricd_ip_addrs(adj->circuit);
+
+ if (!local_ips)
+ goto out;
+
+ struct in_addr *dst_ip = &adj->ipv4_addresses[0];
+ struct prefix_ipv4 *local_ip = listgetdata(listhead(local_ips));
+ struct in_addr *src_ip = &local_ip->prefix;
+
+ if (adj->bfd_session) {
+ if (adj->bfd_session->dst_ip.s_addr != dst_ip->s_addr
+ || adj->bfd_session->src_ip.s_addr != src_ip->s_addr)
+ bfd_handle_adj_down(adj);
+ }
+
+ if (!adj->bfd_session)
+ adj->bfd_session = bfd_session_new(dst_ip, src_ip);
+
+ bfd_debug(&adj->bfd_session->dst_ip, &adj->bfd_session->src_ip,
+ circuit->interface->name, command);
+ bfd_peer_sendmsg(zclient, circuit->bfd_info, AF_INET,
+ &adj->bfd_session->dst_ip,
+ &adj->bfd_session->src_ip,
+ circuit->interface->name,
+ 0, /* ttl */
+ 0, /* multihop */
+ command,
+ 0, /* set flag */
+ VRF_DEFAULT);
+ return;
+out:
+ bfd_handle_adj_down(adj);
+}
+
+static int bfd_handle_adj_state_change(struct isis_adjacency *adj)
+{
+ if (adj->adj_state == ISIS_ADJ_UP)
+ bfd_handle_adj_up(adj, ZEBRA_BFD_DEST_REGISTER);
+ else
+ bfd_handle_adj_down(adj);
+ return 0;
+}
+
+static void bfd_adj_cmd(struct isis_adjacency *adj, int command)
+{
+ if (adj->adj_state == ISIS_ADJ_UP
+ && command != ZEBRA_BFD_DEST_DEREGISTER) {
+ bfd_handle_adj_up(adj, command);
+ } else {
+ bfd_handle_adj_down(adj);
+ }
+}
+
+void isis_bfd_circuit_cmd(struct isis_circuit *circuit, int command)
+{
+ switch (circuit->circ_type) {
+ case CIRCUIT_T_BROADCAST:
+ for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) {
+ struct list *adjdb = circuit->u.bc.adjdb[level - 1];
+
+ struct listnode *node;
+ struct isis_adjacency *adj;
+
+ for (ALL_LIST_ELEMENTS_RO(adjdb, node, adj))
+ bfd_adj_cmd(adj, command);
+ }
+ break;
+ case CIRCUIT_T_P2P:
+ if (circuit->u.p2p.neighbor)
+ bfd_adj_cmd(circuit->u.p2p.neighbor, command);
+ break;
+ default:
+ break;
+ }
+}
+
+void isis_bfd_circuit_param_set(struct isis_circuit *circuit,
+ uint32_t min_rx, uint32_t min_tx,
+ uint32_t detect_mult, int defaults)
+{
+ int command = 0;
+
+ bfd_set_param(&circuit->bfd_info, min_rx,
+ min_tx, detect_mult, defaults, &command);
+
+ if (command)
+ isis_bfd_circuit_cmd(circuit, command);
+}
+
+static int bfd_circuit_write_settings(struct isis_circuit *circuit,
+ struct vty *vty)
+{
+ struct bfd_info *bfd_info = circuit->bfd_info;
+
+ if (!bfd_info)
+ return 0;
+
+ vty_out(vty, " %s bfd\n", PROTO_NAME);
+ return 1;
+}
+
+void isis_bfd_init(void)
+{
+ bfd_gbl_init();
+
+ orig_zebra_connected = zclient->zebra_connected;
+ zclient->zebra_connected = isis_bfd_zebra_connected;
+ zclient->interface_bfd_dest_update = isis_bfd_interface_dest_update;
+ zclient->bfd_dest_replay = isis_bfd_nbr_replay;
+ hook_register(isis_adj_state_change_hook,
+ bfd_handle_adj_state_change);
+ hook_register(isis_circuit_config_write,
+ bfd_circuit_write_settings);
+}
diff --git a/isisd/isis_bfd.h b/isisd/isis_bfd.h
new file mode 100644
index 0000000000..3193f16061
--- /dev/null
+++ b/isisd/isis_bfd.h
@@ -0,0 +1,31 @@
+/*
+ * IS-IS Rout(e)ing protocol - BFD support
+ * Copyright (C) 2018 Christian Franke
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#ifndef ISIS_BFD_H
+#define ISIS_BFD_H
+
+struct isis_circuit;
+
+void isis_bfd_circuit_cmd(struct isis_circuit *circuit, int command);
+void isis_bfd_circuit_param_set(struct isis_circuit *circuit,
+ uint32_t min_rx, uint32_t min_tx,
+ uint32_t detect_mult, int defaults);
+void isis_bfd_init(void);
+
+#endif
+
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 58c6dfa368..74488a1fcd 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -924,6 +924,10 @@ void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
return;
}
+DEFINE_HOOK(isis_circuit_config_write,
+ (struct isis_circuit *circuit, struct vty *vty),
+ (circuit, vty))
+
int isis_interface_config_write(struct vty *vty)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
@@ -1138,7 +1142,8 @@ int isis_interface_config_write(struct vty *vty)
circuit->passwd.passwd);
write++;
}
- write += circuit_write_mt_settings(circuit, vty);
+ write += hook_call(isis_circuit_config_write,
+ circuit, vty);
}
vty_endframe(vty, "!\n");
}
diff --git a/isisd/isis_circuit.h b/isisd/isis_circuit.h
index ea68767fe0..e83424a4ad 100644
--- a/isisd/isis_circuit.h
+++ b/isisd/isis_circuit.h
@@ -65,6 +65,8 @@ struct isis_p2p_info {
struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
};
+struct bfd_info;
+
struct isis_circuit {
int state;
uint8_t circuit_id; /* l1/l2 bcast CircuitID */
@@ -127,6 +129,7 @@ struct isis_circuit {
#define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
uint8_t flags;
bool disable_threeway_adj;
+ struct bfd_info *bfd_info;
/*
* Counters as in 10589--11.2.5.9
*/
@@ -190,4 +193,8 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid,
bool enabled);
+DECLARE_HOOK(isis_circuit_config_write,
+ (struct isis_circuit *circuit, struct vty *vty),
+ (circuit, vty))
+
#endif /* _ZEBRA_ISIS_CIRCUIT_H */
diff --git a/isisd/isis_events.c b/isisd/isis_events.c
index 5dcc0a1324..9f58c24b71 100644
--- a/isisd/isis_events.c
+++ b/isisd/isis_events.c
@@ -216,25 +216,6 @@ void isis_circuit_is_type_set(struct isis_circuit *circuit, int newtype)
*
* ***********************************************************************/
-void isis_event_adjacency_state_change(struct isis_adjacency *adj, int newstate)
-{
- /* adjacency state change event.
- * - the only proto-type was supported */
-
- /* invalid arguments */
- if (!adj || !adj->circuit || !adj->circuit->area)
- return;
-
- if (isis->debugs & DEBUG_EVENTS)
- zlog_debug("ISIS-Evt (%s) Adjacency State change",
- adj->circuit->area->area_tag);
-
- /* LSP generation again */
- lsp_regenerate_schedule(adj->circuit->area, IS_LEVEL_1 | IS_LEVEL_2, 0);
-
- return;
-}
-
/* events supporting code */
int isis_event_dis_status_change(struct thread *thread)
diff --git a/isisd/isis_events.h b/isisd/isis_events.h
index c3d8cf046f..25643f4ede 100644
--- a/isisd/isis_events.h
+++ b/isisd/isis_events.h
@@ -31,9 +31,6 @@ void isis_event_circuit_type_change(struct isis_circuit *circuit, int newtype);
/*
* Events related to adjacencies
*/
-void isis_event_adjacency_state_change(struct isis_adjacency *adj,
- int newstate);
-
int isis_event_dis_status_change(struct thread *thread);
/*
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 1258bec064..61ba51ffb8 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -1997,3 +1997,15 @@ void lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit)
fabricd_lsp_flood(lsp);
}
}
+
+static int lsp_handle_adj_state_change(struct isis_adjacency *adj)
+{
+ lsp_regenerate_schedule(adj->circuit->area, IS_LEVEL_1 | IS_LEVEL_2, 0);
+ return 0;
+}
+
+void lsp_init(void)
+{
+ hook_register(isis_adj_state_change_hook,
+ lsp_handle_adj_state_change);
+}
diff --git a/isisd/isis_lsp.h b/isisd/isis_lsp.h
index 4e6379447c..4beee10081 100644
--- a/isisd/isis_lsp.h
+++ b/isisd/isis_lsp.h
@@ -101,5 +101,6 @@ int lsp_print_all(struct vty *vty, dict_t *lspdb, char detail, char dynhost);
/* sets SRMflags for all active circuits of an lsp */
void lsp_set_all_srmflags(struct isis_lsp *lsp, bool set);
void lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit);
+void lsp_init(void);
#endif /* ISIS_LSP */
diff --git a/isisd/isis_main.c b/isisd/isis_main.c
index 4d6a6da5d6..7956ddeaf1 100644
--- a/isisd/isis_main.c
+++ b/isisd/isis_main.c
@@ -55,6 +55,9 @@
#include "isisd/isis_te.h"
#include "isisd/isis_errors.h"
#include "isisd/isis_vty_common.h"
+#include "isisd/isis_bfd.h"
+#include "isisd/isis_lsp.h"
+#include "isisd/isis_mt.h"
/* Default configuration file name */
#define ISISD_DEFAULT_CONFIG "isisd.conf"
@@ -213,11 +216,14 @@ int main(int argc, char **argv, char **envp)
isis_redist_init();
isis_route_map_init();
isis_mpls_te_init();
+ lsp_init();
+ mt_init();
/* create the global 'isis' instance */
isis_new(1);
isis_zebra_init(master);
+ isis_bfd_init();
frr_config_fork();
frr_run(master);
diff --git a/isisd/isis_mt.c b/isisd/isis_mt.c
index e0227f4656..7493b90d33 100644
--- a/isisd/isis_mt.c
+++ b/isisd/isis_mt.c
@@ -302,7 +302,8 @@ circuit_get_mt_setting(struct isis_circuit *circuit, uint16_t mtid)
return setting;
}
-int circuit_write_mt_settings(struct isis_circuit *circuit, struct vty *vty)
+static int circuit_write_mt_settings(struct isis_circuit *circuit,
+ struct vty *vty)
{
int written = 0;
struct listnode *node;
@@ -551,3 +552,9 @@ void tlvs_add_mt_p2p(struct isis_tlvs *tlvs, struct isis_circuit *circuit,
tlvs_add_mt_set(circuit->area, tlvs, adj->mt_count, adj->mt_set, id,
metric, subtlvs, subtlv_len);
}
+
+void mt_init(void)
+{
+ hook_register(isis_circuit_config_write,
+ circuit_write_mt_settings);
+}
diff --git a/isisd/isis_mt.h b/isisd/isis_mt.h
index 8c57d24afa..515b63f50f 100644
--- a/isisd/isis_mt.h
+++ b/isisd/isis_mt.h
@@ -109,7 +109,6 @@ void circuit_mt_init(struct isis_circuit *circuit);
void circuit_mt_finish(struct isis_circuit *circuit);
struct isis_circuit_mt_setting *
circuit_get_mt_setting(struct isis_circuit *circuit, uint16_t mtid);
-int circuit_write_mt_settings(struct isis_circuit *circuit, struct vty *vty);
struct isis_circuit_mt_setting **
circuit_mt_settings(struct isis_circuit *circuit, unsigned int *mt_count);
bool tlvs_to_adj_mt_set(struct isis_tlvs *tlvs, bool v4_usable, bool v6_usable,
@@ -122,4 +121,5 @@ void tlvs_add_mt_bcast(struct isis_tlvs *tlvs, struct isis_circuit *circuit,
void tlvs_add_mt_p2p(struct isis_tlvs *tlvs, struct isis_circuit *circuit,
uint8_t *id, uint32_t metric, uint8_t *subtlvs,
uint8_t subtlv_len);
+void mt_init(void);
#endif
diff --git a/isisd/isis_vty_common.c b/isisd/isis_vty_common.c
index 2b98a88b34..c211763042 100644
--- a/isisd/isis_vty_common.c
+++ b/isisd/isis_vty_common.c
@@ -28,12 +28,14 @@
#include "command.h"
#include "spf_backoff.h"
+#include "bfd.h"
#include "isis_circuit.h"
#include "isis_csm.h"
#include "isis_misc.h"
#include "isis_mt.h"
#include "isisd.h"
+#include "isis_bfd.h"
#include "isis_vty_common.h"
struct isis_circuit *isis_circuit_lookup(struct vty *vty)
@@ -498,6 +500,49 @@ DEFUN (no_circuit_topology,
return isis_circuit_mt_enabled_set(circuit, mtid, false);
}
+DEFUN (isis_bfd,
+ isis_bfd_cmd,
+ PROTO_NAME " bfd",
+ PROTO_HELP
+ "Enable BFD support\n")
+{
+ struct isis_circuit *circuit = isis_circuit_lookup(vty);
+
+ if (!circuit)
+ return CMD_ERR_NO_MATCH;
+
+ if (circuit->bfd_info
+ && CHECK_FLAG(circuit->bfd_info->flags, BFD_FLAG_PARAM_CFG)) {
+ return CMD_SUCCESS;
+ }
+
+ isis_bfd_circuit_param_set(circuit, BFD_DEF_MIN_RX,
+ BFD_DEF_MIN_TX, BFD_DEF_DETECT_MULT, true);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_isis_bfd,
+ no_isis_bfd_cmd,
+ "no " PROTO_NAME " bfd",
+ NO_STR
+ PROTO_HELP
+ "Disables BFD support\n"
+)
+{
+ struct isis_circuit *circuit = isis_circuit_lookup(vty);
+
+ if (!circuit)
+ return CMD_ERR_NO_MATCH;
+
+ if (!circuit->bfd_info)
+ return CMD_SUCCESS;
+
+ isis_bfd_circuit_cmd(circuit, ZEBRA_BFD_DEST_DEREGISTER);
+ bfd_info_free(&circuit->bfd_info);
+ return CMD_SUCCESS;
+}
+
DEFUN (set_overload_bit,
set_overload_bit_cmd,
"set-overload-bit",
@@ -930,6 +975,9 @@ void isis_vty_init(void)
install_element(INTERFACE_NODE, &circuit_topology_cmd);
install_element(INTERFACE_NODE, &no_circuit_topology_cmd);
+ install_element(INTERFACE_NODE, &isis_bfd_cmd);
+ install_element(INTERFACE_NODE, &no_isis_bfd_cmd);
+
install_element(ROUTER_NODE, &set_overload_bit_cmd);
install_element(ROUTER_NODE, &no_set_overload_bit_cmd);
diff --git a/isisd/isis_zebra.h b/isisd/isis_zebra.h
index 4fbcf87217..20c10d0b23 100644
--- a/isisd/isis_zebra.h
+++ b/isisd/isis_zebra.h
@@ -27,6 +27,8 @@ extern struct zclient *zclient;
void isis_zebra_init(struct thread_master *);
void isis_zebra_stop(void);
+struct isis_route_info;
+
void isis_zebra_route_update(struct prefix *prefix,
struct prefix_ipv6 *src_p,
struct isis_route_info *route_info);
diff --git a/isisd/isisd.c b/isisd/isisd.c
index e5e43c4b7d..94e6a63855 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -746,6 +746,8 @@ void print_debug(struct vty *vty, int flags, int onoff)
vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs);
if (flags & DEBUG_FABRICD_FLOODING)
vty_out(vty, "OpenFabric Flooding debugging is %s\n", onoffs);
+ if (flags & DEBUG_BFD)
+ vty_out(vty, "IS-IS BFD debugging is %s\n", onoffs);
}
DEFUN_NOSH (show_debugging,
@@ -831,6 +833,10 @@ static int config_write_debug(struct vty *vty)
vty_out(vty, "debug " PROTO_NAME " flooding\n");
write++;
}
+ if (flags & DEBUG_BFD) {
+ vty_out(vty, "debug " PROTO_NAME " bfd\n");
+ write++;
+ }
write += spf_backoff_write_config(vty);
return write;
@@ -1214,6 +1220,33 @@ DEFUN (no_debug_isis_lsp_sched,
return CMD_SUCCESS;
}
+DEFUN (debug_isis_bfd,
+ debug_isis_bfd_cmd,
+ "debug " PROTO_NAME " bfd",
+ DEBUG_STR
+ PROTO_HELP
+ PROTO_NAME " interaction with BFD\n")
+{
+ isis->debugs |= DEBUG_BFD;
+ print_debug(vty, DEBUG_BFD, 1);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_isis_bfd,
+ no_debug_isis_bfd_cmd,
+ "no debug " PROTO_NAME " bfd",
+ NO_STR
+ UNDEBUG_STR
+ PROTO_HELP
+ PROTO_NAME " interaction with BFD\n")
+{
+ isis->debugs &= ~DEBUG_BFD;
+ print_debug(vty, DEBUG_BFD, 0);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (show_hostname,
show_hostname_cmd,
"show " PROTO_NAME " hostname",
@@ -2215,6 +2248,8 @@ void isis_init()
install_element(ENABLE_NODE, &no_debug_isis_lsp_gen_cmd);
install_element(ENABLE_NODE, &debug_isis_lsp_sched_cmd);
install_element(ENABLE_NODE, &no_debug_isis_lsp_sched_cmd);
+ install_element(ENABLE_NODE, &debug_isis_bfd_cmd);
+ install_element(ENABLE_NODE, &no_debug_isis_bfd_cmd);
install_element(CONFIG_NODE, &debug_isis_adj_cmd);
install_element(CONFIG_NODE, &no_debug_isis_adj_cmd);
@@ -2244,6 +2279,8 @@ void isis_init()
install_element(CONFIG_NODE, &no_debug_isis_lsp_gen_cmd);
install_element(CONFIG_NODE, &debug_isis_lsp_sched_cmd);
install_element(CONFIG_NODE, &no_debug_isis_lsp_sched_cmd);
+ install_element(CONFIG_NODE, &debug_isis_bfd_cmd);
+ install_element(CONFIG_NODE, &no_debug_isis_bfd_cmd);
install_element(CONFIG_NODE, &router_isis_cmd);
install_element(CONFIG_NODE, &no_router_isis_cmd);
diff --git a/isisd/isisd.h b/isisd/isisd.h
index 864021428a..7572f55174 100644
--- a/isisd/isisd.h
+++ b/isisd/isisd.h
@@ -211,6 +211,7 @@ extern struct thread_master *master;
#define DEBUG_LSP_GEN (1<<13)
#define DEBUG_LSP_SCHED (1<<14)
#define DEBUG_FABRICD_FLOODING (1<<15)
+#define DEBUG_BFD (1<<16)
#define lsp_debug(...) \
do { \
diff --git a/isisd/subdir.am b/isisd/subdir.am
index 7571255e59..552bc49b80 100644
--- a/isisd/subdir.am
+++ b/isisd/subdir.am
@@ -27,6 +27,7 @@ endif
noinst_HEADERS += \
isisd/dict.h \
isisd/isis_adjacency.h \
+ isisd/isis_bfd.h \
isisd/isis_circuit.h \
isisd/isis_common.h \
isisd/isis_constants.h \
@@ -60,6 +61,7 @@ noinst_HEADERS += \
LIBISIS_SOURCES = \
isisd/dict.c \
isisd/isis_adjacency.c \
+ isisd/isis_bfd.c \
isisd/isis_circuit.c \
isisd/isis_csm.c \
isisd/isis_dr.c \
diff --git a/lib/log.c b/lib/log.c
index 2d800baae1..10cb2cd8a4 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -980,6 +980,7 @@ static const struct zebra_desc_table command_types[] = {
DESC_ENTRY(ZEBRA_IPSET_DESTROY),
DESC_ENTRY(ZEBRA_IPSET_ENTRY_ADD),
DESC_ENTRY(ZEBRA_IPSET_ENTRY_DELETE),
+ DESC_ENTRY(ZEBRA_VXLAN_FLOOD_CONTROL),
};
#undef DESC_ENTRY
diff --git a/lib/vxlan.h b/lib/vxlan.h
index ba3dbb05c8..bcf8354539 100644
--- a/lib/vxlan.h
+++ b/lib/vxlan.h
@@ -26,4 +26,13 @@
typedef uint32_t vni_t;
#define VNI_MAX 16777215 /* (2^24 - 1) */
+/* Flooding mechanisms for BUM packets. */
+/* Currently supported mechanisms are head-end (ingress) replication
+ * (which is the default) and no flooding. Future options could be
+ * using PIM-SM, PIM-Bidir etc.
+ */
+enum vxlan_flood_control {
+ VXLAN_FLOOD_HEAD_END_REPL = 0,
+ VXLAN_FLOOD_DISABLED,
+};
#endif /* __VXLAN_H__ */
diff --git a/lib/zclient.h b/lib/zclient.h
index 54f3635901..97ebb0811c 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -155,6 +155,7 @@ typedef enum {
ZEBRA_IPTABLE_ADD,
ZEBRA_IPTABLE_DELETE,
ZEBRA_IPTABLE_NOTIFY_OWNER,
+ ZEBRA_VXLAN_FLOOD_CONTROL,
} zebra_message_types_t;
struct redist_proto {
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index 0ce08a61e2..7ae7d682bd 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -1729,7 +1729,7 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
listnode_add_sort(route->paths, path);
old = ospf6_route_lookup(&route->prefix, oa->route_table);
- if (old && (ospf6_route_cmp(route, old) == 0)) {
+ if (old) {
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
prefix2str(&route->prefix, buf, sizeof(buf));
zlog_debug("%s Update route: %s old cost %u new cost %u paths %u nh %u",
diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c
index 8078455930..714c47b4e6 100644
--- a/ospfd/ospf_flood.c
+++ b/ospfd/ospf_flood.c
@@ -91,7 +91,7 @@ struct external_info *ospf_external_info_check(struct ospf *ospf,
p.prefix = lsa->data->id;
p.prefixlen = ip_masklen(al->mask);
- for (type = 0; type < ZEBRA_ROUTE_MAX; type++) {
+ for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
int redist_on = 0;
redist_on =
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 25d54a8553..652c47387a 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -8387,6 +8387,9 @@ DEFUN (ospf_default_information_originate,
int metric = -1;
struct ospf_redist *red;
int idx = 0;
+ int cur_originate = ospf->default_originate;
+ int sameRtmap = 0;
+ char *rtmap = NULL;
red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0);
@@ -8408,7 +8411,28 @@ DEFUN (ospf_default_information_originate,
idx = 1;
/* Get route-map */
if (argv_find(argv, argc, "WORD", &idx))
- ospf_routemap_set(red, argv[idx]->arg);
+ rtmap = argv[idx]->arg;
+
+ /* To check ,if user is providing same route map */
+ if ((rtmap == ROUTEMAP_NAME(red)) ||
+ (rtmap && ROUTEMAP_NAME(red)
+ && (strcmp(rtmap, ROUTEMAP_NAME(red)) == 0)))
+ sameRtmap = 1;
+
+ /* Don't allow if the same lsa is aleardy originated. */
+ if ((sameRtmap)
+ && (red->dmetric.type == type)
+ && (red->dmetric.value == metric)
+ && (cur_originate == default_originate))
+ return CMD_SUCCESS;
+
+ /* Updating Metric details */
+ red->dmetric.type = type;
+ red->dmetric.value = metric;
+
+ /* updating route map details */
+ if (rtmap)
+ ospf_routemap_set(red, rtmap);
else
ospf_routemap_unset(red);
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index fdb87bd1ff..ed19ae4f31 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -626,6 +626,8 @@ struct ospf_redist *ospf_redist_add(struct ospf *ospf, uint8_t type,
red->instance = instance;
red->dmetric.type = -1;
red->dmetric.value = -1;
+ ROUTEMAP_NAME(red) = NULL;
+ ROUTEMAP(red) = NULL;
listnode_add(red_list, red);
@@ -753,11 +755,54 @@ int ospf_redistribute_unset(struct ospf *ospf, int type,
int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
int mvalue)
{
+ struct ospf_external *ext;
+ struct prefix_ipv4 p;
+ struct in_addr nexthop;
+ int cur_originate = ospf->default_originate;
+
+ nexthop.s_addr = 0;
+ p.family = AF_INET;
+ p.prefix.s_addr = 0;
+ p.prefixlen = 0;
+
ospf->default_originate = originate;
ospf_external_add(ospf, DEFAULT_ROUTE, 0);
- if (ospf_is_type_redistributed(ospf, DEFAULT_ROUTE, 0))
+ if (cur_originate == DEFAULT_ORIGINATE_NONE) {
+ /* First time configuration */
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
+ zlog_debug("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]",
+ metric_type(ospf, DEFAULT_ROUTE, 0),
+ metric_value(ospf, DEFAULT_ROUTE, 0));
+
+ if (ospf->router_id.s_addr == 0)
+ ospf->external_origin |= (1 << DEFAULT_ROUTE);
+ if ((originate == DEFAULT_ORIGINATE_ALWAYS)
+ && (ospf->router_id.s_addr)) {
+
+ /* always , so originate lsa even it doesn't
+ * exist in RIB.
+ */
+ ospf_external_info_add(ospf, DEFAULT_ROUTE, 0,
+ p, 0, nexthop, 0);
+ ospf_external_lsa_refresh_default(ospf);
+
+ } else if (originate == DEFAULT_ORIGINATE_ZEBRA) {
+ /* Send msg to Zebra to validate default route
+ * existance.
+ */
+ zclient_redistribute_default(
+ ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
+ zclient, ospf->vrf_id);
+ }
+
+ ospf_asbr_status_update(ospf, ++ospf->redistribute);
+ return CMD_SUCCESS;
+
+
+ } else if (originate == cur_originate) {
+ /* Refresh the lsa since metric might different */
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug(
"Redistribute[%s]: Refresh Type[%d], Metric[%d]",
@@ -765,37 +810,58 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
metric_type(ospf, DEFAULT_ROUTE, 0),
metric_value(ospf, DEFAULT_ROUTE, 0));
- zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient,
- ospf->vrf_id);
+ ospf_external_lsa_refresh_default(ospf);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
- zlog_debug("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]",
- metric_type(ospf, DEFAULT_ROUTE, 0),
- metric_value(ospf, DEFAULT_ROUTE, 0));
+ } else {
+ /* "default-info originate always" configured now,
+ * where "default-info originate" configured previoulsly.
+ */
+ if (originate == DEFAULT_ORIGINATE_ALWAYS) {
+
+ zclient_redistribute_default(
+ ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
+ zclient, ospf->vrf_id);
+ /* here , ex-info should be added since ex-info might
+ * have not updated earlier if def route is not exist.
+ * If ex-iinfo ex-info already exist , it will return
+ * smoothly.
+ */
+ ospf_external_info_add(ospf, DEFAULT_ROUTE, 0,
+ p, 0, nexthop, 0);
+ ospf_external_lsa_refresh_default(ospf);
- ospf_external_lsa_refresh_default(ospf);
+ } else {
+ /* "default-info originate" configured now,where
+ * "default-info originate always" configured
+ * previoulsy.
+ */
- if (ospf->router_id.s_addr == 0)
- ospf->external_origin |= (1 << DEFAULT_ROUTE);
- else
- thread_add_timer(master, ospf_default_originate_timer, ospf, 1,
- NULL);
+ ospf_external_lsa_flush(ospf, DEFAULT_ROUTE, &p, 0);
- ospf_asbr_status_update(ospf, ++ospf->redistribute);
+ ext = ospf_external_lookup(ospf, DEFAULT_ROUTE, 0);
+ if (ext && EXTERNAL_INFO(ext))
+ ospf_external_info_delete(ospf,
+ DEFAULT_ROUTE, 0, p);
+
+ zclient_redistribute_default(
+ ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
+ zclient, ospf->vrf_id);
+ }
+ }
return CMD_SUCCESS;
}
-
int ospf_redistribute_default_unset(struct ospf *ospf)
{
- if (!ospf_is_type_redistributed(ospf, DEFAULT_ROUTE, 0))
- return CMD_SUCCESS;
+ if (ospf->default_originate == DEFAULT_ORIGINATE_ZEBRA) {
+ if (!ospf_is_type_redistributed(ospf, DEFAULT_ROUTE, 0))
+ return CMD_SUCCESS;
+ zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
+ zclient, ospf->vrf_id);
+ }
ospf->default_originate = DEFAULT_ORIGINATE_NONE;
- zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient,
- ospf->vrf_id);
-
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug("Redistribute[DEFAULT]: Stop");
@@ -941,6 +1007,7 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient,
struct external_info *ei;
struct ospf *ospf;
int i;
+ uint8_t rt_type;
ospf = ospf_lookup_by_vrf_id(vrf_id);
if (ospf == NULL)
@@ -951,11 +1018,21 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient,
ifindex = api.nexthops[0].ifindex;
nexthop = api.nexthops[0].gate.ipv4;
+ rt_type = api.type;
memcpy(&p, &api.prefix, sizeof(p));
if (IPV4_NET127(ntohl(p.prefix.s_addr)))
return 0;
+ /* Re-destributed route is default route.
+ * Here, route type is used as 'ZEBRA_ROUTE_KERNEL' for
+ * updating ex-info. But in resetting (no default-info
+ * originate)ZEBRA_ROUTE_MAX is used to delete the ex-info.
+ * Resolved this inconsistency by maintaining same route type.
+ */
+ if (is_prefix_default(&p))
+ rt_type = DEFAULT_ROUTE;
+
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) {
char buf_prefix[PREFIX_STRLEN];
prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
@@ -973,8 +1050,8 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient,
*/
/* Protocol tag overwrites all other tag value sent by zebra */
- if (ospf->dtag[api.type] > 0)
- api.tag = ospf->dtag[api.type];
+ if (ospf->dtag[rt_type] > 0)
+ api.tag = ospf->dtag[rt_type];
/*
* Given zebra sends update for a prefix via ADD message, it
@@ -983,12 +1060,12 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient,
* source
* types.
*/
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
- if (i != api.type)
+ for (i = 0; i <= ZEBRA_ROUTE_MAX; i++)
+ if (i != rt_type)
ospf_external_info_delete(ospf, i, api.instance,
p);
- ei = ospf_external_info_add(ospf, api.type, api.instance, p,
+ ei = ospf_external_info_add(ospf, rt_type, api.instance, p,
ifindex, nexthop, api.tag);
if (ei == NULL) {
/* Nothing has changed, so nothing to do; return */
@@ -997,7 +1074,7 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient,
if (ospf->router_id.s_addr == 0)
/* Set flags to generate AS-external-LSA originate event
for each redistributed protocols later. */
- ospf->external_origin |= (1 << api.type);
+ ospf->external_origin |= (1 << rt_type);
else {
if (ei) {
if (is_prefix_default(&p))
@@ -1027,11 +1104,11 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient,
}
} else /* if (command == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */
{
- ospf_external_info_delete(ospf, api.type, api.instance, p);
+ ospf_external_info_delete(ospf, rt_type, api.instance, p);
if (is_prefix_default(&p))
ospf_external_lsa_refresh_default(ospf);
else
- ospf_external_lsa_flush(ospf, api.type, &p,
+ ospf_external_lsa_flush(ospf, rt_type, &p,
ifindex /*, nexthop */);
}
diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c
index 42f7d76759..f0797827ce 100644
--- a/tests/bgpd/test_mpath.c
+++ b/tests/bgpd/test_mpath.c
@@ -207,7 +207,7 @@ struct peer test_mp_list_peer[] = {
};
int test_mp_list_peer_count = sizeof(test_mp_list_peer) / sizeof(struct peer);
struct attr test_mp_list_attr[4];
-struct bgp_info test_mp_list_info[] = {
+struct bgp_path_info test_mp_list_info[] = {
{.peer = &test_mp_list_peer[0], .attr = &test_mp_list_attr[0]},
{.peer = &test_mp_list_peer[1], .attr = &test_mp_list_attr[1]},
{.peer = &test_mp_list_peer[2], .attr = &test_mp_list_attr[1]},
@@ -215,7 +215,7 @@ struct bgp_info test_mp_list_info[] = {
{.peer = &test_mp_list_peer[4], .attr = &test_mp_list_attr[3]},
};
int test_mp_list_info_count =
- sizeof(test_mp_list_info) / sizeof(struct bgp_info);
+ sizeof(test_mp_list_info) / sizeof(struct bgp_path_info);
static int setup_bgp_mp_list(testcase_t *t)
{
@@ -247,7 +247,7 @@ static int run_bgp_mp_list(testcase_t *t)
{
struct list mp_list;
struct listnode *mp_node;
- struct bgp_info *info;
+ struct bgp_path_info *info;
int i;
int test_result = TEST_PASSED;
bgp_mp_list_init(&mp_list);
@@ -289,24 +289,24 @@ testcase_t test_bgp_mp_list = {
};
/*=========================================================
- * Testcase for bgp_info_mpath_update
+ * Testcase for bgp_path_info_mpath_update
*/
struct bgp_node test_rn;
-static int setup_bgp_info_mpath_update(testcase_t *t)
+static int setup_bgp_path_info_mpath_update(testcase_t *t)
{
int i;
str2prefix("42.1.1.0/24", &test_rn.p);
setup_bgp_mp_list(t);
for (i = 0; i < test_mp_list_info_count; i++)
- bgp_info_add(&test_rn, &test_mp_list_info[i]);
+ bgp_path_info_add(&test_rn, &test_mp_list_info[i]);
return 0;
}
-static int run_bgp_info_mpath_update(testcase_t *t)
+static int run_bgp_path_info_mpath_update(testcase_t *t)
{
- struct bgp_info *new_best, *old_best, *mpath;
+ struct bgp_path_info *new_best, *old_best, *mpath;
struct list mp_list;
struct bgp_maxpaths_cfg mp_cfg = {3, 3};
int test_result = TEST_PASSED;
@@ -317,33 +317,35 @@ static int run_bgp_info_mpath_update(testcase_t *t)
bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
new_best = &test_mp_list_info[3];
old_best = NULL;
- bgp_info_mpath_update(&test_rn, new_best, old_best, &mp_list, &mp_cfg);
+ bgp_path_info_mpath_update(&test_rn, new_best, old_best, &mp_list,
+ &mp_cfg);
bgp_mp_list_clear(&mp_list);
- EXPECT_TRUE(bgp_info_mpath_count(new_best) == 2, test_result);
- mpath = bgp_info_mpath_first(new_best);
+ EXPECT_TRUE(bgp_path_info_mpath_count(new_best) == 2, test_result);
+ mpath = bgp_path_info_mpath_first(new_best);
EXPECT_TRUE(mpath == &test_mp_list_info[0], test_result);
- EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
- mpath = bgp_info_mpath_next(mpath);
+ EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result);
+ mpath = bgp_path_info_mpath_next(mpath);
EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result);
- EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
+ EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result);
bgp_mp_list_add(&mp_list, &test_mp_list_info[0]);
bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
new_best = &test_mp_list_info[0];
old_best = &test_mp_list_info[3];
- bgp_info_mpath_update(&test_rn, new_best, old_best, &mp_list, &mp_cfg);
+ bgp_path_info_mpath_update(&test_rn, new_best, old_best, &mp_list,
+ &mp_cfg);
bgp_mp_list_clear(&mp_list);
- EXPECT_TRUE(bgp_info_mpath_count(new_best) == 1, test_result);
- mpath = bgp_info_mpath_first(new_best);
+ EXPECT_TRUE(bgp_path_info_mpath_count(new_best) == 1, test_result);
+ mpath = bgp_path_info_mpath_first(new_best);
EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result);
- EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
- EXPECT_TRUE(!CHECK_FLAG(test_mp_list_info[0].flags, BGP_INFO_MULTIPATH),
+ EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result);
+ EXPECT_TRUE(!CHECK_FLAG(test_mp_list_info[0].flags, BGP_PATH_MULTIPATH),
test_result);
return test_result;
}
-static int cleanup_bgp_info_mpath_update(testcase_t *t)
+static int cleanup_bgp_path_info_mpath_update(testcase_t *t)
{
int i;
@@ -353,11 +355,11 @@ static int cleanup_bgp_info_mpath_update(testcase_t *t)
return 0;
}
-testcase_t test_bgp_info_mpath_update = {
- .desc = "Test bgp_info_mpath_update",
- .setup = setup_bgp_info_mpath_update,
- .run = run_bgp_info_mpath_update,
- .cleanup = cleanup_bgp_info_mpath_update,
+testcase_t test_bgp_path_info_mpath_update = {
+ .desc = "Test bgp_path_info_mpath_update",
+ .setup = setup_bgp_path_info_mpath_update,
+ .run = run_bgp_path_info_mpath_update,
+ .cleanup = cleanup_bgp_path_info_mpath_update,
};
/*=========================================================
@@ -365,7 +367,7 @@ testcase_t test_bgp_info_mpath_update = {
*/
testcase_t *all_tests[] = {
&test_bgp_cfg_maximum_paths, &test_bgp_mp_list,
- &test_bgp_info_mpath_update,
+ &test_bgp_path_info_mpath_update,
};
int all_tests_count = (sizeof(all_tests) / sizeof(testcase_t *));
diff --git a/tests/bgpd/test_mpath.py b/tests/bgpd/test_mpath.py
index 3024669507..ce34ff8436 100644
--- a/tests/bgpd/test_mpath.py
+++ b/tests/bgpd/test_mpath.py
@@ -5,5 +5,5 @@ class TestMpath(frrtest.TestMultiOut):
TestMpath.okfail("bgp maximum-paths config")
TestMpath.okfail("bgp_mp_list")
-TestMpath.okfail("bgp_info_mpath_update")
+TestMpath.okfail("bgp_path_info_mpath_update")
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index 7a55da462d..7a7744f7c0 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -271,18 +271,18 @@ void vtysh_config_parse_line(void *arg, const char *line)
strlen("ipv6 prefix-list"))
== 0)
config = config_get(PREFIX_IPV6_NODE, line);
- else if (strncmp(line, "ip as-path access-list",
- strlen("ip as-path access-list"))
+ else if (strncmp(line, "bgp as-path access-list",
+ strlen("bgp as-path access-list"))
== 0)
config = config_get(AS_LIST_NODE, line);
- else if (strncmp(line, "ip community-list",
- strlen("ip community-list"))
+ else if (strncmp(line, "bgp community-list",
+ strlen("bgp community-list"))
== 0
- || strncmp(line, "ip extcommunity-list",
- strlen("ip extcommunity-list"))
+ || strncmp(line, "bgp extcommunity-list",
+ strlen("bgp extcommunity-list"))
== 0
- || strncmp(line, "ip large-community-list",
- strlen("ip large-community-list"))
+ || strncmp(line, "bgp large-community-list",
+ strlen("bgp large-community-list"))
== 0)
config = config_get(COMMUNITY_LIST_NODE, line);
else if (strncmp(line, "ip route", strlen("ip route")) == 0)
diff --git a/zebra/subdir.am b/zebra/subdir.am
index 1d76ff65ca..bf2c393233 100644
--- a/zebra/subdir.am
+++ b/zebra/subdir.am
@@ -95,6 +95,10 @@ zebra_zebra_SOURCES = \
zebra/zebra_vty_clippy.c: $(CLIPPY_DEPS)
zebra/zebra_vty.$(OBJEXT): zebra/zebra_vty_clippy.c
+
+zebra/zebra_routemap_clippy.c: $(CLIPPY_DEPS)
+zebra/zebra_routemap.$(OBJEXT): zebra/zebra_routemap_clippy.c
+
noinst_HEADERS += \
zebra/connected.h \
zebra/debug.h \
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index b9897bea03..149d2cb6a5 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -1090,8 +1090,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
zebra_add_rnh_client(rnh, client, type, zvrf_id(zvrf));
/* Anything not AF_INET/INET6 has been filtered out above */
if (!exist)
- zebra_evaluate_rnh(zvrf_id(zvrf), p.family, 1, type,
- &p);
+ zebra_evaluate_rnh(zvrf, p.family, 1, type, &p);
}
stream_failure:
@@ -2440,6 +2439,7 @@ void (*zserv_handlers[])(ZAPI_HANDLER_ARGS) = {
[ZEBRA_IPSET_ENTRY_DELETE] = zread_ipset_entry,
[ZEBRA_IPTABLE_ADD] = zread_iptable,
[ZEBRA_IPTABLE_DELETE] = zread_iptable,
+ [ZEBRA_VXLAN_FLOOD_CONTROL] = zebra_vxlan_flood_control,
};
#if defined(HANDLE_ZAPI_FUZZING)
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index b711241611..e4a4adba05 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -1030,8 +1030,7 @@ int zebra_ptm_bfd_client_deregister(struct zserv *client)
char tmp_buf[64];
int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF;
- if (proto != ZEBRA_ROUTE_OSPF && proto != ZEBRA_ROUTE_BGP
- && proto != ZEBRA_ROUTE_OSPF6 && proto != ZEBRA_ROUTE_PIM)
+ if (!IS_BFD_ENABLED_PROTOCOL(proto))
return 0;
if (IS_ZEBRA_DEBUG_EVENT)
@@ -1310,17 +1309,8 @@ static void zebra_ptm_send_clients(struct stream *msg)
/* Send message to all running client daemons. */
for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) {
- switch (client->proto) {
- case ZEBRA_ROUTE_BGP:
- case ZEBRA_ROUTE_OSPF:
- case ZEBRA_ROUTE_OSPF6:
- case ZEBRA_ROUTE_PIM:
- break;
-
- default:
- /* NOTHING: skip this daemon. */
+ if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
continue;
- }
zserv_send_message(client, msg);
@@ -1341,23 +1331,9 @@ static int _zebra_ptm_bfd_client_deregister(struct zserv *zs)
struct stream *msg;
struct ptm_process *pp;
- /* Filter daemons that must receive this treatment. */
- switch (zs->proto) {
- case ZEBRA_ROUTE_BGP:
- case ZEBRA_ROUTE_OSPF:
- case ZEBRA_ROUTE_OSPF6:
- case ZEBRA_ROUTE_PIM:
- break;
-
- case ZEBRA_ROUTE_BFD:
- /* Don't try to send BFDd messages to itself. */
+ if (!IS_BFD_ENABLED_PROTOCOL(zs->proto))
return 0;
- default:
- /* Unsupported daemon. */
- return 0;
- }
-
/* Find daemon pid by zebra connection pointer. */
pp = pp_lookup_byzs(zs);
if (pp == NULL) {
diff --git a/zebra/zebra_ptm.h b/zebra/zebra_ptm.h
index ada4f7b4f7..d0cdaf0bce 100644
--- a/zebra/zebra_ptm.h
+++ b/zebra/zebra_ptm.h
@@ -59,6 +59,15 @@ struct zebra_ptm_cb {
#define ZEBRA_IF_PTM_ENABLE_ON 1
#define ZEBRA_IF_PTM_ENABLE_UNSPEC 2
+#define IS_BFD_ENABLED_PROTOCOL(protocol) ( \
+ (protocol) == ZEBRA_ROUTE_BGP || \
+ (protocol) == ZEBRA_ROUTE_OSPF || \
+ (protocol) == ZEBRA_ROUTE_OSPF6 || \
+ (protocol) == ZEBRA_ROUTE_ISIS || \
+ (protocol) == ZEBRA_ROUTE_PIM || \
+ (protocol) == ZEBRA_ROUTE_OPENFABRIC \
+)
+
void zebra_ptm_init(void);
void zebra_ptm_finish(void);
int zebra_ptm_connect(struct thread *t);
diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c
index 815f61d157..420105198b 100644
--- a/zebra/zebra_ptm_redistribute.c
+++ b/zebra/zebra_ptm_redistribute.c
@@ -24,6 +24,7 @@
#include "stream.h"
#include "zebra/zserv.h"
#include "zebra/zapi_msg.h"
+#include "zebra/zebra_ptm.h"
#include "zebra/zebra_ptm_redistribute.h"
#include "zebra/zebra_memory.h"
@@ -76,11 +77,7 @@ void zebra_interface_bfd_update(struct interface *ifp, struct prefix *dp,
struct zserv *client;
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
- /* Supporting for OSPF, BGP and PIM */
- if (client->proto != ZEBRA_ROUTE_OSPF
- && client->proto != ZEBRA_ROUTE_BGP
- && client->proto != ZEBRA_ROUTE_OSPF6
- && client->proto != ZEBRA_ROUTE_PIM)
+ if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
continue;
/* Notify to the protocol daemons. */
@@ -110,11 +107,7 @@ void zebra_bfd_peer_replay_req(void)
struct zserv *client;
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
- /* Supporting for BGP */
- if ((client->proto != ZEBRA_ROUTE_BGP)
- && (client->proto != ZEBRA_ROUTE_OSPF)
- && (client->proto != ZEBRA_ROUTE_OSPF6)
- && (client->proto != ZEBRA_ROUTE_PIM))
+ if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
continue;
/* Notify to the protocol daemons. */
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index bdcf03a055..4c35b1003f 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -886,6 +886,8 @@ static unsigned nexthop_active_check(struct route_node *rn,
int family;
char buf[SRCDEST2STR_BUFFER];
const struct prefix *p, *src_p;
+ struct zebra_vrf *zvrf;
+
srcdest_rnode_prefixes(rn, &p, &src_p);
if (rn->p.family == AF_INET)
@@ -949,7 +951,8 @@ static unsigned nexthop_active_check(struct route_node *rn,
}
/* XXX: What exactly do those checks do? Do we support
- * e.g. IPv4 routes with IPv6 nexthops or vice versa? */
+ * e.g. IPv4 routes with IPv6 nexthops or vice versa?
+ */
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);
@@ -969,9 +972,16 @@ static unsigned nexthop_active_check(struct route_node *rn,
memset(&nexthop->rmap_src.ipv6, 0, sizeof(union g_addr));
+ zvrf = zebra_vrf_lookup_by_id(nexthop->vrf_id);
+ if (!zvrf) {
+ if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+ zlog_debug("\t%s: zvrf is NULL", __PRETTY_FUNCTION__);
+ return CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
+ }
+
/* It'll get set if required inside */
- ret = zebra_route_map_check(family, re->type, re->instance, p, nexthop,
- nexthop->vrf_id, re->tag);
+ ret = zebra_route_map_check(family, re->type, re->instance, p,
+ nexthop, zvrf, re->tag);
if (ret == RMAP_DENYMATCH) {
if (IS_ZEBRA_DEBUG_RIB) {
srcdest_rnode2str(rn, buf, sizeof(buf));
@@ -1002,6 +1012,7 @@ static int nexthop_active_update(struct route_node *rn, struct route_entry *re,
union g_addr prev_src;
unsigned int prev_active, new_active, old_num_nh;
ifindex_t prev_index;
+
old_num_nh = re->nexthop_active_num;
re->nexthop_active_num = 0;
@@ -1890,14 +1901,12 @@ static void meta_queue_process_complete(struct work_queue *dummy)
continue;
zvrf->flags &= ~ZEBRA_VRF_RIB_SCHEDULED;
- zebra_evaluate_rnh(zvrf_id(zvrf), AF_INET, 0, RNH_NEXTHOP_TYPE,
+ zebra_evaluate_rnh(zvrf, AF_INET, 0, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(zvrf, AF_INET, 0, RNH_IMPORT_CHECK_TYPE,
NULL);
- zebra_evaluate_rnh(zvrf_id(zvrf), AF_INET, 0,
- RNH_IMPORT_CHECK_TYPE, NULL);
- zebra_evaluate_rnh(zvrf_id(zvrf), AF_INET6, 0, RNH_NEXTHOP_TYPE,
+ zebra_evaluate_rnh(zvrf, AF_INET6, 0, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(zvrf, AF_INET6, 0, RNH_IMPORT_CHECK_TYPE,
NULL);
- zebra_evaluate_rnh(zvrf_id(zvrf), AF_INET6, 0,
- RNH_IMPORT_CHECK_TYPE, NULL);
}
/* Schedule LSPs for processing, if needed. */
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 622ed5ac05..0a531990dc 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -260,13 +260,18 @@ void zebra_register_rnh_pseudowire(vrf_id_t vrf_id, struct zebra_pw *pw)
struct prefix nh;
struct rnh *rnh;
bool exists;
+ struct zebra_vrf *zvrf;
+
+ zvrf = vrf_info_lookup(vrf_id);
+ if (!zvrf)
+ return;
addr2hostprefix(pw->af, &pw->nexthop, &nh);
rnh = zebra_add_rnh(&nh, vrf_id, RNH_NEXTHOP_TYPE, &exists);
if (rnh && !listnode_lookup(rnh->zebra_pseudowire_list, pw)) {
listnode_add(rnh->zebra_pseudowire_list, pw);
pw->rnh = rnh;
- zebra_evaluate_rnh(vrf_id, pw->af, 1, RNH_NEXTHOP_TYPE, &nh);
+ zebra_evaluate_rnh(zvrf, pw->af, 1, RNH_NEXTHOP_TYPE, &nh);
}
}
@@ -289,7 +294,8 @@ void zebra_deregister_rnh_pseudowire(vrf_id_t vrf_id, struct zebra_pw *pw)
/* Apply the NHT route-map for a client to the route (and nexthops)
* resolving a NH.
*/
-static int zebra_rnh_apply_nht_rmap(int family, struct route_node *prn,
+static int zebra_rnh_apply_nht_rmap(int family, struct zebra_vrf *zvrf,
+ struct route_node *prn,
struct route_entry *re, int proto)
{
int at_least_one = 0;
@@ -302,8 +308,8 @@ static int zebra_rnh_apply_nht_rmap(int family, struct route_node *prn,
if (prn && re) {
for (nexthop = re->ng.nexthop; nexthop;
nexthop = nexthop->next) {
- ret = zebra_nht_route_map_check(rmap_family, proto,
- &prn->p, re, nexthop);
+ ret = zebra_nht_route_map_check(
+ rmap_family, proto, &prn->p, zvrf, re, nexthop);
if (ret != RMAP_DENYMATCH) {
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
at_least_one++; /* at least one valid NH */
@@ -320,7 +326,7 @@ static int zebra_rnh_apply_nht_rmap(int family, struct route_node *prn,
* for BGP route for import.
*/
static struct route_entry *
-zebra_rnh_resolve_import_entry(vrf_id_t vrfid, int family,
+zebra_rnh_resolve_import_entry(struct zebra_vrf *zvrf, int family,
struct route_node *nrn, struct rnh *rnh,
struct route_node **prn)
{
@@ -330,7 +336,7 @@ zebra_rnh_resolve_import_entry(vrf_id_t vrfid, int family,
*prn = NULL;
- route_table = zebra_vrf_table(family2afi(family), SAFI_UNICAST, vrfid);
+ route_table = zvrf->table[family2afi(family)][SAFI_UNICAST];
if (!route_table) // unexpected
return NULL;
@@ -402,11 +408,9 @@ static void zebra_rnh_eval_import_check_entry(vrf_id_t vrfid, int family,
/*
* Notify clients registered for this nexthop about a change.
*/
-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 route_entry *re)
+static void zebra_rnh_notify_protocol_clients(
+ struct zebra_vrf *zvrf, int family, struct route_node *nrn,
+ struct rnh *rnh, struct route_node *prn, struct route_entry *re)
{
struct listnode *node;
struct zserv *client;
@@ -418,11 +422,11 @@ static void zebra_rnh_notify_protocol_clients(vrf_id_t vrfid, int family,
prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
if (prn && re) {
prefix2str(&prn->p, bufp, INET6_ADDRSTRLEN);
- zlog_debug("%u:%s: NH resolved over route %s", vrfid,
- bufn, bufp);
+ zlog_debug("%u:%s: NH resolved over route %s",
+ zvrf->vrf->vrf_id, bufn, bufp);
} else
- zlog_debug("%u:%s: NH has become unresolved", vrfid,
- bufn);
+ zlog_debug("%u:%s: NH has become unresolved",
+ zvrf->vrf->vrf_id, bufn);
}
for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client)) {
@@ -432,7 +436,7 @@ static void zebra_rnh_notify_protocol_clients(vrf_id_t vrfid, int family,
* nexthop to see if it is filtered or not.
*/
num_resolving_nh = zebra_rnh_apply_nht_rmap(
- family, prn, re, client->proto);
+ family, zvrf, prn, re, client->proto);
if (num_resolving_nh)
rnh->filtered[client->proto] = 0;
else
@@ -441,7 +445,7 @@ static void zebra_rnh_notify_protocol_clients(vrf_id_t vrfid, int family,
if (IS_ZEBRA_DEBUG_NHT)
zlog_debug(
"%u:%s: Notifying client %s about NH %s",
- vrfid, bufn,
+ zvrf->vrf->vrf_id, bufn,
zebra_route_string(client->proto),
num_resolving_nh
? ""
@@ -451,11 +455,11 @@ static void zebra_rnh_notify_protocol_clients(vrf_id_t vrfid, int family,
if (IS_ZEBRA_DEBUG_NHT)
zlog_debug(
"%u:%s: Notifying client %s about NH (unreachable)",
- vrfid, bufn,
+ zvrf->vrf->vrf_id, bufn,
zebra_route_string(client->proto));
}
- send_client(rnh, client, RNH_NEXTHOP_TYPE, vrfid);
+ send_client(rnh, client, RNH_NEXTHOP_TYPE, zvrf->vrf->vrf_id);
}
}
@@ -519,7 +523,7 @@ static void zebra_rnh_process_pbr_tables(int family,
* nexthop.
*/
static struct route_entry *
-zebra_rnh_resolve_nexthop_entry(vrf_id_t vrfid, int family,
+zebra_rnh_resolve_nexthop_entry(struct zebra_vrf *zvrf, int family,
struct route_node *nrn, struct rnh *rnh,
struct route_node **prn)
{
@@ -529,7 +533,7 @@ zebra_rnh_resolve_nexthop_entry(vrf_id_t vrfid, int family,
*prn = NULL;
- route_table = zebra_vrf_table(family2afi(family), SAFI_UNICAST, vrfid);
+ route_table = zvrf->table[family2afi(family)][SAFI_UNICAST];
if (!route_table)
return NULL;
@@ -606,8 +610,8 @@ static void zebra_rnh_process_pseudowires(vrf_id_t vrfid, struct rnh *rnh)
* take appropriate action; this involves notifying any clients and/or
* scheduling dependent static routes for processing.
*/
-static void zebra_rnh_eval_nexthop_entry(vrf_id_t vrfid, int family, int force,
- struct route_node *nrn,
+static void zebra_rnh_eval_nexthop_entry(struct zebra_vrf *zvrf, int family,
+ int force, struct route_node *nrn,
struct rnh *rnh,
struct route_node *prn,
struct route_entry *re)
@@ -636,20 +640,20 @@ static void zebra_rnh_eval_nexthop_entry(vrf_id_t vrfid, int family, int force,
* rnh->state.
*/
/* Notify registered protocol clients. */
- zebra_rnh_notify_protocol_clients(vrfid, family, nrn, rnh, prn,
+ zebra_rnh_notify_protocol_clients(zvrf, family, nrn, rnh, prn,
rnh->state);
- zebra_rnh_process_pbr_tables(family, nrn, rnh, prn,
- rnh->state);
+ zebra_rnh_process_pbr_tables(family, nrn, rnh, prn, rnh->state);
/* Process pseudowires attached to this nexthop */
- zebra_rnh_process_pseudowires(vrfid, rnh);
+ zebra_rnh_process_pseudowires(zvrf->vrf->vrf_id, rnh);
}
}
/* Evaluate one tracked entry */
-static void zebra_rnh_evaluate_entry(vrf_id_t vrfid, int family, int force,
- rnh_type_t type, struct route_node *nrn)
+static void zebra_rnh_evaluate_entry(struct zebra_vrf *zvrf, int family,
+ int force, rnh_type_t type,
+ struct route_node *nrn)
{
struct rnh *rnh;
struct route_entry *re;
@@ -658,18 +662,18 @@ static void zebra_rnh_evaluate_entry(vrf_id_t vrfid, int family, int force,
if (IS_ZEBRA_DEBUG_NHT) {
prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
- zlog_debug("%u:%s: Evaluate RNH, type %d %s", vrfid, bufn, type,
- force ? "(force)" : "");
+ zlog_debug("%u:%s: Evaluate RNH, type %d %s", zvrf->vrf->vrf_id,
+ bufn, type, force ? "(force)" : "");
}
rnh = nrn->info;
/* Identify route entry (RE) resolving this tracked entry. */
if (type == RNH_IMPORT_CHECK_TYPE)
- re = zebra_rnh_resolve_import_entry(vrfid, family, nrn, rnh,
+ re = zebra_rnh_resolve_import_entry(zvrf, family, nrn, rnh,
&prn);
else
- re = zebra_rnh_resolve_nexthop_entry(vrfid, family, nrn, rnh,
+ re = zebra_rnh_resolve_nexthop_entry(zvrf, family, nrn, rnh,
&prn);
/* If the entry cannot be resolved and that is also the existing state,
@@ -680,11 +684,11 @@ static void zebra_rnh_evaluate_entry(vrf_id_t vrfid, int family, int force,
/* Process based on type of entry. */
if (type == RNH_IMPORT_CHECK_TYPE)
- zebra_rnh_eval_import_check_entry(vrfid, family, force, nrn,
- rnh, re);
+ zebra_rnh_eval_import_check_entry(zvrf->vrf->vrf_id, family,
+ force, nrn, rnh, re);
else
- zebra_rnh_eval_nexthop_entry(vrfid, family, force, nrn, rnh,
- prn, re);
+ zebra_rnh_eval_nexthop_entry(zvrf, family, force, nrn, rnh, prn,
+ re);
}
/*
@@ -696,7 +700,7 @@ static void zebra_rnh_evaluate_entry(vrf_id_t vrfid, int family, int force,
* we can have a situation where one re entry
* covers multiple nexthops we are interested in.
*/
-static void zebra_rnh_clear_nhc_flag(vrf_id_t vrfid, int family,
+static void zebra_rnh_clear_nhc_flag(struct zebra_vrf *zvrf, int family,
rnh_type_t type, struct route_node *nrn)
{
struct rnh *rnh;
@@ -707,10 +711,10 @@ static void zebra_rnh_clear_nhc_flag(vrf_id_t vrfid, int family,
/* Identify route entry (RIB) resolving this tracked entry. */
if (type == RNH_IMPORT_CHECK_TYPE)
- re = zebra_rnh_resolve_import_entry(vrfid, family, nrn, rnh,
+ re = zebra_rnh_resolve_import_entry(zvrf, family, nrn, rnh,
&prn);
else
- re = zebra_rnh_resolve_nexthop_entry(vrfid, family, nrn, rnh,
+ re = zebra_rnh_resolve_nexthop_entry(zvrf, family, nrn, rnh,
&prn);
if (re) {
@@ -722,13 +726,13 @@ static void zebra_rnh_clear_nhc_flag(vrf_id_t vrfid, int family,
/* Evaluate all tracked entries (nexthops or routes for import into BGP)
* of a particular VRF and address-family or a specific prefix.
*/
-void zebra_evaluate_rnh(vrf_id_t vrfid, int family, int force, rnh_type_t type,
- struct prefix *p)
+void zebra_evaluate_rnh(struct zebra_vrf *zvrf, int family, int force,
+ rnh_type_t type, struct prefix *p)
{
struct route_table *rnh_table;
struct route_node *nrn;
- rnh_table = get_rnh_table(vrfid, family, type);
+ rnh_table = get_rnh_table(zvrf->vrf->vrf_id, family, type);
if (!rnh_table) // unexpected
return;
@@ -736,7 +740,7 @@ void zebra_evaluate_rnh(vrf_id_t vrfid, int family, int force, rnh_type_t type,
/* Evaluating a specific entry, make sure it exists. */
nrn = route_node_lookup(rnh_table, p);
if (nrn && nrn->info)
- zebra_rnh_evaluate_entry(vrfid, family, force, type,
+ zebra_rnh_evaluate_entry(zvrf, family, force, type,
nrn);
if (nrn)
@@ -746,14 +750,14 @@ void zebra_evaluate_rnh(vrf_id_t vrfid, int family, int force, rnh_type_t type,
nrn = route_top(rnh_table);
while (nrn) {
if (nrn->info)
- zebra_rnh_evaluate_entry(vrfid, family, force,
+ zebra_rnh_evaluate_entry(zvrf, family, force,
type, nrn);
nrn = route_next(nrn); /* this will also unlock nrn */
}
nrn = route_top(rnh_table);
while (nrn) {
if (nrn->info)
- zebra_rnh_clear_nhc_flag(vrfid, family, type,
+ zebra_rnh_clear_nhc_flag(zvrf, family, type,
nrn);
nrn = route_next(nrn); /* this will also unlock nrn */
}
diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h
index f4b4b56390..33302f0ee2 100644
--- a/zebra/zebra_rnh.h
+++ b/zebra/zebra_rnh.h
@@ -79,7 +79,7 @@ extern void zebra_register_rnh_pseudowire(vrf_id_t, struct zebra_pw *);
extern void zebra_deregister_rnh_pseudowire(vrf_id_t, struct zebra_pw *);
extern void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client,
rnh_type_t type);
-extern void zebra_evaluate_rnh(vrf_id_t vrfid, int family, int force,
+extern void zebra_evaluate_rnh(struct zebra_vrf *zvrf, int family, int force,
rnh_type_t type, struct prefix *p);
extern void zebra_print_rnh_table(vrf_id_t vrfid, int family, struct vty *vty,
rnh_type_t);
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 7a6bc6684d..bacef49836 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -39,11 +39,12 @@
#include "zebra/zebra_rnh.h"
#include "zebra/zebra_routemap.h"
+#ifndef VTYSH_EXTRACT_PL
+#include "zebra/zebra_routemap_clippy.c"
+#endif
+
static uint32_t zebra_rmap_update_timer = ZEBRA_RMAP_DEFAULT_UPDATE_TIMER;
static struct thread *zebra_t_rmap_update = NULL;
-char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX + 1]; /* "any" == ZEBRA_ROUTE_MAX */
-/* NH Tracking route map */
-char *nht_rm[AFI_MAX][ZEBRA_ROUTE_MAX + 1]; /* "any" == ZEBRA_ROUTE_MAX */
char *zebra_import_table_routemap[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX];
struct nh_rmap_obj {
@@ -199,11 +200,223 @@ static void route_match_interface_free(void *rule)
XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
}
+static void show_vrf_proto_rm(struct vty *vty, struct zebra_vrf *zvrf,
+ int af_type)
+{
+ int i;
+
+ vty_out(vty, "Protocol : route-map\n");
+ vty_out(vty, "------------------------\n");
+
+ for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
+ if (PROTO_RM_NAME(zvrf, af_type, i))
+ vty_out(vty, "%-10s : %-10s\n", zebra_route_string(i),
+ PROTO_RM_NAME(zvrf, af_type, i));
+ else
+ vty_out(vty, "%-10s : none\n", zebra_route_string(i));
+ }
+
+ if (PROTO_RM_NAME(zvrf, af_type, i))
+ vty_out(vty, "%-10s : %-10s\n", "any",
+ PROTO_RM_NAME(zvrf, af_type, i));
+ else
+ vty_out(vty, "%-10s : none\n", "any");
+}
+
+static void show_vrf_nht_rm(struct vty *vty, struct zebra_vrf *zvrf,
+ int af_type)
+{
+ int i;
+
+ vty_out(vty, "Protocol : route-map\n");
+ vty_out(vty, "------------------------\n");
+
+ for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
+ if (NHT_RM_NAME(zvrf, af_type, i))
+ vty_out(vty, "%-10s : %-10s\n", zebra_route_string(i),
+ NHT_RM_NAME(zvrf, af_type, i));
+ else
+ vty_out(vty, "%-10s : none\n", zebra_route_string(i));
+ }
+
+ if (NHT_RM_NAME(zvrf, af_type, i))
+ vty_out(vty, "%-10s : %-10s\n", "any",
+ NHT_RM_NAME(zvrf, af_type, i));
+ else
+ vty_out(vty, "%-10s : none\n", "any");
+}
+
+static int show_proto_rm(struct vty *vty, int af_type, const char *vrf_all,
+ const char *vrf_name)
+{
+ struct zebra_vrf *zvrf;
+
+ if (vrf_all) {
+ struct vrf *vrf;
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ zvrf = (struct zebra_vrf *)vrf->info;
+ if (zvrf == NULL)
+ continue;
+ vty_out(vty, "VRF: %s\n", zvrf->vrf->name);
+ show_vrf_proto_rm(vty, zvrf, af_type);
+ }
+ } else {
+ vrf_id_t vrf_id = VRF_DEFAULT;
+
+ if (vrf_name)
+ VRF_GET_ID(vrf_id, vrf_name, false);
+
+ zvrf = zebra_vrf_lookup_by_id(vrf_id);
+ if (!zvrf)
+ return CMD_SUCCESS;
+
+ vty_out(vty, "VRF: %s\n", zvrf->vrf->name);
+ show_vrf_proto_rm(vty, zvrf, af_type);
+ }
+
+ return CMD_SUCCESS;
+}
+
+static int show_nht_rm(struct vty *vty, int af_type, const char *vrf_all,
+ const char *vrf_name)
+{
+ struct zebra_vrf *zvrf;
+
+ if (vrf_all) {
+ struct vrf *vrf;
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ zvrf = (struct zebra_vrf *)vrf->info;
+ if (zvrf == NULL)
+ continue;
+
+ vty_out(vty, "VRF: %s\n", zvrf->vrf->name);
+ show_vrf_nht_rm(vty, zvrf, af_type);
+ }
+ } else {
+ vrf_id_t vrf_id = VRF_DEFAULT;
+
+ if (vrf_name)
+ VRF_GET_ID(vrf_id, vrf_name, false);
+
+ zvrf = zebra_vrf_lookup_by_id(vrf_id);
+ if (!zvrf)
+ return CMD_SUCCESS;
+
+ vty_out(vty, "VRF: %s\n", zvrf->vrf->name);
+ show_vrf_nht_rm(vty, zvrf, af_type);
+ }
+
+ return CMD_SUCCESS;
+}
+
/* Route map commands for interface matching */
struct route_map_rule_cmd route_match_interface_cmd = {
"interface", route_match_interface, route_match_interface_compile,
route_match_interface_free};
+static int ip_protocol_rm_add(struct zebra_vrf *zvrf, const char *rmap,
+ int rtype, afi_t afi, safi_t safi)
+{
+ struct route_table *table;
+
+ if (PROTO_RM_NAME(zvrf, afi, rtype)) {
+ if (strcmp(PROTO_RM_NAME(zvrf, afi, rtype), rmap) == 0)
+ return CMD_SUCCESS;
+
+ XFREE(MTYPE_ROUTE_MAP_NAME, PROTO_RM_NAME(zvrf, afi, rtype));
+ }
+
+ PROTO_RM_NAME(zvrf, afi, rtype) = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap);
+ PROTO_RM_MAP(zvrf, afi, rtype) =
+ route_map_lookup_by_name(PROTO_RM_NAME(zvrf, afi, rtype));
+
+ if (PROTO_RM_MAP(zvrf, afi, rtype)) {
+
+ if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+ zlog_debug(
+ "%u: IPv4 Routemap config for protocol %d scheduling RIB processing",
+ zvrf->vrf->vrf_id, rtype);
+ /* Process routes of interested address-families. */
+ table = zebra_vrf_table(afi, safi, zvrf->vrf->vrf_id);
+ if (table)
+ rib_update_table(table, RIB_UPDATE_RMAP_CHANGE);
+ }
+
+ return CMD_SUCCESS;
+}
+
+static int ip_protocol_rm_del(struct zebra_vrf *zvrf, const char *rmap,
+ int rtype, afi_t afi, safi_t safi)
+{
+ struct route_table *table;
+
+ if (!PROTO_RM_NAME(zvrf, afi, rtype))
+ return CMD_SUCCESS;
+
+ if (!rmap || strcmp(rmap, PROTO_RM_NAME(zvrf, afi, rtype)) == 0) {
+ if (PROTO_RM_MAP(zvrf, afi, rtype)) {
+ if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+ zlog_debug(
+ "%u: IPv4 Routemap unconfig for protocol %d, scheduling RIB processing",
+ zvrf->vrf->vrf_id, rtype);
+ PROTO_RM_MAP(zvrf, afi, rtype) = NULL;
+
+ /* Process routes of interested address-families. */
+ table = zebra_vrf_table(afi, safi, zvrf->vrf->vrf_id);
+ if (table)
+ rib_update_table(table, RIB_UPDATE_RMAP_CHANGE);
+ }
+ XFREE(MTYPE_ROUTE_MAP_NAME, PROTO_RM_NAME(zvrf, afi, rtype));
+ }
+ return CMD_SUCCESS;
+}
+
+static int ip_nht_rm_add(struct zebra_vrf *zvrf, const char *rmap, int rtype,
+ int afi)
+{
+
+ if (NHT_RM_NAME(zvrf, afi, rtype)) {
+ if (strcmp(NHT_RM_NAME(zvrf, afi, rtype), rmap) == 0)
+ return CMD_SUCCESS;
+
+ XFREE(MTYPE_ROUTE_MAP_NAME, NHT_RM_NAME(zvrf, afi, rtype));
+ }
+
+ NHT_RM_NAME(zvrf, afi, rtype) = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap);
+ NHT_RM_MAP(zvrf, afi, rtype) =
+ route_map_lookup_by_name(NHT_RM_NAME(zvrf, afi, rtype));
+
+ if (NHT_RM_MAP(zvrf, afi, rtype))
+ zebra_evaluate_rnh(zvrf, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
+
+ return CMD_SUCCESS;
+}
+
+static int ip_nht_rm_del(struct zebra_vrf *zvrf, const char *rmap, int rtype,
+ int afi)
+{
+
+ if (!NHT_RM_NAME(zvrf, afi, rtype))
+ return CMD_SUCCESS;
+
+ if (!rmap || strcmp(rmap, NHT_RM_NAME(zvrf, afi, rtype)) == 0) {
+ if (NHT_RM_MAP(zvrf, afi, rtype)) {
+ if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+ zlog_debug(
+ "%u: IPv4 Routemap unconfig for protocol %d, scheduling RIB processing",
+ zvrf->vrf->vrf_id, rtype);
+ NHT_RM_MAP(zvrf, afi, rtype) = NULL;
+
+ zebra_evaluate_rnh(zvrf, AF_INET, 1, RNH_NEXTHOP_TYPE,
+ NULL);
+ }
+ XFREE(MTYPE_ROUTE_MAP_NAME, NHT_RM_NAME(zvrf, afi, rtype));
+ }
+ return CMD_SUCCESS;
+}
+
DEFUN (match_ip_address_prefix_len,
match_ip_address_prefix_len_cmd,
"match ip address prefix-len (0-32)",
@@ -477,251 +690,194 @@ DEFUN (no_zebra_route_map_timer,
return (CMD_SUCCESS);
}
-
-DEFUN (ip_protocol,
+DEFPY (ip_protocol,
ip_protocol_cmd,
- "ip protocol " FRR_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
+ "ip protocol " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
+ " $proto route-map ROUTE-MAP$rmap",
IP_STR
"Filter routing info exchanged between zebra and protocol\n"
FRR_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
"Specify route-map\n"
"Route map name\n")
{
- char *proto = argv[2]->text;
- char *rmap = argv[4]->arg;
- int i;
+ int ret, rtype;
+
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
if (strcasecmp(proto, "any") == 0)
- i = ZEBRA_ROUTE_MAX;
+ rtype = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(proto);
- if (i < 0) {
+ rtype = proto_name2num(proto);
+ if (rtype < 0) {
vty_out(vty, "invalid protocol name \"%s\"\n", proto);
return CMD_WARNING_CONFIG_FAILED;
}
- if (proto_rm[AFI_IP][i]) {
- if (strcmp(proto_rm[AFI_IP][i], rmap) == 0)
- return CMD_SUCCESS;
- XFREE(MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]);
- }
- proto_rm[AFI_IP][i] = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap);
+ ret = ip_protocol_rm_add(zvrf, rmap, rtype, AFI_IP, SAFI_UNICAST);
- if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- zlog_debug(
- "%u: IPv4 Routemap config for protocol %s, scheduling RIB processing",
- VRF_DEFAULT, proto);
-
- rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (no_ip_protocol,
+DEFPY (no_ip_protocol,
no_ip_protocol_cmd,
- "no ip protocol " FRR_IP_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]",
+ "no ip protocol " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
+ " $proto [route-map ROUTE-MAP$rmap]",
NO_STR
IP_STR
"Stop filtering routing info between zebra and protocol\n"
FRR_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
- "Specify route map\n"
+ "Specify route-map\n"
"Route map name\n")
{
- char *proto = argv[3]->text;
- char *rmap = (argc == 6) ? argv[5]->arg : NULL;
- int i;
+ int ret, rtype;
+
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
if (strcasecmp(proto, "any") == 0)
- i = ZEBRA_ROUTE_MAX;
+ rtype = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(proto);
-
- if (i < 0) {
+ rtype = proto_name2num(proto);
+ if (rtype < 0) {
vty_out(vty, "invalid protocol name \"%s\"\n", proto);
return CMD_WARNING_CONFIG_FAILED;
}
- if (!proto_rm[AFI_IP][i])
- return CMD_SUCCESS;
-
- if (!rmap || strcmp(rmap, proto_rm[AFI_IP][i]) == 0) {
- XFREE(MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]);
- proto_rm[AFI_IP][i] = NULL;
+ ret = ip_protocol_rm_del(zvrf, rmap, rtype, AFI_IP, SAFI_UNICAST);
- if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- zlog_debug(
- "%u: IPv4 Routemap unconfig for protocol %s, scheduling RIB processing",
- VRF_DEFAULT, proto);
- rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
- }
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (show_ip_protocol,
+DEFPY (show_ip_protocol,
show_ip_protocol_cmd,
- "show ip protocol",
- SHOW_STR
- IP_STR
- "IP protocol filtering status\n")
+ "show ip protocol [vrf <NAME$vrf_name|all$vrf_all>]",
+ SHOW_STR
+ IP_STR
+ "IP protocol filtering status\n"
+ VRF_FULL_CMD_HELP_STR)
{
- int i;
+ int ret = show_proto_rm(vty, AFI_IP, vrf_all, vrf_name);
- vty_out(vty, "Protocol : route-map \n");
- vty_out(vty, "------------------------\n");
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (proto_rm[AFI_IP][i])
- vty_out(vty, "%-10s : %-10s\n", zebra_route_string(i),
- proto_rm[AFI_IP][i]);
- else
- vty_out(vty, "%-10s : none\n", zebra_route_string(i));
- }
- if (proto_rm[AFI_IP][i])
- vty_out(vty, "%-10s : %-10s\n", "any", proto_rm[AFI_IP][i]);
- else
- vty_out(vty, "%-10s : none\n", "any");
-
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (ipv6_protocol,
+DEFPY (ipv6_protocol,
ipv6_protocol_cmd,
- "ipv6 protocol " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
+ "ipv6 protocol " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA
+ " $proto route-map ROUTE-MAP$rmap",
IP6_STR
"Filter IPv6 routing info exchanged between zebra and protocol\n"
FRR_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
- "Specify route map\n"
+ "Specify route-map\n"
"Route map name\n")
{
- char *proto = argv[2]->text;
- char *rmap = argv[4]->arg;
- int i;
+ int ret, rtype;
+
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
if (strcasecmp(proto, "any") == 0)
- i = ZEBRA_ROUTE_MAX;
+ rtype = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(proto);
- if (i < 0) {
+ rtype = proto_name2num(proto);
+ if (rtype < 0) {
vty_out(vty, "invalid protocol name \"%s\"\n", proto);
return CMD_WARNING_CONFIG_FAILED;
}
- if (proto_rm[AFI_IP6][i]) {
- if (strcmp(proto_rm[AFI_IP6][i], rmap) == 0)
- return CMD_SUCCESS;
-
- XFREE(MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]);
- }
- proto_rm[AFI_IP6][i] = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap);
- if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- zlog_debug(
- "%u: IPv6 Routemap config for protocol %s, scheduling RIB processing",
- VRF_DEFAULT, proto);
+ ret = ip_protocol_rm_add(zvrf, rmap, rtype, AFI_IP6, SAFI_UNICAST);
- rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (no_ipv6_protocol,
+DEFPY (no_ipv6_protocol,
no_ipv6_protocol_cmd,
- "no ipv6 protocol " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]",
+ "no ipv6 protocol " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA
+ " $proto [route-map ROUTE-MAP$rmap]",
NO_STR
IP6_STR
"Stop filtering IPv6 routing info between zebra and protocol\n"
FRR_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
- "Specify route map\n"
+ "Specify route-map\n"
"Route map name\n")
{
- const char *proto = argv[3]->text;
- const char *rmap = (argc == 6) ? argv[5]->arg : NULL;
- int i;
+ int ret, rtype;
+
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
if (strcasecmp(proto, "any") == 0)
- i = ZEBRA_ROUTE_MAX;
+ rtype = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(proto);
- if (i < 0) {
+ rtype = proto_name2num(proto);
+ if (rtype < 0) {
vty_out(vty, "invalid protocol name \"%s\"\n", proto);
return CMD_WARNING_CONFIG_FAILED;
}
- if (!proto_rm[AFI_IP6][i])
- return CMD_SUCCESS;
- if (!rmap || strcmp(rmap, proto_rm[AFI_IP6][i]) == 0) {
- XFREE(MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]);
- proto_rm[AFI_IP6][i] = NULL;
+ ret = ip_protocol_rm_del(zvrf, rmap, rtype, AFI_IP6, SAFI_UNICAST);
- if (IS_ZEBRA_DEBUG_RIB_DETAILED)
- zlog_debug(
- "%u: IPv6 Routemap unconfig for protocol %s, scheduling RIB processing",
- VRF_DEFAULT, proto);
-
- rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
- }
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (show_ipv6_protocol,
+DEFPY (show_ipv6_protocol,
show_ipv6_protocol_cmd,
- "show ipv6 protocol",
- SHOW_STR
- IP6_STR
- "IPv6 protocol filtering status\n")
+ "show ipv6 protocol [vrf <NAME$vrf_name|all$vrf_all>]",
+ SHOW_STR
+ IP6_STR
+ "IPv6 protocol filtering status\n"
+ VRF_FULL_CMD_HELP_STR)
{
- int i;
+ int ret = show_proto_rm(vty, AFI_IP6, vrf_all, vrf_name);
- vty_out(vty, "Protocol : route-map \n");
- vty_out(vty, "------------------------\n");
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (proto_rm[AFI_IP6][i])
- vty_out(vty, "%-10s : %-10s\n", zebra_route_string(i),
- proto_rm[AFI_IP6][i]);
- else
- vty_out(vty, "%-10s : none\n", zebra_route_string(i));
- }
- if (proto_rm[AFI_IP6][i])
- vty_out(vty, "%-10s : %-10s\n", "any", proto_rm[AFI_IP6][i]);
- else
- vty_out(vty, "%-10s : none\n", "any");
-
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (ip_protocol_nht_rmap,
+DEFPY (ip_protocol_nht_rmap,
ip_protocol_nht_rmap_cmd,
- "ip nht " FRR_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
+ "ip nht " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
+ " $proto route-map ROUTE-MAP$rmap",
IP_STR
"Filter Next Hop tracking route resolution\n"
FRR_IP_PROTOCOL_MAP_HELP_STR_ZEBRA
"Specify route map\n"
"Route map name\n")
{
- char *proto = argv[2]->text;
- char *rmap = argv[4]->arg;
- int i;
+
+ int ret, rtype;
+
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
if (strcasecmp(proto, "any") == 0)
- i = ZEBRA_ROUTE_MAX;
+ rtype = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(proto);
- if (i < 0) {
+ rtype = proto_name2num(proto);
+ if (rtype < 0) {
vty_out(vty, "invalid protocol name \"%s\"\n", proto);
return CMD_WARNING_CONFIG_FAILED;
}
- if (nht_rm[AFI_IP][i]) {
- if (strcmp(nht_rm[AFI_IP][i], rmap) == 0)
- return CMD_SUCCESS;
-
- XFREE(MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]);
- }
- nht_rm[AFI_IP][i] = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap);
- zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
+ ret = ip_nht_rm_add(zvrf, rmap, rtype, AFI_IP);
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (no_ip_protocol_nht_rmap,
+DEFPY (no_ip_protocol_nht_rmap,
no_ip_protocol_nht_rmap_cmd,
- "no ip nht " FRR_IP_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]",
+ "no ip nht " FRR_IP_PROTOCOL_MAP_STR_ZEBRA
+ " $proto route-map [ROUTE-MAP$rmap]",
NO_STR
IP_STR
"Filter Next Hop tracking route resolution\n"
@@ -729,89 +885,76 @@ DEFUN (no_ip_protocol_nht_rmap,
"Specify route map\n"
"Route map name\n")
{
- int idx = 0;
- char *proto = argv[3]->text;
- char *rmap = argv_find(argv, argc, "ROUTE-MAP", &idx) ? argv[idx]->arg
- : NULL;
+ int ret, rtype;
- int i = strmatch(proto, "any") ? ZEBRA_ROUTE_MAX
- : proto_name2num(proto);
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
- if (i < 0) {
+ if (!zvrf)
+ return CMD_WARNING;
+
+ if (strcasecmp(proto, "any") == 0)
+ rtype = ZEBRA_ROUTE_MAX;
+ else
+ rtype = proto_name2num(proto);
+ if (rtype < 0) {
vty_out(vty, "invalid protocol name \"%s\"\n", proto);
return CMD_WARNING_CONFIG_FAILED;
}
- if (!nht_rm[AFI_IP][i])
- return CMD_SUCCESS;
+ ret = ip_nht_rm_del(zvrf, rmap, rtype, AFI_IP);
- if (!rmap || strcmp(rmap, nht_rm[AFI_IP][i]) == 0) {
- XFREE(MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]);
- nht_rm[AFI_IP][i] = NULL;
- zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
- }
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (show_ip_protocol_nht,
+DEFPY (show_ip_protocol_nht,
show_ip_protocol_nht_cmd,
- "show ip nht route-map",
+ "show ip nht route-map [vrf <NAME$vrf_name|all$vrf_all>]",
SHOW_STR
IP_STR
"IP nexthop tracking table\n"
- "IP Next Hop tracking filtering status\n")
+ "IP Next Hop tracking filtering status\n"
+ VRF_FULL_CMD_HELP_STR)
{
- int i;
+ int ret = show_nht_rm(vty, AFI_IP, vrf_all, vrf_name);
- vty_out(vty, "Protocol : route-map \n");
- vty_out(vty, "------------------------\n");
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (nht_rm[AFI_IP][i])
- vty_out(vty, "%-10s : %-10s\n", zebra_route_string(i),
- nht_rm[AFI_IP][i]);
- else
- vty_out(vty, "%-10s : none\n", zebra_route_string(i));
- }
- if (nht_rm[AFI_IP][i])
- vty_out(vty, "%-10s : %-10s\n", "any", nht_rm[AFI_IP][i]);
- else
- vty_out(vty, "%-10s : none\n", "any");
-
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (ipv6_protocol_nht_rmap,
+DEFPY (ipv6_protocol_nht_rmap,
ipv6_protocol_nht_rmap_cmd,
- "ipv6 nht " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP",
+ "ipv6 nht " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA
+ " $proto route-map ROUTE-MAP$rmap",
IP6_STR
"Filter Next Hop tracking route resolution\n"
FRR_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA
"Specify route map\n"
"Route map name\n")
{
- char *proto = argv[2]->text;
- char *rmap = argv[4]->arg;
- int i;
+ int ret, rtype;
+
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
if (strcasecmp(proto, "any") == 0)
- i = ZEBRA_ROUTE_MAX;
+ rtype = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(proto);
- if (i < 0) {
+ rtype = proto_name2num(proto);
+ if (rtype < 0) {
vty_out(vty, "invalid protocol name \"%s\"\n", proto);
return CMD_WARNING_CONFIG_FAILED;
}
- if (nht_rm[AFI_IP6][i])
- XFREE(MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP6][i]);
- nht_rm[AFI_IP6][i] = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap);
- zebra_evaluate_rnh(0, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
- return CMD_SUCCESS;
+ ret = ip_nht_rm_add(zvrf, rmap, rtype, AFI_IP6);
+
+ return ret;
}
-DEFUN (no_ipv6_protocol_nht_rmap,
+DEFPY (no_ipv6_protocol_nht_rmap,
no_ipv6_protocol_nht_rmap_cmd,
- "no ipv6 nht " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]",
+ "no ipv6 nht " FRR_IP6_PROTOCOL_MAP_STR_ZEBRA
+ " $proto [route-map ROUTE-MAP$rmap]",
NO_STR
IP6_STR
"Filter Next Hop tracking route resolution\n"
@@ -819,59 +962,39 @@ DEFUN (no_ipv6_protocol_nht_rmap,
"Specify route map\n"
"Route map name\n")
{
- char *proto = argv[3]->text;
- char *rmap = (argc == 6) ? argv[5]->arg : NULL;
- int i;
+ int ret, rtype;
+
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
if (strcasecmp(proto, "any") == 0)
- i = ZEBRA_ROUTE_MAX;
+ rtype = ZEBRA_ROUTE_MAX;
else
- i = proto_name2num(proto);
- if (i < 0) {
+ rtype = proto_name2num(proto);
+ if (rtype < 0) {
vty_out(vty, "invalid protocol name \"%s\"\n", proto);
return CMD_WARNING_CONFIG_FAILED;
}
- if (nht_rm[AFI_IP6][i] && rmap && strcmp(rmap, nht_rm[AFI_IP6][i])) {
- vty_out(vty, "invalid route-map \"%s\"\n", rmap);
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- if (nht_rm[AFI_IP6][i]) {
- XFREE(MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP6][i]);
- nht_rm[AFI_IP6][i] = NULL;
- }
+ ret = ip_nht_rm_del(zvrf, rmap, rtype, AFI_IP6);
- zebra_evaluate_rnh(0, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
-
- return CMD_SUCCESS;
+ return ret;
}
-DEFUN (show_ipv6_protocol_nht,
+DEFPY (show_ipv6_protocol_nht,
show_ipv6_protocol_nht_cmd,
- "show ipv6 nht route-map",
+ "show ipv6 nht route-map [vrf <NAME$vrf_name|all$vrf_all>]",
SHOW_STR
IP6_STR
"Next Hop filtering status\n"
- "Route-map\n")
+ "Route-map\n"
+ VRF_FULL_CMD_HELP_STR)
{
- int i;
+ int ret = show_nht_rm(vty, AFI_IP6, vrf_all, vrf_name);
- vty_out(vty, "Protocol : route-map \n");
- vty_out(vty, "------------------------\n");
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (nht_rm[AFI_IP6][i])
- vty_out(vty, "%-10s : %-10s\n", zebra_route_string(i),
- nht_rm[AFI_IP6][i]);
- else
- vty_out(vty, "%-10s : none\n", zebra_route_string(i));
- }
- if (nht_rm[AFI_IP][i])
- vty_out(vty, "%-10s : %-10s\n", "any", nht_rm[AFI_IP6][i]);
- else
- vty_out(vty, "%-10s : none\n", "any");
-
- return CMD_SUCCESS;
+ return ret;
}
/*XXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
@@ -1309,42 +1432,63 @@ static void zebra_rib_table_rm_update(const char *rmap)
{
int i = 0;
struct route_table *table;
+ struct vrf *vrf = NULL;
+ struct zebra_vrf *zvrf = NULL;
char *rmap_name;
char afi_ip = 0;
char afi_ipv6 = 0;
- for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
- /* Check for ip routemap table */
- rmap_name = proto_rm[AFI_IP][i];
- if (rmap_name && (strcmp(rmap_name, rmap) == 0)) {
- if (IS_ZEBRA_DEBUG_EVENT)
- zlog_debug("%s : AFI_IP rmap %s, route type %s",
- __func__, rmap, zebra_route_string(i));
- /* There is single rib table for all protocols */
- if (afi_ip == 0) {
- table = zebra_vrf_table(AFI_IP, SAFI_UNICAST,
- VRF_DEFAULT);
- if (table) {
- afi_ip = 1;
- rib_update_table(table,
- RIB_UPDATE_RMAP_CHANGE);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ zvrf = vrf->info;
+ if (!zvrf)
+ continue;
+ for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
+ rmap_name = PROTO_RM_NAME(zvrf, AFI_IP, i);
+ if (rmap_name && (strcmp(rmap_name, rmap) == 0)) {
+ if (IS_ZEBRA_DEBUG_EVENT)
+ zlog_debug(
+ "%s : AFI_IP rmap %s, route type %s",
+ __func__, rmap,
+ zebra_route_string(i));
+
+ PROTO_RM_MAP(zvrf, AFI_IP, i) =
+ route_map_lookup_by_name(rmap_name);
+ /* There is single rib table for all protocols
+ */
+ if (afi_ip == 0) {
+ table = zvrf->table[AFI_IP]
+ [SAFI_UNICAST];
+ if (table) {
+
+ afi_ip = 1;
+ rib_update_table(
+ table,
+ RIB_UPDATE_RMAP_CHANGE);
+ }
}
}
- }
-
- /* Check for ipv6 routemap table */
- rmap_name = proto_rm[AFI_IP6][i];
- if (rmap_name && (strcmp(rmap_name, rmap) == 0)) {
- if (IS_ZEBRA_DEBUG_EVENT)
- zlog_debug("%s : AFI_IP6 rmap %s,route type %s",
- __func__, rmap, zebra_route_string(i));
- if (afi_ipv6 == 0) {
- table = zebra_vrf_table(AFI_IP6, SAFI_UNICAST,
- VRF_DEFAULT);
- if (table) {
- afi_ipv6 = 1;
- rib_update_table(table,
- RIB_UPDATE_RMAP_CHANGE);
+ rmap_name = PROTO_RM_NAME(zvrf, AFI_IP6, i);
+ if (rmap_name && (strcmp(rmap_name, rmap) == 0)) {
+ if (IS_ZEBRA_DEBUG_EVENT)
+ zlog_debug(
+ "%s : AFI_IP6 rmap %s, route type %s",
+ __func__, rmap,
+ zebra_route_string(i));
+
+ PROTO_RM_MAP(zvrf, AFI_IP6, i) =
+ route_map_lookup_by_name(rmap_name);
+ /* There is single rib table for all protocols
+ */
+ if (afi_ipv6 == 0) {
+ table = zvrf->table[AFI_IP6]
+ [SAFI_UNICAST];
+ if (table) {
+
+ afi_ipv6 = 1;
+ rib_update_table(
+ table,
+ RIB_UPDATE_RMAP_CHANGE);
+ }
}
}
}
@@ -1358,31 +1502,68 @@ static void zebra_rib_table_rm_update(const char *rmap)
static void zebra_nht_rm_update(const char *rmap)
{
int i = 0;
+ struct route_table *table;
+ struct vrf *vrf = NULL;
+ struct zebra_vrf *zvrf = NULL;
char *rmap_name;
char afi_ip = 0;
char afi_ipv6 = 0;
- for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
- rmap_name = nht_rm[AFI_IP][i];
- if (rmap_name && (strcmp(rmap_name, rmap) == 0)) {
- if (IS_ZEBRA_DEBUG_EVENT)
- zlog_debug("%s : AFI_IP rmap %s route type %s",
- __func__, rmap, zebra_route_string(i));
- if (afi_ip == 0) {
- afi_ip = 1;
- zebra_evaluate_rnh(0, AF_INET, 1,
- RNH_NEXTHOP_TYPE, NULL);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ zvrf = vrf->info;
+ if (!zvrf)
+ continue;
+ for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
+ rmap_name = NHT_RM_NAME(zvrf, AFI_IP, i);
+ if (rmap_name && (strcmp(rmap_name, rmap) == 0)) {
+ if (IS_ZEBRA_DEBUG_EVENT)
+ zlog_debug(
+ "%s : AFI_IP rmap %s, route type %s",
+ __func__, rmap,
+ zebra_route_string(i));
+
+ NHT_RM_MAP(zvrf, AFI_IP, i) =
+ route_map_lookup_by_name(rmap_name);
+ /* There is single rib table for all protocols
+ */
+ if (afi_ip == 0) {
+ table = zvrf->table[AFI_IP]
+ [SAFI_UNICAST];
+ if (table) {
+
+ afi_ip = 1;
+
+ zebra_evaluate_rnh(
+ zvrf, AF_INET, 1,
+ RNH_NEXTHOP_TYPE, NULL);
+ }
+ }
}
- }
- rmap_name = nht_rm[AFI_IP6][i];
- if (rmap_name && (strcmp(rmap_name, rmap) == 0)) {
- if (IS_ZEBRA_DEBUG_EVENT)
- zlog_debug("%s : AFI_IP6 rmap %s route type %s",
- __func__, rmap, zebra_route_string(i));
- if (afi_ipv6 == 0) {
- afi_ipv6 = 1;
- zebra_evaluate_rnh(0, AF_INET6, 1,
- RNH_NEXTHOP_TYPE, NULL);
+
+ rmap_name = NHT_RM_NAME(zvrf, AFI_IP6, i);
+ if (rmap_name && (strcmp(rmap_name, rmap) == 0)) {
+ if (IS_ZEBRA_DEBUG_EVENT)
+ zlog_debug(
+ "%s : AFI_IP6 rmap %s, route type %s",
+ __func__, rmap,
+ zebra_route_string(i));
+
+ NHT_RM_MAP(zvrf, AFI_IP6, i) =
+ route_map_lookup_by_name(rmap_name);
+ /* There is single rib table for all protocols
+ */
+ if (afi_ipv6 == 0) {
+ table = zvrf->table[AFI_IP6]
+ [SAFI_UNICAST];
+ if (table) {
+
+ afi_ipv6 = 1;
+
+ zebra_evaluate_rnh(
+ zvrf, AF_INET, 1,
+ RNH_NEXTHOP_TYPE, NULL);
+ }
+ }
}
}
}
@@ -1439,28 +1620,26 @@ void zebra_route_map_write_delay_timer(struct vty *vty)
return;
}
-route_map_result_t zebra_route_map_check(int family, int rib_type,
- uint8_t instance,
- const struct prefix *p,
- struct nexthop *nexthop,
- vrf_id_t vrf_id, route_tag_t tag)
+route_map_result_t
+zebra_route_map_check(int family, int rib_type, uint8_t instance,
+ const struct prefix *p, struct nexthop *nexthop,
+ struct zebra_vrf *zvrf, route_tag_t tag)
{
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 = vrf_id;
+ nh_obj.vrf_id = nexthop->vrf_id;
nh_obj.source_protocol = rib_type;
nh_obj.instance = instance;
nh_obj.metric = 0;
nh_obj.tag = tag;
if (rib_type >= 0 && rib_type < ZEBRA_ROUTE_MAX)
- rmap = route_map_lookup_by_name(proto_rm[family][rib_type]);
- if (!rmap && proto_rm[family][ZEBRA_ROUTE_MAX])
- rmap = route_map_lookup_by_name(
- proto_rm[family][ZEBRA_ROUTE_MAX]);
+ rmap = PROTO_RM_MAP(zvrf, family, rib_type);
+ if (!rmap && PROTO_RM_NAME(zvrf, family, ZEBRA_ROUTE_MAX))
+ rmap = PROTO_RM_MAP(zvrf, family, ZEBRA_ROUTE_MAX);
if (rmap) {
ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj);
}
@@ -1514,6 +1693,7 @@ zebra_import_table_route_map_check(int family, int re_type, uint8_t instance,
route_map_result_t zebra_nht_route_map_check(int family, int client_proto,
const struct prefix *p,
+ struct zebra_vrf *zvrf,
struct route_entry *re,
struct nexthop *nexthop)
{
@@ -1529,10 +1709,9 @@ route_map_result_t zebra_nht_route_map_check(int family, int client_proto,
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]);
- if (!rmap && nht_rm[family][ZEBRA_ROUTE_MAX])
- rmap = route_map_lookup_by_name(
- nht_rm[family][ZEBRA_ROUTE_MAX]);
+ rmap = NHT_RM_MAP(zvrf, family, client_proto);
+ if (!rmap && NHT_RM_MAP(zvrf, family, ZEBRA_ROUTE_MAX))
+ rmap = NHT_RM_MAP(zvrf, family, ZEBRA_ROUTE_MAX);
if (rmap)
ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj);
@@ -1576,43 +1755,54 @@ static void zebra_route_map_event(route_map_event_t event,
}
/* ip protocol configuration write function */
-void zebra_routemap_config_write_protocol(struct vty *vty)
+void zebra_routemap_config_write_protocol(struct vty *vty,
+ struct zebra_vrf *zvrf)
{
int i;
+ char space[2];
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (proto_rm[AFI_IP][i])
- vty_out(vty, "ip protocol %s route-map %s\n",
- zebra_route_string(i), proto_rm[AFI_IP][i]);
-
- if (proto_rm[AFI_IP6][i])
- vty_out(vty, "ipv6 protocol %s route-map %s\n",
- zebra_route_string(i), proto_rm[AFI_IP6][i]);
+ memset(space, 0, sizeof(space));
- if (nht_rm[AFI_IP][i])
- vty_out(vty, "ip nht %s route-map %s\n",
- zebra_route_string(i), nht_rm[AFI_IP][i]);
+ if (zvrf_id(zvrf) != VRF_DEFAULT)
+ sprintf(space, "%s", " ");
- if (nht_rm[AFI_IP6][i])
- vty_out(vty, "ipv6 nht %s route-map %s\n",
- zebra_route_string(i), nht_rm[AFI_IP6][i]);
+ for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
+ if (PROTO_RM_NAME(zvrf, AFI_IP, i))
+ vty_out(vty, "%sip protocol %s route-map %s\n", space,
+ zebra_route_string(i),
+ PROTO_RM_NAME(zvrf, AFI_IP, i));
+
+ if (PROTO_RM_NAME(zvrf, AFI_IP6, i))
+ vty_out(vty, "%sipv6 protocol %s route-map %s\n", space,
+ zebra_route_string(i),
+ PROTO_RM_NAME(zvrf, AFI_IP6, i));
+
+ if (NHT_RM_NAME(zvrf, AFI_IP, i))
+ vty_out(vty, "%sip nht %s route-map %s\n", space,
+ zebra_route_string(i),
+ NHT_RM_NAME(zvrf, AFI_IP, i));
+
+ if (NHT_RM_NAME(zvrf, AFI_IP6, i))
+ vty_out(vty, "%sipv6 nht %s route-map %s\n", space,
+ zebra_route_string(i),
+ NHT_RM_NAME(zvrf, AFI_IP6, i));
}
- if (proto_rm[AFI_IP][ZEBRA_ROUTE_MAX])
- vty_out(vty, "ip protocol %s route-map %s\n", "any",
- proto_rm[AFI_IP][ZEBRA_ROUTE_MAX]);
+ if (PROTO_RM_NAME(zvrf, AFI_IP, ZEBRA_ROUTE_MAX))
+ vty_out(vty, "%sip protocol %s route-map %s\n", space, "any",
+ PROTO_RM_NAME(zvrf, AFI_IP, ZEBRA_ROUTE_MAX));
- if (proto_rm[AFI_IP6][ZEBRA_ROUTE_MAX])
- vty_out(vty, "ipv6 protocol %s route-map %s\n", "any",
- proto_rm[AFI_IP6][ZEBRA_ROUTE_MAX]);
+ if (PROTO_RM_NAME(zvrf, AFI_IP6, ZEBRA_ROUTE_MAX))
+ vty_out(vty, "%sipv6 protocol %s route-map %s\n", space, "any",
+ PROTO_RM_NAME(zvrf, AFI_IP6, ZEBRA_ROUTE_MAX));
- if (nht_rm[AFI_IP][ZEBRA_ROUTE_MAX])
- vty_out(vty, "ip nht %s route-map %s\n", "any",
- nht_rm[AFI_IP][ZEBRA_ROUTE_MAX]);
+ if (NHT_RM_NAME(zvrf, AFI_IP, ZEBRA_ROUTE_MAX))
+ vty_out(vty, "%sip nht %s route-map %s\n", space, "any",
+ NHT_RM_NAME(zvrf, AFI_IP, ZEBRA_ROUTE_MAX));
- if (nht_rm[AFI_IP6][ZEBRA_ROUTE_MAX])
- vty_out(vty, "ipv6 nht %s route-map %s\n", "any",
- nht_rm[AFI_IP6][ZEBRA_ROUTE_MAX]);
+ if (NHT_RM_NAME(zvrf, AFI_IP6, ZEBRA_ROUTE_MAX))
+ vty_out(vty, "%sipv6 nht %s route-map %s\n", space, "any",
+ NHT_RM_NAME(zvrf, AFI_IP6, ZEBRA_ROUTE_MAX));
if (zebra_rmap_update_timer != ZEBRA_RMAP_DEFAULT_UPDATE_TIMER)
vty_out(vty, "zebra route-map delay-timer %d\n",
@@ -1623,15 +1813,23 @@ void zebra_route_map_init()
{
install_element(CONFIG_NODE, &ip_protocol_cmd);
install_element(CONFIG_NODE, &no_ip_protocol_cmd);
+ install_element(VRF_NODE, &ip_protocol_cmd);
+ install_element(VRF_NODE, &no_ip_protocol_cmd);
install_element(VIEW_NODE, &show_ip_protocol_cmd);
install_element(CONFIG_NODE, &ipv6_protocol_cmd);
install_element(CONFIG_NODE, &no_ipv6_protocol_cmd);
+ install_element(VRF_NODE, &ipv6_protocol_cmd);
+ install_element(VRF_NODE, &no_ipv6_protocol_cmd);
install_element(VIEW_NODE, &show_ipv6_protocol_cmd);
install_element(CONFIG_NODE, &ip_protocol_nht_rmap_cmd);
install_element(CONFIG_NODE, &no_ip_protocol_nht_rmap_cmd);
+ install_element(VRF_NODE, &ip_protocol_nht_rmap_cmd);
+ install_element(VRF_NODE, &no_ip_protocol_nht_rmap_cmd);
install_element(VIEW_NODE, &show_ip_protocol_nht_cmd);
install_element(CONFIG_NODE, &ipv6_protocol_nht_rmap_cmd);
install_element(CONFIG_NODE, &no_ipv6_protocol_nht_rmap_cmd);
+ install_element(VRF_NODE, &ipv6_protocol_nht_rmap_cmd);
+ install_element(VRF_NODE, &no_ipv6_protocol_nht_rmap_cmd);
install_element(VIEW_NODE, &show_ipv6_protocol_nht_cmd);
install_element(CONFIG_NODE, &zebra_route_map_timer_cmd);
install_element(CONFIG_NODE, &no_zebra_route_map_timer_cmd);
diff --git a/zebra/zebra_routemap.h b/zebra/zebra_routemap.h
index d33487d7af..a8579e7c6e 100644
--- a/zebra/zebra_routemap.h
+++ b/zebra/zebra_routemap.h
@@ -25,7 +25,8 @@
#include "lib/routemap.h"
extern void zebra_route_map_init(void);
-extern void zebra_routemap_config_write_protocol(struct vty *vty);
+extern void zebra_routemap_config_write_protocol(struct vty *vty,
+ struct zebra_vrf *vrf);
extern char *zebra_get_import_table_route_map(afi_t afi, uint32_t table);
extern void zebra_add_import_table_route_map(afi_t afi, const char *rmap_name,
uint32_t table);
@@ -36,16 +37,15 @@ extern void zebra_route_map_write_delay_timer(struct vty *);
extern route_map_result_t
zebra_import_table_route_map_check(int family, int rib_type, uint8_t instance,
const struct prefix *p,
- struct nexthop *nexthop,
- vrf_id_t vrf_id, route_tag_t tag,
- const char *rmap_name);
+ struct nexthop *nexthop, vrf_id_t vrf_id,
+ route_tag_t tag, const char *rmap_name);
extern route_map_result_t
zebra_route_map_check(int family, int rib_type, uint8_t instance,
const struct prefix *p, struct nexthop *nexthop,
- vrf_id_t vrf_id, route_tag_t tag);
+ struct zebra_vrf *zvrf, route_tag_t tag);
extern route_map_result_t
zebra_nht_route_map_check(int family, int client_proto, const struct prefix *p,
- struct route_entry *, struct nexthop *nexthop);
-
+ struct zebra_vrf *zvrf, struct route_entry *,
+ struct nexthop *nexthop);
#endif
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 9a0ebbaba7..a1692d3c3e 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -39,6 +39,7 @@
#include "zebra/zebra_mpls.h"
#include "zebra/zebra_vxlan.h"
#include "zebra/zebra_netns_notify.h"
+#include "zebra/zebra_routemap.h"
extern struct zebra_t zebrad;
@@ -481,7 +482,6 @@ static int vrf_config_write(struct vty *vty)
if (zvrf_id(zvrf) == VRF_DEFAULT) {
if (zvrf->l3vni)
vty_out(vty, "vni %u\n", zvrf->l3vni);
- vty_out(vty, "!\n");
} else {
vty_frame(vty, "vrf %s\n", zvrf_name(zvrf));
if (zvrf->l3vni)
@@ -491,11 +491,14 @@ static int vrf_config_write(struct vty *vty)
? " prefix-routes-only"
: "");
zebra_ns_config_write(vty, (struct ns *)vrf->ns_ctxt);
-
}
+ zebra_routemap_config_write_protocol(vty, zvrf);
+
if (zvrf_id(zvrf) != VRF_DEFAULT)
vty_endframe(vty, " exit-vrf\n!\n");
+ else
+ vty_out(vty, "!\n");
}
return 0;
}
diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h
index b8664f4ec7..a39d74b08b 100644
--- a/zebra/zebra_vrf.h
+++ b/zebra/zebra_vrf.h
@@ -22,6 +22,8 @@
#if !defined(__ZEBRA_VRF_H__)
#define __ZEBRA_VRF_H__
+#include "vxlan.h"
+
#include <zebra/zebra_ns.h>
#include <zebra/zebra_pw.h>
#include <lib/vxlan.h>
@@ -32,6 +34,11 @@ typedef struct mpls_srgb_t_ {
uint32_t end_label;
} mpls_srgb_t;
+struct zebra_rmap {
+ char *name;
+ struct route_map *map;
+};
+
/* Routing table instance. */
struct zebra_vrf {
/* Back pointer */
@@ -92,6 +99,9 @@ struct zebra_vrf {
struct zebra_pw_head pseudowires;
struct zebra_static_pw_head static_pseudowires;
+ struct zebra_rmap proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX + 1];
+ struct zebra_rmap nht_rm[AFI_MAX][ZEBRA_ROUTE_MAX + 1];
+
/* MPLS processing flags */
uint16_t mpls_flags;
#define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
@@ -115,6 +125,11 @@ struct zebra_vrf {
/* l3-vni info */
vni_t l3vni;
+ /*
+ * Flooding mechanism for BUM packets for VxLAN-EVPN.
+ */
+ enum vxlan_flood_control vxlan_flood_ctrl;
+
/* Route Installs */
uint64_t installs;
uint64_t removals;
@@ -122,6 +137,17 @@ struct zebra_vrf {
uint64_t lsp_installs;
uint64_t lsp_removals;
};
+#define PROTO_RM_NAME(zvrf, afi, rtype) zvrf->proto_rm[afi][rtype].name
+#define NHT_RM_NAME(zvrf, afi, rtype) zvrf->nht_rm[afi][rtype].name
+#define PROTO_RM_MAP(zvrf, afi, rtype) zvrf->proto_rm[afi][rtype].map
+#define NHT_RM_MAP(zvrf, afi, rtype) zvrf->nht_rm[afi][rtype].map
+
+/*
+ * special macro to allow us to get the correct zebra_vrf
+ */
+#define ZEBRA_DECLVAR_CONTEXT(A, B) \
+ struct vrf *A = VTY_GET_CONTEXT(vrf); \
+ struct zebra_vrf *B = (A) ? A->info : vrf_info_lookup(VRF_DEFAULT)
static inline vrf_id_t zvrf_id(struct zebra_vrf *zvrf)
{
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 86792fdd89..fdedb30f84 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -67,13 +67,6 @@ static void vty_show_ip_route_summary(struct vty *vty,
static void vty_show_ip_route_summary_prefix(struct vty *vty,
struct route_table *table);
-/*
- * special macro to allow us to get the correct zebra_vrf
- */
-#define ZEBRA_DECLVAR_CONTEXT(A, B) \
- struct vrf *A = VTY_GET_CONTEXT(vrf); \
- struct zebra_vrf *B = (vrf) ? vrf->info : NULL;
-
/* VNI range as per RFC 7432 */
#define CMD_VNI_RANGE "(1-16777215)"
@@ -1027,11 +1020,17 @@ DEFUN (ip_nht_default_route,
"Filter Next Hop tracking route resolution\n"
"Resolve via default route\n")
{
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
+
if (zebra_rnh_ip_default_route)
return CMD_SUCCESS;
zebra_rnh_ip_default_route = 1;
- zebra_evaluate_rnh(VRF_DEFAULT, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
+
+ zebra_evaluate_rnh(zvrf, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
}
@@ -1043,11 +1042,16 @@ DEFUN (no_ip_nht_default_route,
"Filter Next Hop tracking route resolution\n"
"Resolve via default route\n")
{
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
+
if (!zebra_rnh_ip_default_route)
return CMD_SUCCESS;
zebra_rnh_ip_default_route = 0;
- zebra_evaluate_rnh(VRF_DEFAULT, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(zvrf, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
}
@@ -1058,11 +1062,16 @@ DEFUN (ipv6_nht_default_route,
"Filter Next Hop tracking route resolution\n"
"Resolve via default route\n")
{
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
+
if (zebra_rnh_ipv6_default_route)
return CMD_SUCCESS;
zebra_rnh_ipv6_default_route = 1;
- zebra_evaluate_rnh(VRF_DEFAULT, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(zvrf, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
}
@@ -1074,11 +1083,17 @@ DEFUN (no_ipv6_nht_default_route,
"Filter Next Hop tracking route resolution\n"
"Resolve via default route\n")
{
+
+ ZEBRA_DECLVAR_CONTEXT(vrf, zvrf);
+
+ if (!zvrf)
+ return CMD_WARNING;
+
if (!zebra_rnh_ipv6_default_route)
return CMD_SUCCESS;
zebra_rnh_ipv6_default_route = 0;
- zebra_evaluate_rnh(VRF_DEFAULT, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
+ zebra_evaluate_rnh(zvrf, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL);
return CMD_SUCCESS;
}
@@ -2359,9 +2374,6 @@ static int config_write_protocol(struct vty *vty)
== MCAST_MIX_DISTANCE
? "lower-distance"
: "longer-prefix");
-
- zebra_routemap_config_write_protocol(vty);
-
return 1;
}
@@ -2649,6 +2661,10 @@ void zebra_vty_init(void)
install_element(CONFIG_NODE, &no_ip_nht_default_route_cmd);
install_element(CONFIG_NODE, &ipv6_nht_default_route_cmd);
install_element(CONFIG_NODE, &no_ipv6_nht_default_route_cmd);
+ install_element(VRF_NODE, &ip_nht_default_route_cmd);
+ install_element(VRF_NODE, &no_ip_nht_default_route_cmd);
+ install_element(VRF_NODE, &ipv6_nht_default_route_cmd);
+ install_element(VRF_NODE, &no_ipv6_nht_default_route_cmd);
install_element(VIEW_NODE, &show_ipv6_mroute_cmd);
/* Commands for VRF */
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index f8417503ef..5078eff590 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -3097,7 +3097,9 @@ static int zvni_vtep_del_all(zebra_vni_t *zvni, int uninstall)
*/
static int zvni_vtep_install(zebra_vni_t *zvni, struct in_addr *vtep_ip)
{
- return kernel_add_vtep(zvni->vni, zvni->vxlan_if, vtep_ip);
+ if (is_vxlan_flooding_head_end())
+ return kernel_add_vtep(zvni->vni, zvni->vxlan_if, vtep_ip);
+ return 0;
}
/*
@@ -3115,6 +3117,28 @@ static int zvni_vtep_uninstall(zebra_vni_t *zvni, struct in_addr *vtep_ip)
}
/*
+ * Install or uninstall flood entries in the kernel corresponding to
+ * remote VTEPs. This is invoked upon change to BUM handling.
+ */
+static void zvni_handle_flooding_remote_vteps(struct hash_backet *backet,
+ void *zvrf)
+{
+ zebra_vni_t *zvni;
+ zebra_vtep_t *zvtep;
+
+ zvni = (zebra_vni_t *)backet->data;
+ if (!zvni)
+ return;
+
+ for (zvtep = zvni->vteps; zvtep; zvtep = zvtep->next) {
+ if (is_vxlan_flooding_head_end())
+ zvni_vtep_install(zvni, &zvtep->vtep_ip);
+ else
+ zvni_vtep_uninstall(zvni, &zvtep->vtep_ip);
+ }
+}
+
+/*
* Cleanup VNI/VTEP and update kernel
*/
static void zvni_cleanup_all(struct hash_backet *backet, void *arg)
@@ -6898,6 +6922,46 @@ int zebra_vxlan_vrf_delete(struct zebra_vrf *zvrf)
}
/*
+ * Handle message from client to specify the flooding mechanism for
+ * BUM packets. The default is to do head-end (ingress) replication
+ * and the other supported option is to disable it. This applies to
+ * all BUM traffic and disabling it applies to both the transmit and
+ * receive direction.
+ */
+void zebra_vxlan_flood_control(ZAPI_HANDLER_ARGS)
+{
+ struct stream *s;
+ enum vxlan_flood_control flood_ctrl;
+
+ if (zvrf_id(zvrf) != VRF_DEFAULT) {
+ zlog_err("EVPN flood control for non-default VRF %u",
+ zvrf_id(zvrf));
+ return;
+ }
+
+ s = msg;
+ STREAM_GETC(s, flood_ctrl);
+
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("EVPN flood control %u, currently %u",
+ flood_ctrl, zvrf->vxlan_flood_ctrl);
+
+ if (zvrf->vxlan_flood_ctrl == flood_ctrl)
+ return;
+
+ zvrf->vxlan_flood_ctrl = flood_ctrl;
+
+ /* Install or uninstall flood entries corresponding to
+ * remote VTEPs.
+ */
+ hash_iterate(zvrf->vni_table, zvni_handle_flooding_remote_vteps,
+ zvrf);
+
+stream_failure:
+ return;
+}
+
+/*
* Handle message from client to enable/disable advertisement of g/w macip
* routes
*/
@@ -7073,12 +7137,15 @@ stream_failure:
* When enabled, the VNI hash table will be built and MAC FDB table read;
* when disabled, the entries should be deleted and remote VTEPs and MACs
* uninstalled from the kernel.
+ * This also informs the setting for BUM handling at the time this change
+ * occurs; it is relevant only when specifying "learn".
*/
void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
{
struct stream *s = NULL;
int advertise = 0;
struct zebra_ns *zns = NULL;
+ enum vxlan_flood_control flood_ctrl;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
zlog_debug("EVPN VNI Adv for non-default VRF %u",
@@ -7088,17 +7155,22 @@ void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS)
s = msg;
STREAM_GETC(s, advertise);
+ STREAM_GETC(s, flood_ctrl);
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("EVPN VNI Adv %s, currently %s",
+ zlog_debug("EVPN VNI Adv %s, currently %s, flood control %u",
advertise ? "enabled" : "disabled",
- is_evpn_enabled() ? "enabled" : "disabled");
+ is_evpn_enabled() ? "enabled" : "disabled",
+ flood_ctrl);
if (zvrf->advertise_all_vni == advertise)
return;
zvrf->advertise_all_vni = advertise;
if (is_evpn_enabled()) {
+ /* Note BUM handling */
+ zvrf->vxlan_flood_ctrl = flood_ctrl;
+
/* Build VNI hash table and inform BGP. */
zvni_build_hash_table();
diff --git a/zebra/zebra_vxlan.h b/zebra/zebra_vxlan.h
index a6c668785f..f03cd3d541 100644
--- a/zebra/zebra_vxlan.h
+++ b/zebra/zebra_vxlan.h
@@ -44,6 +44,15 @@ static inline int is_evpn_enabled()
return zvrf ? zvrf->advertise_all_vni : 0;
}
+static inline int
+is_vxlan_flooding_head_end()
+{
+ struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
+
+ if (!zvrf)
+ return 0;
+ return (zvrf->vxlan_flood_ctrl == VXLAN_FLOOD_HEAD_END_REPL);
+}
/* VxLAN interface change flags of interest. */
#define ZEBRA_VXLIF_LOCAL_IP_CHANGE 0x1
@@ -57,6 +66,7 @@ extern void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS);
extern void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS);
extern void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS);
extern void zebra_vxlan_remote_vtep_del(ZAPI_HANDLER_ARGS);
+extern void zebra_vxlan_flood_control(ZAPI_HANDLER_ARGS);
extern void zebra_vxlan_advertise_subnet(ZAPI_HANDLER_ARGS);
extern void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS);
extern void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS);