Convert the binfo variable to path.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
void bgp_advertise_free(struct bgp_advertise *adv)
{
- if (adv->binfo)
- bgp_path_info_unlock(
- adv->binfo); /* bgp_advertise bgp_path_info reference */
+ if (adv->pathi)
+ /* bgp_advertise bgp_path_info reference */
+ bgp_path_info_unlock(adv->pathi);
XFREE(MTYPE_BGP_ADVERTISE, adv);
}
struct bgp_advertise_attr *baa;
/* BGP info. */
- struct bgp_path_info *binfo;
+ struct bgp_path_info *pathi;
};
/* BGP adjacency out. */
/* 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;
/* if (figure-of-merit < reuse). */
if (bdi->penalty < damp->reuse_limit) {
/* Reuse the route. */
- bgp_path_info_unset_flag(bdi->rn, bdi->binfo,
+ bgp_path_info_unset_flag(bdi->rn, bdi->path,
BGP_PATH_DAMPED);
bdi->suppress_time = 0;
if (bdi->lastrecord == BGP_RECORD_UPDATE) {
- bgp_path_info_unset_flag(bdi->rn, bdi->binfo,
+ 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);
}
}
/* A route becomes unreachable (RFC2439 Section 4.8.2). */
-int bgp_damp_withdraw(struct bgp_path_info *binfo, struct bgp_node *rn,
+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;
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. */
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);
bdi->index = -1;
bdi->afi = afi;
bdi->safi = safi;
- (bgp_path_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;
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_path_info_set_flag(rn, binfo, BGP_PATH_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_PATH_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);
/* If not suppressed before, do annonunce this withdraw and
insert into reuse_list. */
if (bdi->penalty >= damp->suppress_value) {
- bgp_path_info_set_flag(rn, binfo, BGP_PATH_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);
return BGP_DAMP_USED;
}
-int bgp_damp_update(struct bgp_path_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_path_info_unset_flag(rn, binfo, BGP_PATH_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_PATH_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_PATH_DAMPED)
+ else if (CHECK_FLAG(bdi->path->flags, BGP_PATH_DAMPED)
&& (bdi->penalty < damp->reuse_limit)) {
- bgp_path_info_unset_flag(rn, binfo, BGP_PATH_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;
}
/* Remove dampening information and history route. */
-int bgp_damp_scan(struct bgp_path_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_PATH_DAMPED)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED)) {
t_diff = t_now - bdi->suppress_time;
if (t_diff >= damp->max_suppress_time) {
- bgp_path_info_unset_flag(bdi->rn, binfo,
+ bgp_path_info_unset_flag(bdi->rn, path,
BGP_PATH_DAMPED);
bgp_reuse_list_delete(bdi);
BGP_DAMP_LIST_ADD(damp, bdi);
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;
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
void bgp_damp_info_free(struct bgp_damp_info *bdi, int withdraw)
{
- struct bgp_path_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_PATH_DAMPED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED))
bgp_reuse_list_delete(bdi);
else
BGP_DAMP_LIST_DEL(damp, bdi);
- bgp_path_info_unset_flag(bdi->rn, binfo,
+ bgp_path_info_unset_flag(bdi->rn, path,
BGP_PATH_HISTORY | BGP_PATH_DAMPED);
if (bdi->lastrecord == BGP_RECORD_WITHDRAW && withdraw)
- bgp_path_info_delete(bdi->rn, binfo);
+ bgp_path_info_delete(bdi->rn, path);
XFREE(MTYPE_BGP_DAMP_INFO, bdi);
}
return buf;
}
-void bgp_damp_info_vty(struct vty *vty, struct bgp_path_info *binfo,
+void bgp_damp_info_vty(struct vty *vty, struct bgp_path_info *path,
json_object *json_path)
{
struct bgp_damp_info *bdi;
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. */
peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 1,
json_path);
- if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED)
- && !CHECK_FLAG(binfo->flags, BGP_PATH_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 {
peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 0,
json_path));
- if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED)
- && !CHECK_FLAG(binfo->flags, BGP_PATH_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,
}
}
-const char *bgp_damp_reuse_time_vty(struct vty *vty,
- struct bgp_path_info *binfo, char *timebuf,
- size_t len, bool use_json,
+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)
{
struct bgp_damp_info *bdi;
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. */
time_t suppress_time;
/* Back reference to bgp_path_info. */
- struct bgp_path_info *binfo;
+ struct bgp_path_info *path;
/* Back reference to bgp_node. */
struct bgp_node *rn;
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_path_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);
json_object *json_path);
extern void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
- struct bgp_path_info *binfo, int display,
+ 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);
}
void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
- struct bgp_path_info *binfo, int display,
+ struct bgp_path_info *path, int display,
json_object *json_paths)
{
struct attr *attr;
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,
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)
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) {
}
if (display == NLRI_STRING_FORMAT_LARGE) {
struct bgp_path_info_extra *extra =
- bgp_path_info_extra_get(binfo);
+ bgp_path_info_extra_get(path);
if (extra->bgp_fs_pbr) {
struct listnode *node;
* doing lazy allocation.
*/
static struct bgp_path_info_mpath *
-bgp_path_info_mpath_get(struct bgp_path_info *binfo)
+bgp_path_info_mpath_get(struct bgp_path_info *path)
{
struct bgp_path_info_mpath *mpath;
- if (!binfo->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;
}
/*
* list entry
*/
static void bgp_path_info_mpath_enqueue(struct bgp_path_info *prev_info,
- struct bgp_path_info *binfo)
+ struct bgp_path_info *path)
{
struct bgp_path_info_mpath *prev, *mpath;
prev = bgp_path_info_mpath_get(prev_info);
- mpath = bgp_path_info_mpath_get(binfo);
+ mpath = bgp_path_info_mpath_get(path);
if (!prev || !mpath)
return;
prev->mp_next->mp_prev = mpath;
prev->mp_next = mpath;
- SET_FLAG(binfo->flags, BGP_PATH_MULTIPATH);
+ SET_FLAG(path->flags, BGP_PATH_MULTIPATH);
}
/*
*
* Remove a path from the multipath list
*/
-void bgp_path_info_mpath_dequeue(struct bgp_path_info *binfo)
+void bgp_path_info_mpath_dequeue(struct bgp_path_info *path)
{
- struct bgp_path_info_mpath *mpath = binfo->mpath;
+ struct bgp_path_info_mpath *mpath = path->mpath;
if (!mpath)
return;
if (mpath->mp_prev)
if (mpath->mp_next)
mpath->mp_next->mp_prev = mpath->mp_prev;
mpath->mp_next = mpath->mp_prev = NULL;
- UNSET_FLAG(binfo->flags, BGP_PATH_MULTIPATH);
+ UNSET_FLAG(path->flags, BGP_PATH_MULTIPATH);
}
/*
*
* Given a bgp_path_info, return the next multipath entry
*/
-struct bgp_path_info *bgp_path_info_mpath_next(struct bgp_path_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;
}
/*
*
* Given bestpath bgp_path_info, return the first multipath entry.
*/
-struct bgp_path_info *bgp_path_info_mpath_first(struct bgp_path_info *binfo)
+struct bgp_path_info *bgp_path_info_mpath_first(struct bgp_path_info *path)
{
- return bgp_path_info_mpath_next(binfo);
+ return bgp_path_info_mpath_next(path);
}
/*
*
* Given the bestpath bgp_path_info, return the number of multipath entries
*/
-uint32_t bgp_path_info_mpath_count(struct bgp_path_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;
}
/*
*
* Sets the count of multipaths into bestpath's mpath element
*/
-static void bgp_path_info_mpath_count_set(struct bgp_path_info *binfo,
+static void bgp_path_info_mpath_count_set(struct bgp_path_info *path,
uint32_t count)
{
struct bgp_path_info_mpath *mpath;
- if (!count && !binfo->mpath)
+ if (!count && !path->mpath)
return;
- mpath = bgp_path_info_mpath_get(binfo);
+ mpath = bgp_path_info_mpath_get(path);
if (!mpath)
return;
mpath->mp_count = count;
* Given bestpath bgp_path_info, return aggregated attribute set used
* for advertising the multipath route
*/
-struct attr *bgp_path_info_mpath_attr(struct bgp_path_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;
}
/*
*
* Sets the aggregated attribute into bestpath's mpath element
*/
-static void bgp_path_info_mpath_attr_set(struct bgp_path_info *binfo,
+static void bgp_path_info_mpath_attr_set(struct bgp_path_info *path,
struct attr *attr)
{
struct bgp_path_info_mpath *mpath;
- if (!attr && !binfo->mpath)
+ if (!attr && !path->mpath)
return;
- mpath = bgp_path_info_mpath_get(binfo);
+ mpath = bgp_path_info_mpath_get(path);
if (!mpath)
return;
mpath->mp_attr = attr;
};
static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
- struct bgp_path_info *binfo,
+ struct bgp_path_info *path,
struct bgp_pbr_filter *bpf,
struct nexthop *nh,
float *rate);
bgp_send_pbr_ipset_entry_match(bpme, false);
bpme->installed = false;
bpme->backpointer = NULL;
- if (bpme->bgp_info) {
- struct bgp_path_info *bgp_info;
+ if (bpme->path) {
+ struct bgp_path_info *path;
struct bgp_path_info_extra *extra;
/* unlink bgp_path_info to bpme */
- bgp_info = (struct bgp_path_info *)bpme->bgp_info;
- extra = bgp_path_info_extra_get(bgp_info);
+ 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);
return HASHWALK_ABORT;
}
-static void
-bgp_pbr_policyroute_remove_from_zebra_unit(struct bgp *bgp,
- struct bgp_path_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;
return 0;
}
-static void bgp_pbr_icmp_action(struct bgp *bgp, struct bgp_path_info *binfo,
+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)
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;
}
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_path_info *binfo,
- struct bgp_pbr_filter *bpf, struct bgp_pbr_or_filter *bpof,
- uint8_t type_entry)
+ 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;
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;
} 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_path_info *binfo,
- struct bgp_pbr_filter *bpf, struct bgp_pbr_or_filter *bpof)
+ 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);
}
static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
- struct bgp_path_info *binfo,
+ struct bgp_path_info *path,
struct bgp_pbr_filter *bpf,
struct nexthop *nh,
float *rate)
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_path_info_extra *extra =
- bgp_path_info_extra_get(binfo);
+ 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;
}
}
}
static void bgp_pbr_policyroute_add_to_zebra_recursive(
- struct bgp *bgp, struct bgp_path_info *binfo,
- struct bgp_pbr_filter *bpf, struct bgp_pbr_or_filter *bpof,
- struct nexthop *nh, float *rate, uint8_t type_entry)
+ 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;
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;
} 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_path_info *binfo,
+ 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);
list_delete_all_node(bpof->icmp_code);
}
-static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *binfo,
+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;
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) {
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;
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
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;
uint16_t dst_port_max;
uint8_t proto;
- void *bgp_info;
+ void *path;
bool installed;
bool install_in_progress;
}
/* Free bgp route information. */
-static void bgp_path_info_free(struct bgp_path_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_path_info_extra_free(&binfo->extra);
- bgp_path_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_path_info peer reference */
+ peer_unlock(path->peer); /* bgp_path_info peer reference */
- XFREE(MTYPE_BGP_ROUTE, binfo);
+ XFREE(MTYPE_BGP_ROUTE, path);
}
-struct bgp_path_info *bgp_path_info_lock(struct bgp_path_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_path_info *bgp_path_info_unlock(struct bgp_path_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_path_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_path_info_add(struct bgp_node *rn, struct bgp_path_info *ri)
/* 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 *binfo,
+ struct bgp_path_info *path,
json_object *json_path)
{
if (json_path) {
/* Route status display. */
- if (CHECK_FLAG(binfo->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED))
json_object_boolean_true_add(json_path, "removed");
- if (CHECK_FLAG(binfo->flags, BGP_PATH_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_PATH_VALID)
- && !CHECK_FLAG(binfo->flags, BGP_PATH_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_PATH_HISTORY))
+ if (CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
json_object_boolean_true_add(json_path, "history");
- if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED))
json_object_boolean_true_add(json_path, "damped");
- if (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_SELECTED))
json_object_boolean_true_add(json_path, "bestpath");
- if (CHECK_FLAG(binfo->flags, BGP_PATH_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
}
/* Route status display. */
- if (CHECK_FLAG(binfo->flags, BGP_PATH_REMOVED))
+ if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED))
vty_out(vty, "R");
- else if (CHECK_FLAG(binfo->flags, BGP_PATH_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_PATH_VALID)
- && !CHECK_FLAG(binfo->flags, BGP_PATH_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_PATH_HISTORY))
+ if (CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
vty_out(vty, "h");
- else if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED))
+ else if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED))
vty_out(vty, "d");
- else if (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED))
+ else if (CHECK_FLAG(path->flags, BGP_PATH_SELECTED))
vty_out(vty, ">");
- else if (CHECK_FLAG(binfo->flags, BGP_PATH_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_path_info *binfo, int display, safi_t safi,
+ struct bgp_path_info *path, int display, safi_t safi,
json_object *json_paths)
{
struct attr *attr;
json_object *json_nexthop_ll = NULL;
char vrf_id_str[VRF_NAMSIZ] = {0};
bool nexthop_self =
- CHECK_FLAG(binfo->flags, BGP_PATH_ANNC_NH_SELF) ? true : false;
+ 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";
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 */
}
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
if (!attr) {
if (json_paths)
json_object_array_add(json_paths, json_path);
* 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 = "";
/* 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",
* 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
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 */
/* 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
}
}
}
void route_vty_out_tag(struct vty *vty, struct prefix *p,
- struct bgp_path_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) {
}
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
if (attr) {
if (((p->family == AF_INET)
&& ((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)))
}
}
- label = decode_label(&binfo->extra->label[0]);
+ label = decode_label(&path->extra->label[0]);
if (bgp_is_valid_label(&label)) {
if (json) {
}
void route_vty_out_overlay(struct vty *vty, struct prefix *p,
- struct bgp_path_info *binfo, int display,
+ struct bgp_path_info *path, int display,
json_object *json_paths)
{
struct attr *attr;
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)
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);
/* dampening route */
static void damp_route_vty_out(struct vty *vty, struct prefix *p,
- struct bgp_path_info *binfo, int display,
+ struct bgp_path_info *path, int display,
safi_t safi, bool use_json, json_object *json)
{
struct attr *attr;
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) {
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)
}
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) {
/* flap route */
static void flap_route_vty_out(struct vty *vty, struct prefix *p,
- struct bgp_path_info *binfo, int display,
+ struct bgp_path_info *path, int display,
safi_t safi, bool use_json, json_object *json)
{
struct attr *attr;
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) {
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)
vty_out(vty, "%s ", peer_uptime(bdi->start_time, timebuf,
BGP_UPTIME_LEN, 0, NULL));
- if (CHECK_FLAG(binfo->flags, BGP_PATH_DAMPED)
- && !CHECK_FLAG(binfo->flags, BGP_PATH_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 {
}
/* Print attribute */
- attr = binfo->attr;
+ attr = path->attr;
if (attr) {
/* Print aspath */
if (attr->aspath) {
}
void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
- struct bgp_path_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];
int has_adj;
unsigned int first_as;
bool nexthop_self =
- CHECK_FLAG(binfo->flags, BGP_PATH_ANNC_NH_SELF) ? true : false;
+ CHECK_FLAG(path->flags, BGP_PATH_ANNC_NH_SELF) ? true : false;
if (json_paths) {
json_path = json_object_new_object();
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) {
+ if (path->extra && path->extra->parent) {
struct bgp_path_info *parent_ri;
struct bgp_node *rn, *prn;
- parent_ri =
- (struct bgp_path_info *)binfo->extra->parent;
+ parent_ri = (struct bgp_path_info *)path->extra->parent;
rn = parent_ri->net;
if (rn && rn->prn) {
prn = rn->prn;
}
}
- attr = binfo->attr;
+ attr = path->attr;
if (attr) {
/* Line1 display AS-path, Aggregator */
}
}
- if (CHECK_FLAG(binfo->flags, BGP_PATH_REMOVED)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED)) {
if (json_paths)
json_object_boolean_true_add(json_path,
"removed");
vty_out(vty, ", (removed)");
}
- if (CHECK_FLAG(binfo->flags, BGP_PATH_STALE)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_STALE)) {
if (json_paths)
json_object_boolean_true_add(json_path,
"stale");
}
}
- 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(
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(
vty_out(vty, ", (Received from a RS-client)");
}
- if (CHECK_FLAG(binfo->flags, BGP_PATH_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_PATH_DAMPED)) {
+ } else if (CHECK_FLAG(path->flags, BGP_PATH_DAMPED)) {
if (json_paths)
json_object_boolean_true_add(
json_path, "dampeningSuppressed");
}
/* Display the IGP cost or 'inaccessible' */
- if (!CHECK_FLAG(binfo->flags, BGP_PATH_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 */
/* 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
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));
}
vty_out(vty, " (%s)",
inet_ntop(
AF_INET,
- &binfo->peer->remote_id,
+ &path->peer->remote_id,
buf1, sizeof(buf1)));
}
}
/*
* 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);
attr->tag);
}
- if (!CHECK_FLAG(binfo->flags, BGP_PATH_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_PATH_HISTORY)) {
+ } else if (!CHECK_FLAG(path->flags, BGP_PATH_HISTORY)) {
if (json_paths)
json_object_boolean_true_add(json_path,
"valid");
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)
}
} else {
if (bgp_confederation_peers_check(
- bgp, binfo->peer->as)) {
+ bgp, path->peer->as)) {
if (json_paths)
json_object_string_add(
json_peer, "type",
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");
} 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");
vty_out(vty, ", atomic-aggregate");
}
- if (CHECK_FLAG(binfo->flags, BGP_PATH_MULTIPATH)
- || (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED)
- && bgp_path_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");
}
// Mark the bestpath(s)
- if (CHECK_FLAG(binfo->flags, BGP_PATH_DMED_SELECTED)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_DMED_SELECTED)) {
first_as = aspath_get_first_as(attr->aspath);
if (json_paths) {
}
}
- if (CHECK_FLAG(binfo->flags, BGP_PATH_SELECTED)) {
+ if (CHECK_FLAG(path->flags, BGP_PATH_SELECTED)) {
if (json_paths) {
if (!json_bestpath)
json_bestpath =
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);
}
/* 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);
}
}
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,
+ && CHECK_FLAG(path->flags,
BGP_PATH_SELECTED))) {
if (json_path && !json_adv_to)
json_adv_to =
}
/* 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);
}
if (type == bgp_show_type_route_map) {
struct route_map *rmap = output_arg;
- struct bgp_path_info binfo;
+ struct bgp_path_info path;
struct attr dummy_attr;
int ret;
bgp_attr_dup(&dummy_attr, ri->attr);
- binfo.peer = ri->peer;
- binfo.attr = &dummy_attr;
+ path.peer = ri->peer;
+ path.attr = &dummy_attr;
ret = route_map_apply(rmap, &rn->p, RMAP_BGP,
- &binfo);
+ &path);
if (ret == RMAP_DENYMATCH)
continue;
}
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_path_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 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_path_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,
void *object)
{
struct access_list *alist;
- struct bgp_path_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);
void *object)
{
struct access_list *alist;
- struct bgp_path_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;
route_map_object_t type, void *object)
{
struct prefix_list *plist;
- struct bgp_path_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);
route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
- struct bgp_path_info *bgp_info;
+ struct bgp_path_info *path;
if (type == RMAP_BGP && prefix->family == AF_INET) {
- bgp_info = (struct bgp_path_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;
route_map_object_t type, void *object)
{
struct prefix_list *plist;
- struct bgp_path_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;
route_map_object_t type, void *object)
{
vni_t vni = 0;
- struct bgp_path_info *bgp_info = NULL;
+ struct bgp_path_info *path = NULL;
if (type == RMAP_BGP) {
vni = *((vni_t *)rule);
- bgp_info = (struct bgp_path_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;
}
void *object)
{
uint32_t *local_pref;
- struct bgp_path_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;
void *object)
{
struct rmap_value *rv;
- struct bgp_path_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;
}
{
struct as_list *as_list;
- struct bgp_path_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);
void *object)
{
struct community_list *list;
- struct bgp_path_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,
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;
}
}
void *object)
{
struct community_list *list;
- struct bgp_path_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,
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;
void *object)
{
struct community_list *list;
- struct bgp_path_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;
void *object)
{
uint8_t *origin;
- struct bgp_path_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;
}
route_map_object_t type, void *object)
{
route_tag_t *tag;
- struct bgp_path_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;
void *object)
{
struct rmap_ip_nexthop_set *rins = rule;
- struct bgp_path_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)
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)) {
* 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);
}
}
void *object)
{
struct rmap_value *rv;
- struct bgp_path_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;
void *object)
{
struct rmap_value *rv;
- struct bgp_path_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;
void *object)
{
struct rmap_value *rv;
- struct bgp_path_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;
}
{
struct aspath *aspath;
struct aspath *new;
- struct bgp_path_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;
} 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;
void *object)
{
struct aspath *new_path, *exclude_path;
- struct bgp_path_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;
void *object)
{
struct rmap_com_set *rcs;
- struct bgp_path_info *binfo;
+ struct bgp_path_info *path;
struct attr *attr;
struct community *new = NULL;
struct community *old;
if (type == RMAP_BGP) {
rcs = rule;
- binfo = object;
- attr = binfo->attr;
+ path = object;
+ attr = path->attr;
old = attr->community;
/* "none" case. */
void *object)
{
struct rmap_lcom_set *rcs;
- struct bgp_path_info *binfo;
+ struct bgp_path_info *path;
struct attr *attr;
struct lcommunity *new = NULL;
struct lcommunity *old;
if (type == RMAP_BGP) {
rcs = rule;
- binfo = object;
- attr = binfo->attr;
+ path = object;
+ attr = path->attr;
old = attr->lcommunity;
/* "none" case. */
struct lcommunity *merge;
struct lcommunity *new;
struct lcommunity *old;
- struct bgp_path_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(
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);
}
}
struct community *merge;
struct community *new;
struct community *old;
- struct bgp_path_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),
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);
}
}
struct ecommunity *ecom;
struct ecommunity *new_ecom;
struct ecommunity *old_ecom;
- struct bgp_path_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),
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;
}
void *object)
{
uint8_t *origin;
- struct bgp_path_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;
route_map_object_t type,
void *object)
{
- struct bgp_path_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;
route_map_object_t type,
void *object)
{
- struct bgp_path_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;
route_map_object_t type, void *object)
{
route_tag_t *tag;
- struct bgp_path_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;
void *object)
{
struct rmap_value *rv;
- struct bgp_path_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);
}
}
void *object)
{
struct in6_addr *addr = rule;
- struct bgp_path_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;
route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
- struct bgp_path_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_path_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;
void *object)
{
struct in6_addr *address;
- struct bgp_path_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);
}
route_set_ipv6_nexthop_prefer_global(void *rule, const struct prefix *prefix,
route_map_object_t type, void *object)
{
- struct bgp_path_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);
}
}
void *object)
{
struct in6_addr *address;
- struct bgp_path_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);
}
void *object)
{
struct in6_addr peer_address;
- struct bgp_path_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_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)) {
* 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));
}
}
void *object)
{
struct in_addr *address;
- struct bgp_path_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;
void *object)
{
struct in6_addr *address;
- struct bgp_path_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;
void *object)
{
struct in_addr *address;
- struct bgp_path_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;
route_map_object_t type, void *object)
{
int *rpki_status = rule;
- struct bgp_path_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;
}
for (ain = bgp_node->adj_in; ain; ain = ain->next) {
int ret;
- struct bgp_path_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,
{
oid *offset;
int offsetlen;
- struct bgp_path_info *binfo;
+ struct bgp_path_info *path;
struct bgp_path_info *min;
struct bgp_node *rn;
union sockunion su;
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;
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;
}
}
WriteMethod **write_method)
{
struct bgp *bgp;
- struct bgp_path_info *binfo;
+ struct bgp_path_info *path;
struct prefix_ipv4 addr;
bgp = bgp_get_default();
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);
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);
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);
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;
extern void bgp_adj_out_set_subgroup(struct bgp_node *rn,
struct update_subgroup *subgrp,
struct attr *attr,
- struct bgp_path_info *binfo);
+ 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);
void bgp_adj_out_set_subgroup(struct bgp_node *rn,
struct update_subgroup *subgrp, struct attr *attr,
- struct bgp_path_info *binfo)
+ struct bgp_path_info *path)
{
struct bgp_adj_out *adj = NULL;
struct bgp_advertise *adv;
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;
}
adv = adj->adv;
adv->rn = rn;
- assert(adv->binfo == NULL);
+ assert(adv->pathi == NULL);
/* bgp_path_info adj_out reference */
- adv->binfo = bgp_path_info_lock(binfo);
+ adv->pathi = bgp_path_info_lock(path);
if (attr)
adv->baa = bgp_advertise_intern(subgrp->hash, attr);
struct bgp_adj_out *adj;
struct bgp_advertise *adv;
struct bgp_node *rn = NULL;
- struct bgp_path_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;
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;
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,
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))
break;
case ZAPI_IPSET_ENTRY_INSTALLED:
{
- struct bgp_path_info *bgp_info;
+ struct bgp_path_info *path;
struct bgp_path_info_extra *extra;
bgp_pbime->installed = true;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: Received IPSET_ENTRY_INSTALLED",
__PRETTY_FUNCTION__);
- /* link bgp_info to bpme */
- bgp_info = (struct bgp_path_info *)bgp_pbime->bgp_info;
- extra = bgp_path_info_extra_get(bgp_info);
+ /* 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);
/*
- * Make a new bgp_info from gathered parameters
+ * Make a new bgp_path_info from gathered parameters
*/
static struct bgp_path_info *rfapiBgpInfoCreate(struct attr *attr,
struct peer *peer, void *rfd,
}
/*
- * 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_path_info *goner)
* 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;
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;
}
/*
- * 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(
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;
for (bi = rn->info; bi; bi = bi->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__,
/*
- * 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(
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 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__);
}
/*
* 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 {
* 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.
bgp_attr_dup(&hattr, attr); /* hattr becomes a ghost attr */
if (rmap) {
- struct bgp_path_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(
# ...
# (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