From 4b7e60662595e43aaf41046746fcaa97d17abb5d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 2 Oct 2018 16:41:30 -0400 Subject: [PATCH] bgpd: Convert `struct bgp_info` to `struct bgp_path_info` Do a straight conversion of `struct bgp_info` to `struct bgp_path_info`. This commit will setup the rename of variables as well. This is being done because `struct bgp_info` is not descriptive of what this data actually is. It is path information for routes that we keep to build the actual routes nexthops plus some extra information. Signed-off-by: Donald Sharp --- bgpd/IMPLEMENTATION.txt | 6 +- bgpd/bgp_advertise.h | 2 +- bgpd/bgp_damp.c | 17 +- bgpd/bgp_damp.h | 17 +- bgpd/bgp_dump.c | 8 +- bgpd/bgp_evpn.c | 169 ++++++++++---------- bgpd/bgp_evpn.h | 10 +- bgpd/bgp_evpn_vty.c | 16 +- bgpd/bgp_flowspec.h | 4 +- bgpd/bgp_flowspec_vty.c | 8 +- bgpd/bgp_label.c | 5 +- bgpd/bgp_label.h | 10 +- bgpd/bgp_mpath.c | 67 ++++---- bgpd/bgp_mpath.h | 39 ++--- bgpd/bgp_mplsvpn.c | 91 +++++------ bgpd/bgp_mplsvpn.h | 8 +- bgpd/bgp_nexthop.h | 4 +- bgpd/bgp_nht.c | 20 +-- bgpd/bgp_nht.h | 11 +- bgpd/bgp_pbr.c | 84 +++++----- bgpd/bgp_pbr.h | 7 +- bgpd/bgp_route.c | 240 ++++++++++++++-------------- bgpd/bgp_route.h | 102 ++++++------ bgpd/bgp_routemap.c | 94 +++++------ bgpd/bgp_rpki.c | 4 +- bgpd/bgp_snmp.c | 13 +- bgpd/bgp_updgrp.c | 2 +- bgpd/bgp_updgrp.h | 9 +- bgpd/bgp_updgrp_adv.c | 15 +- bgpd/bgp_updgrp_packet.c | 2 +- bgpd/bgp_vty.c | 7 +- bgpd/bgp_zebra.c | 61 ++++--- bgpd/bgp_zebra.h | 9 +- bgpd/rfapi/rfapi.c | 8 +- bgpd/rfapi/rfapi_backend.h | 8 +- bgpd/rfapi/rfapi_import.c | 140 ++++++++-------- bgpd/rfapi/rfapi_import.h | 12 +- bgpd/rfapi/rfapi_monitor.c | 2 +- bgpd/rfapi/rfapi_monitor.h | 2 +- bgpd/rfapi/rfapi_private.h | 2 +- bgpd/rfapi/rfapi_rib.c | 8 +- bgpd/rfapi/rfapi_rib.h | 2 +- bgpd/rfapi/rfapi_vty.c | 16 +- bgpd/rfapi/vnc_export_bgp.c | 32 ++-- bgpd/rfapi/vnc_export_bgp_p.h | 4 +- bgpd/rfapi/vnc_import_bgp.c | 98 ++++++------ bgpd/rfapi/vnc_import_bgp.h | 21 ++- bgpd/rfapi/vnc_import_bgp_p.h | 8 +- bgpd/rfapi/vnc_zebra.c | 2 +- doc/developer/next-hop-tracking.rst | 2 +- tests/bgpd/test_mpath.c | 44 ++--- tests/bgpd/test_mpath.py | 2 +- 52 files changed, 792 insertions(+), 782 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.h b/bgpd/bgp_advertise.h index 7d551603f2..85629b1b46 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 *binfo; }; /* BGP adjacency out. */ diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index f7b16bda1d..fd7192a6f9 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -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 *binfo, struct bgp_node *rn, + afi_t afi, safi_t safi, int attr_change) { time_t t_now; struct bgp_damp_info *bdi = NULL; @@ -252,7 +252,7 @@ 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 *binfo, struct bgp_node *rn, afi_t afi, safi_t safi) { time_t t_now; @@ -290,7 +290,7 @@ 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 *binfo, afi_t afi, safi_t safi) { time_t t_now, t_diff; struct bgp_damp_info *bdi; @@ -334,7 +334,7 @@ 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 *binfo; if (!bdi) return; @@ -588,7 +588,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 *binfo, json_object *json_path) { struct bgp_damp_info *bdi; @@ -640,8 +640,9 @@ 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, - char *timebuf, size_t len, bool use_json, +const char *bgp_damp_reuse_time_vty(struct vty *vty, + struct bgp_path_info *binfo, char *timebuf, + size_t len, bool use_json, json_object *json) { struct bgp_damp_info *bdi; diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h index 8326bae697..d7ea440c95 100644 --- a/bgpd/bgp_damp.h +++ b/bgpd/bgp_damp.h @@ -44,7 +44,7 @@ struct bgp_damp_info { time_t suppress_time; /* Back reference to bgp_info. */ - struct bgp_info *binfo; + struct bgp_path_info *binfo; /* 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 *binfo, 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..689b174013 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 *info, unsigned int seq) { struct stream *obuf; size_t sizep; @@ -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 *info; struct bgp_node *rn; struct bgp *bgp; struct bgp_table *table; diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index cda02075d7..b46939051c 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 **ri); 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 *ri; afi_t afi = AFI_L2VPN; safi_t safi = SAFI_EVPN; @@ -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], @@ -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; @@ -1217,8 +1216,8 @@ 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_ri = NULL; + struct bgp_path_info *local_ri = NULL; local_ri = NULL; for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) { @@ -1240,8 +1239,8 @@ 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_ri; + struct bgp_path_info *local_ri; local_ri = NULL; for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) { @@ -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_ri = NULL; + struct bgp_path_info *local_ri = NULL; /* local route entry if any */ + struct bgp_path_info *remote_ri = NULL; /* remote route entry if any */ struct attr *attr_new = NULL; struct prefix_evpn *evp = NULL; @@ -1366,7 +1362,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 *ri = NULL; memset(&attr, 0, sizeof(struct attr)); @@ -1411,7 +1407,7 @@ 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_ri; rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, (struct prefix *)p, &es->prd); @@ -1436,10 +1432,10 @@ 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 *ri = 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_ri = NULL; + struct bgp_path_info *tmp_ri = NULL; *route_changed = 0; /* locate the local route entry if any */ @@ -1562,11 +1558,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 **ri, uint8_t flags, uint32_t seq) { - struct bgp_info *tmp_ri; - struct bgp_info *local_ri; + struct bgp_path_info *tmp_ri; + struct bgp_path_info *local_ri; struct attr *attr_new; mpls_label_t label[BGP_MAX_LABELS]; uint32_t num_labels = 1; @@ -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 *ri; afi_t afi = AFI_L2VPN; safi_t safi = SAFI_EVPN; int route_change; @@ -1759,7 +1755,7 @@ 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_ri; rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, (struct prefix *)p, &vpn->prd); @@ -1781,12 +1777,11 @@ 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 **ri) { - struct bgp_info *tmp_ri; + struct bgp_path_info *tmp_ri; *ri = NULL; @@ -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 *ri; struct bgp_node *rn = NULL; /* rn in esi table */ struct bgp_node *global_rn = NULL; /* rn in global table */ @@ -1861,7 +1856,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 *ri = NULL; struct bgp *bgp_def = NULL; /* default bgp instance */ bgp_def = bgp_get_default(); @@ -1889,7 +1884,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 *ri; afi_t afi = AFI_L2VPN; safi_t safi = SAFI_EVPN; @@ -1939,7 +1934,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 *ri, *tmp_ri; struct attr attr; struct attr *attr_new; uint32_t seq; @@ -1955,7 +1950,7 @@ 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_ri; if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE) continue; @@ -2046,7 +2041,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 *ri; afi = AFI_L2VPN; safi = SAFI_EVPN; @@ -2082,7 +2077,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 *ri; afi = AFI_L2VPN; safi = SAFI_EVPN; @@ -2117,7 +2112,7 @@ 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 *ri, *nextri; /* Walk this ES's route table and delete all routes. */ for (rn = bgp_table_top(es->route_table); rn; @@ -2138,7 +2133,7 @@ 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 *ri, *nextri; /* Walk this VNI's route table and delete all routes. */ for (rn = bgp_table_top(vpn->route_table); rn; @@ -2261,14 +2256,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_ri) { int ret = 0; struct bgp_node *rn = NULL; - struct bgp_info *ri = NULL; + struct bgp_path_info *ri = NULL; struct attr *attr_new = NULL; /* Create (or fetch) route within the VNI. @@ -2278,8 +2272,8 @@ static int install_evpn_route_entry_in_es(struct bgp *bgp, /* 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) + if (ri->extra + && (struct bgp_path_info *)ri->extra->parent == parent_ri) break; if (!ri) { @@ -2327,10 +2321,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_ri) { struct bgp_node *rn; - struct bgp_info *ri; + struct bgp_path_info *ri; struct attr attr; struct attr *attr_new; int ret = 0; @@ -2380,7 +2374,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, /* 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) + && (struct bgp_path_info *)ri->extra->parent == parent_ri) break; if (!ri) { @@ -2441,10 +2435,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_ri) { struct bgp_node *rn; - struct bgp_info *ri; + struct bgp_path_info *ri; struct attr *attr_new; int ret; @@ -2455,7 +2449,7 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, /* 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) + && (struct bgp_path_info *)ri->extra->parent == parent_ri) break; if (!ri) { @@ -2506,14 +2500,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_ri) { int ret; struct bgp_node *rn; - struct bgp_info *ri; + struct bgp_path_info *ri; if (!es->route_table) return 0; @@ -2527,8 +2520,8 @@ static int uninstall_evpn_route_entry_in_es(struct bgp *bgp, /* Find matching route entry. */ for (ri = rn->info; ri; ri = ri->next) - if (ri->extra && - (struct bgp_info *)ri->extra->parent == parent_ri) + if (ri->extra + && (struct bgp_path_info *)ri->extra->parent == parent_ri) break; if (!ri) @@ -2552,10 +2545,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_ri) { struct bgp_node *rn; - struct bgp_info *ri; + struct bgp_path_info *ri; int ret = 0; struct prefix p; struct prefix *pp = &p; @@ -2593,7 +2586,7 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, /* Find matching route entry. */ for (ri = rn->info; ri; ri = ri->next) if (ri->extra - && (struct bgp_info *)ri->extra->parent == parent_ri) + && (struct bgp_path_info *)ri->extra->parent == parent_ri) break; if (!ri) @@ -2619,10 +2612,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_ri) { struct bgp_node *rn; - struct bgp_info *ri; + struct bgp_path_info *ri; int ret; /* Locate route within the VNI. */ @@ -2634,7 +2627,7 @@ static int uninstall_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, /* Find matching route entry. */ for (ri = rn->info; ri; ri = ri->next) if (ri->extra - && (struct bgp_info *)ri->extra->parent == parent_ri) + && (struct bgp_path_info *)ri->extra->parent == parent_ri) break; if (!ri) @@ -2672,7 +2665,8 @@ 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 *ri) { struct attr *attr = ri->attr; struct ecommunity *ecom; @@ -2739,7 +2733,7 @@ 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 *ri) { struct attr *attr = ri->attr; struct ecommunity *ecom; @@ -2812,7 +2806,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 *ri; afi = AFI_L2VPN; safi = SAFI_EVPN; @@ -2879,7 +2873,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 *ri; int ret; char buf[PREFIX_STRLEN]; struct bgp *bgp_def = NULL; @@ -2964,7 +2958,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 *ri; int ret; afi = AFI_L2VPN; @@ -3097,8 +3091,7 @@ 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 *ri, int install) { int ret = 0; char buf[ESI_STR_LEN]; @@ -3124,7 +3117,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 *ri, struct list *vrfs, int install) { char buf[PREFIX2STR_BUFFER]; @@ -3170,7 +3163,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 *ri, struct list *vnis, int install) { struct bgpevpn *vpn; @@ -3206,8 +3199,8 @@ 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 *ri, int import) { struct prefix_evpn *evp = (struct prefix_evpn *)p; struct attr *attr = ri->attr; @@ -3393,7 +3386,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 *ri, *global_ri; struct attr *attr; afi_t afi = AFI_L2VPN; safi_t safi = SAFI_EVPN; @@ -3470,7 +3463,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 *ri; afi_t afi = AFI_L2VPN; safi_t safi = SAFI_EVPN; @@ -4090,7 +4083,7 @@ 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 *ri; table = bgp_vrf->rib[afi][safi]; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) { @@ -4138,7 +4131,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 *ri; table = bgp_vrf->rib[afi][safi]; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) { @@ -5074,7 +5067,7 @@ 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 *ri) { return install_uninstall_evpn_route(bgp, afi, safi, p, ri, 1); } @@ -5083,7 +5076,7 @@ int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi, * 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 *ri) { return install_uninstall_evpn_route(bgp, afi, safi, p, ri, 0); } @@ -5095,7 +5088,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 *ri; afi = AFI_L2VPN; safi = SAFI_EVPN; diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index b002be3d3d..968d5a0b3f 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); diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 5a1e8edac4..7c6da82b4d 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 *ri; uint32_t prefix_cnt, path_cnt; uint64_t tbl_ver; @@ -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 *ri; struct bgp_table *table; int header = 1; uint64_t tbl_ver; @@ -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 *ri; int rd_header; int header = 1; @@ -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 *ri; uint32_t path_cnt = 0; afi_t afi; safi_t safi; @@ -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 *ri; uint32_t path_cnt = 0; afi_t afi; safi_t safi; @@ -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 *ri; afi_t afi; safi_t safi; uint32_t path_cnt = 0; @@ -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 *ri; int rd_header = 1; afi_t afi; safi_t safi; @@ -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 *ri; int header = 1; int rd_header; afi_t afi; diff --git a/bgpd/bgp_flowspec.h b/bgpd/bgp_flowspec.h index f07b696b8d..d924917563 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 *binfo, 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..293b9debb4 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 *binfo, int display, + json_object *json_paths) { struct attr *attr; char return_string[BGP_FLOWSPEC_STRING_DISPLAY_MAX]; @@ -329,7 +329,7 @@ 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_info_extra_get(binfo); if (extra->bgp_fs_pbr) { struct listnode *node; @@ -368,7 +368,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 *ri; struct bgp_node *rn; unsigned long total_count = 0; json_object *json_paths = NULL; diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index ba059d66e6..0764280d93 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -94,7 +94,7 @@ 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 *ri, struct peer *to, afi_t afi, safi_t safi) { struct peer *from; @@ -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 *ri, + int reg) { struct stream *s; struct prefix *p; diff --git a/bgpd/bgp_label.h b/bgpd/bgp_label.h index 2b2525dd0e..e910960ed3 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 *ri, 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 *ri, struct peer *to, afi_t afi, safi_t safi); extern int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, @@ -85,7 +85,7 @@ 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 *ri) { bgp_reg_dereg_for_label(rn, ri, 1); } diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 6d31682777..f7ee3af49b 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -119,7 +119,7 @@ static int bgp_interface_same(struct interface *ifp1, struct interface *ifp2) * or greater than zero if bi1 is respectively less than, equal to, * or greater than bi2. */ -int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2) +int bgp_info_nexthop_cmp(struct bgp_path_info *bi1, struct bgp_path_info *bi2) { int compare; struct in6_addr addr1, addr2; @@ -195,7 +195,7 @@ int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2) */ static int bgp_info_mpath_cmp(void *val1, void *val2) { - struct bgp_info *bi1, *bi2; + struct bgp_path_info *bi1, *bi2; int compare; bi1 = val1; @@ -247,7 +247,7 @@ 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); @@ -258,11 +258,11 @@ void bgp_mp_list_add(struct list *mp_list, struct bgp_info *mpinfo) * * Allocate and zero memory for a new bgp_info_mpath element */ -static struct bgp_info_mpath *bgp_info_mpath_new(void) +static struct bgp_path_info_mpath *bgp_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; } @@ -271,7 +271,7 @@ static struct bgp_info_mpath *bgp_info_mpath_new(void) * * Release resources for a bgp_info_mpath element and zero out pointer */ -void bgp_info_mpath_free(struct bgp_info_mpath **mpath) +void bgp_info_mpath_free(struct bgp_path_info_mpath **mpath) { if (mpath && *mpath) { if ((*mpath)->mp_attr) @@ -287,9 +287,10 @@ void bgp_info_mpath_free(struct bgp_info_mpath **mpath) * Fetch the mpath element for the given bgp_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_info_mpath_get(struct bgp_path_info *binfo) { - struct bgp_info_mpath *mpath; + struct bgp_path_info_mpath *mpath; if (!binfo->mpath) { mpath = bgp_info_mpath_new(); if (!mpath) @@ -306,10 +307,10 @@ static struct bgp_info_mpath *bgp_info_mpath_get(struct bgp_info *binfo) * 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_info_mpath_enqueue(struct bgp_path_info *prev_info, + struct bgp_path_info *binfo) { - 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); @@ -330,9 +331,9 @@ static void bgp_info_mpath_enqueue(struct bgp_info *prev_info, * * Remove a path from the multipath list */ -void bgp_info_mpath_dequeue(struct bgp_info *binfo) +void bgp_info_mpath_dequeue(struct bgp_path_info *binfo) { - struct bgp_info_mpath *mpath = binfo->mpath; + struct bgp_path_info_mpath *mpath = binfo->mpath; if (!mpath) return; if (mpath->mp_prev) @@ -348,7 +349,7 @@ void bgp_info_mpath_dequeue(struct bgp_info *binfo) * * Given a bgp_info, return the next multipath entry */ -struct bgp_info *bgp_info_mpath_next(struct bgp_info *binfo) +struct bgp_path_info *bgp_info_mpath_next(struct bgp_path_info *binfo) { if (!binfo->mpath || !binfo->mpath->mp_next) return NULL; @@ -360,7 +361,7 @@ struct bgp_info *bgp_info_mpath_next(struct bgp_info *binfo) * * Given bestpath bgp_info, return the first multipath entry. */ -struct bgp_info *bgp_info_mpath_first(struct bgp_info *binfo) +struct bgp_path_info *bgp_info_mpath_first(struct bgp_path_info *binfo) { return bgp_info_mpath_next(binfo); } @@ -370,7 +371,7 @@ struct bgp_info *bgp_info_mpath_first(struct bgp_info *binfo) * * Given the bestpath bgp_info, return the number of multipath entries */ -uint32_t bgp_info_mpath_count(struct bgp_info *binfo) +uint32_t bgp_info_mpath_count(struct bgp_path_info *binfo) { if (!binfo->mpath) return 0; @@ -382,9 +383,10 @@ uint32_t bgp_info_mpath_count(struct bgp_info *binfo) * * 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_info_mpath_count_set(struct bgp_path_info *binfo, + uint32_t count) { - struct bgp_info_mpath *mpath; + struct bgp_path_info_mpath *mpath; if (!count && !binfo->mpath) return; mpath = bgp_info_mpath_get(binfo); @@ -399,7 +401,7 @@ static void bgp_info_mpath_count_set(struct bgp_info *binfo, uint32_t count) * Given bestpath bgp_info, return aggregated attribute set used * for advertising the multipath route */ -struct attr *bgp_info_mpath_attr(struct bgp_info *binfo) +struct attr *bgp_info_mpath_attr(struct bgp_path_info *binfo) { if (!binfo->mpath) return NULL; @@ -411,9 +413,10 @@ struct attr *bgp_info_mpath_attr(struct bgp_info *binfo) * * 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_info_mpath_attr_set(struct bgp_path_info *binfo, + struct attr *attr) { - struct bgp_info_mpath *mpath; + struct bgp_path_info_mpath *mpath; if (!attr && !binfo->mpath) return; mpath = bgp_info_mpath_get(binfo); @@ -428,13 +431,13 @@ static void bgp_info_mpath_attr_set(struct bgp_info *binfo, struct attr *attr) * 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, +void bgp_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]; @@ -485,7 +488,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 @@ -642,9 +645,9 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best, * 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; @@ -672,10 +675,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_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; diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h index 1fa11d3d0e..8c07418235 100644 --- a/bgpd/bgp_mpath.h +++ b/bgpd/bgp_mpath.h @@ -25,15 +25,15 @@ /* Supplemental information linked to bgp_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; + struct bgp_path_info *mp_info; /* When attached to best path, the number of selected multipaths */ uint32_t mp_count; @@ -50,27 +50,30 @@ 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_info_nexthop_cmp(struct bgp_path_info *bi1, + struct bgp_path_info *bi2); 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_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_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 **); +extern void bgp_info_mpath_dequeue(struct bgp_path_info *path); +extern void bgp_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_info_mpath_first(struct bgp_path_info *); +extern struct bgp_path_info *bgp_info_mpath_next(struct bgp_path_info *); /* 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_info_mpath_count(struct bgp_path_info *path); +extern struct attr *bgp_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 a9df2f5f89..08de91ff55 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -402,7 +402,8 @@ 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 *bi, mpls_label_t *label, + uint32_t n) { uint32_t i; @@ -426,10 +427,9 @@ 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 *bi, + mpls_label_t *label, /* array of labels */ + uint32_t num_labels) { if (num_labels) assert(label); @@ -441,7 +441,7 @@ static void setlabels( return; } - struct bgp_info_extra *extra = bgp_info_extra_get(bi); + struct bgp_path_info_extra *extra = bgp_info_extra_get(bi); uint32_t i; for (i = 0; i < num_labels; ++i) { @@ -456,26 +456,18 @@ static void setlabels( /* * returns pointer to new bgp_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_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) { struct prefix *p = &bn->p; - struct bgp_info *bi; - struct bgp_info *bi_ultimate; - struct bgp_info *new; + struct bgp_path_info *bi; + struct bgp_path_info *bi_ultimate; + struct bgp_path_info *new; char buf_prefix[PREFIX_STRLEN]; if (debug) { @@ -599,7 +591,7 @@ leak_update( setlabels(new, label, num_labels); new->extra->parent = bgp_info_lock(parent); - bgp_lock_node((struct bgp_node *)((struct bgp_info *)parent)->net); + 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) @@ -650,9 +642,9 @@ 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 *info_vrf) /* route */ { int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF); struct prefix *p = &info_vrf->net->p; @@ -705,7 +697,7 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */ * 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)); @@ -858,7 +850,7 @@ 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, @@ -877,15 +869,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 *info_vrf) /* route */ { int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF); struct prefix *p = &info_vrf->net->p; afi_t afi = family2afi(p->family); safi_t safi = SAFI_MPLS_VPN; - struct bgp_info *bi; + struct bgp_path_info *bi; struct bgp_node *bn; const char *debugmsg; char buf_prefix[PREFIX_STRLEN]; @@ -965,7 +957,7 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *bgp_vpn, /* to */ struct bgp_table *table; struct bgp_node *bn; - struct bgp_info *bi; + struct bgp_path_info *bi; /* This is the per-RD table of prefixes */ table = prn->info; @@ -1013,7 +1005,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 *bi; int debug = BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF); if (debug) @@ -1036,9 +1028,10 @@ void vpn_leak_from_vrf_update_all(struct bgp *bgp_vpn, /* to */ } } -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 *info_vpn) /* route */ { struct prefix *p = &info_vpn->net->p; afi_t afi = family2afi(p->family); @@ -1052,7 +1045,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 *bi_ultimate = NULL; int origin_local = 0; struct bgp *src_vrf; @@ -1124,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)); @@ -1221,8 +1214,8 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */ 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 *info_vpn) /* route */ { struct listnode *mnode, *mnnode; struct bgp *bgp; @@ -1242,8 +1235,8 @@ void vpn_leak_to_vrf_update(struct bgp *bgp_vpn, /* from */ } } -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 *info_vpn) /* route */ { struct prefix *p; afi_t afi; @@ -1251,7 +1244,7 @@ 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 *bi; const char *debugmsg; char buf_prefix[PREFIX_STRLEN]; @@ -1309,7 +1302,7 @@ void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, /* from */ 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 + && (struct bgp_path_info *)bi->extra->parent == info_vpn) { break; } @@ -1330,7 +1323,7 @@ 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 *bi; safi_t safi = SAFI_UNICAST; int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF); @@ -1373,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 *bi; memset(&prd, 0, sizeof(prd)); prd.family = AF_UNSPEC; diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 61b87392a2..1ae9169944 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 *info_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 *info_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 *info_vpn); extern void vpn_leak_to_vrf_withdraw(struct bgp *bgp_vpn, - struct bgp_info *info_vpn); + struct bgp_path_info *info_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.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 d90e32dab1..aa9fb16cfc 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 *ri, 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 *ri, struct peer *peer, int connected) { struct bgp_node *rn; @@ -527,7 +527,7 @@ 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 *ri, struct prefix *p) { int is_bgp_static = ((ri->type == ZEBRA_ROUTE_BGP) @@ -673,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; @@ -786,8 +786,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..363d9d9b5b 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 *binfo, 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 *info, struct bgp_pbr_entry_main *api) { int ret; @@ -1224,11 +1224,11 @@ static void bgp_pbr_flush_entry(struct bgp *bgp, struct bgp_pbr_action *bpa, bpme->installed = false; bpme->backpointer = NULL; if (bpme->bgp_info) { - struct bgp_info *bgp_info; - struct bgp_info_extra *extra; + struct bgp_path_info *bgp_info; + struct bgp_path_info_extra *extra; /* unlink bgp_info to bpme */ - bgp_info = (struct bgp_info *)bpme->bgp_info; + bgp_info = (struct bgp_path_info *)bpme->bgp_info; extra = bgp_info_extra_get(bgp_info); if (extra->bgp_fs_pbr) listnode_delete(extra->bgp_fs_pbr, bpme); @@ -1304,9 +1304,10 @@ 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 *binfo, + struct bgp_pbr_filter *bpf) { struct bgp_pbr_match temp; struct bgp_pbr_match_entry temp2; @@ -1438,13 +1439,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 *binfo, + 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; @@ -1507,11 +1505,10 @@ static void bgp_pbr_icmp_action(struct bgp *bgp, } } -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 *binfo, + 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; @@ -1554,10 +1551,9 @@ static void bgp_pbr_policyroute_remove_from_zebra_recursive(struct bgp *bgp, } } -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 *binfo, + struct bgp_pbr_filter *bpf, struct bgp_pbr_or_filter *bpof) { if (!bpof) return bgp_pbr_policyroute_remove_from_zebra_unit(bgp, @@ -1692,10 +1688,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 *binfo, + struct bgp_pbr_filter *bpf, + struct nexthop *nh, + float *rate) { struct bgp_pbr_match temp; struct bgp_pbr_match_entry temp2; @@ -1854,7 +1850,7 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp, /* already installed */ if (bpme_found) { - struct bgp_info_extra *extra = bgp_info_extra_get(binfo); + struct bgp_path_info_extra *extra = bgp_info_extra_get(binfo); if (extra && extra->bgp_fs_pbr && listnode_lookup(extra->bgp_fs_pbr, bpme)) { @@ -1911,13 +1907,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 *binfo, + 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; @@ -1961,11 +1954,10 @@ static void bgp_pbr_policyroute_add_to_zebra_recursive(struct bgp *bgp, } 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 *binfo, + 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, @@ -2012,10 +2004,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 *binfo, + struct bgp_pbr_entry_main *api, bool add) { struct nexthop nh; int i = 0; @@ -2236,8 +2226,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..2b0a9d80e1 100644 --- a/bgpd/bgp_pbr.h +++ b/bgpd/bgp_pbr.h @@ -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 647b2a73fa..be7ab0dace 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -165,18 +165,19 @@ struct bgp_node *bgp_afi_node_lookup(struct bgp_table *table, afi_t afi, } /* Allocate bgp_info_extra */ -static struct bgp_info_extra *bgp_info_extra_new(void) +static struct bgp_path_info_extra *bgp_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_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,7 +188,7 @@ 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 *bi = (struct bgp_path_info *)e->parent; if (bi->net) { /* FIXME: since multiple e may have the same e->parent @@ -224,7 +225,7 @@ static void bgp_info_extra_free(struct bgp_info_extra **extra) /* Get bgp_info extra information for the given bgp_info, lazy allocated * if required. */ -struct bgp_info_extra *bgp_info_extra_get(struct bgp_info *ri) +struct bgp_path_info_extra *bgp_info_extra_get(struct bgp_path_info *ri) { if (!ri->extra) ri->extra = bgp_info_extra_new(); @@ -232,13 +233,13 @@ struct bgp_info_extra *bgp_info_extra_get(struct bgp_info *ri) } /* Allocate new bgp info structure. */ -struct bgp_info *bgp_info_new(void) +struct bgp_path_info *bgp_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_info_free(struct bgp_path_info *binfo) { if (binfo->attr) bgp_attr_unintern(&binfo->attr); @@ -252,13 +253,13 @@ static void bgp_info_free(struct bgp_info *binfo) XFREE(MTYPE_BGP_ROUTE, binfo); } -struct bgp_info *bgp_info_lock(struct bgp_info *binfo) +struct bgp_path_info *bgp_info_lock(struct bgp_path_info *binfo) { binfo->lock++; return binfo; } -struct bgp_info *bgp_info_unlock(struct bgp_info *binfo) +struct bgp_path_info *bgp_info_unlock(struct bgp_path_info *binfo) { assert(binfo && binfo->lock > 0); binfo->lock--; @@ -283,9 +284,9 @@ struct bgp_info *bgp_info_unlock(struct bgp_info *binfo) return binfo; } -void bgp_info_add(struct bgp_node *rn, struct bgp_info *ri) +void bgp_info_add(struct bgp_node *rn, struct bgp_path_info *ri) { - struct bgp_info *top; + struct bgp_path_info *top; top = rn->info; @@ -302,7 +303,7 @@ void bgp_info_add(struct bgp_node *rn, struct bgp_info *ri) /* 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_info_reap(struct bgp_node *rn, struct bgp_path_info *ri) { if (ri->next) ri->next->prev = ri->prev; @@ -316,7 +317,7 @@ void bgp_info_reap(struct bgp_node *rn, struct bgp_info *ri) bgp_unlock_node(rn); } -void bgp_info_delete(struct bgp_node *rn, struct bgp_info *ri) +void bgp_info_delete(struct bgp_node *rn, struct bgp_path_info *ri) { bgp_info_set_flag(rn, ri, BGP_PATH_REMOVED); /* set of previous already took care of pcount */ @@ -326,7 +327,7 @@ void bgp_info_delete(struct bgp_node *rn, struct bgp_info *ri) /* undo the effects of a previous call to bgp_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_info_restore(struct bgp_node *rn, struct bgp_path_info *ri) { bgp_info_unset_flag(rn, ri, BGP_PATH_REMOVED); /* unset of previous already took care of pcount */ @@ -334,7 +335,7 @@ void bgp_info_restore(struct bgp_node *rn, struct bgp_info *ri) } /* 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 *ri) { struct bgp_table *table; @@ -364,7 +365,8 @@ static void bgp_pcount_adjust(struct bgp_node *rn, struct bgp_info *ri) } } -static int bgp_label_index_differs(struct bgp_info *ri1, struct bgp_info *ri2) +static int bgp_label_index_differs(struct bgp_path_info *ri1, + struct bgp_path_info *ri2) { return (!(ri1->attr->label_index == ri2->attr->label_index)); } @@ -372,7 +374,8 @@ static int bgp_label_index_differs(struct bgp_info *ri1, struct bgp_info *ri2) /* Set/unset bgp_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_info_set_flag(struct bgp_node *rn, struct bgp_path_info *ri, + uint32_t flag) { SET_FLAG(ri->flags, flag); @@ -385,7 +388,7 @@ void bgp_info_set_flag(struct bgp_node *rn, struct bgp_info *ri, uint32_t flag) bgp_pcount_adjust(rn, ri); } -void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_info *ri, +void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_path_info *ri, uint32_t flag) { UNSET_FLAG(ri->flags, flag); @@ -413,7 +416,7 @@ 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_info_path_with_addpath_rx_str(struct bgp_path_info *ri, char *buf) { if (ri->addpath_rx_id) sprintf(buf, "path %s (addpath rxid %d)", ri->peer->host, @@ -424,8 +427,8 @@ void bgp_info_path_with_addpath_rx_str(struct bgp_info *ri, char *buf) /* 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, +static int bgp_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) { @@ -1020,9 +1023,9 @@ 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_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; @@ -1164,7 +1167,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 info; route_map_result_t ret; struct route_map *rmap = NULL; @@ -1190,7 +1193,7 @@ static int bgp_input_modifier(struct peer *peer, struct prefix *p, /* Route map apply. */ if (rmap) { - memset(&info, 0, sizeof(struct bgp_info)); + memset(&info, 0, sizeof(struct bgp_path_info)); /* Duplicate current value to new strucutre for modification. */ info.peer = peer; info.attr = attr; @@ -1212,7 +1215,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 info; route_map_result_t ret; struct route_map *rmap = NULL; uint8_t rmap_type; @@ -1239,7 +1242,7 @@ 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(&info, 0, sizeof(struct bgp_path_info)); /* Route map apply. */ /* Duplicate current value to new strucutre for modification. */ info.peer = peer; @@ -1372,7 +1375,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 *ri, struct update_subgroup *subgrp, struct prefix *p, struct attr *attr) { @@ -1695,17 +1698,17 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_info *ri, /* 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; + struct bgp_path_info info; + struct bgp_path_info_extra dummy_info_extra; struct attr dummy_attr; - memset(&info, 0, sizeof(struct bgp_info)); + memset(&info, 0, sizeof(struct bgp_path_info)); info.peer = peer; info.attr = attr; if (ri->extra) { memcpy(&dummy_info_extra, ri->extra, - sizeof(struct bgp_info_extra)); + sizeof(struct bgp_path_info_extra)); info.extra = &dummy_info_extra; } @@ -1836,14 +1839,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 *ri; + struct bgp_path_info *ri1; + struct bgp_path_info *ri2; + struct bgp_path_info *nextri = NULL; int paths_eq, do_mpath, debug; struct list mp_list; char pfx_buf[PREFIX2STR_BUFFER]; @@ -2057,7 +2061,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,7 +2116,7 @@ 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 *ri; for (ri = rn->info; ri; ri = ri->next) { if (BGP_PATH_HOLDDOWN(ri)) @@ -2127,9 +2131,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) @@ -2185,9 +2190,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; @@ -2669,8 +2674,8 @@ 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 *ri, + struct peer *peer, afi_t afi, safi_t safi) { bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi, safi); @@ -2680,7 +2685,7 @@ void bgp_rib_remove(struct bgp_node *rn, struct bgp_info *ri, struct peer *peer, 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 *ri, struct peer *peer, afi_t afi, safi_t safi, struct prefix_rd *prd) { @@ -2728,14 +2733,14 @@ static void bgp_rib_withdraw(struct bgp_node *rn, struct bgp_info *ri, bgp_rib_remove(rn, ri, 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,7 +2774,7 @@ 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 *info, struct eth_segment_id *eth_s_id, union gw_addr *gw_ip) { @@ -2878,9 +2883,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 *ri; + struct bgp_path_info *new; + struct bgp_path_info_extra *extra; const char *reason; char pfx_buf[BGP_PRD_PATH_STRLEN]; int connected = 0; @@ -3531,7 +3536,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 *ri; #if ENABLE_BGP_VNC if ((SAFI_MPLS_VPN == safi) || (SAFI_ENCAP == safi)) { @@ -3727,7 +3732,7 @@ 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 *ri = rn->info; uint32_t num_labels = 0; mpls_label_t *label_pnt = NULL; @@ -3783,7 +3788,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 *ri; struct bgp *bgp; afi_t afi = bgp_node_table(rn)->afi; safi_t safi = bgp_node_table(rn)->safi; @@ -3882,7 +3887,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 *ri, *next; struct bgp_adj_in *ain; struct bgp_adj_in *ain_next; @@ -4043,7 +4048,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 *ri; struct bgp_table *table; if (safi == SAFI_MPLS_VPN) { @@ -4086,8 +4091,8 @@ 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 *ri; + struct bgp_path_info *next; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) for (ri = rn->info; ri; ri = next) { @@ -4352,9 +4357,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 *ri; + struct bgp_path_info *new; + struct bgp_path_info info; struct attr attr; struct attr *attr_new; int ret; @@ -4387,7 +4392,7 @@ 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)); + memset(&info, 0, sizeof(struct bgp_path_info)); info.peer = bgp->peer_self; info.attr = &attr_tmp; @@ -4582,7 +4587,7 @@ 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 *ri; rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL); @@ -4617,7 +4622,7 @@ 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 *ri; rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd); @@ -4652,10 +4657,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 *ri; #if ENABLE_BGP_VNC mpls_label_t label = 0; #endif @@ -4703,7 +4708,7 @@ 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 info; int ret; info.peer = bgp->peer_self; @@ -5071,7 +5076,7 @@ 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 *ri; table = bgp->rib[afi][safi]; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) { @@ -5467,7 +5472,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 *ri, uint8_t origin, struct aspath *aspath, struct community *comm) { @@ -5503,7 +5508,7 @@ 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 *ri, *new; table = bgp->rib[afi][safi]; @@ -5566,8 +5571,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 *rinew, afi_t afi, + safi_t safi, struct bgp_path_info *del, struct bgp_aggregate *aggregate) { struct bgp_table *table; @@ -5578,7 +5583,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 *ri; unsigned long match = 0; uint8_t atomic_aggregate = 0; @@ -5723,7 +5728,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 *ri; unsigned long match; table = bgp->rib[afi][safi]; @@ -5763,7 +5768,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 *ri, afi_t afi, safi_t safi) { struct bgp_node *child; struct bgp_node *rn; @@ -5797,7 +5802,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 +6066,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 *bi; + struct bgp_path_info info; struct bgp_node *bn; struct attr attr; struct attr *new_attr; @@ -6119,7 +6124,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, /* Apply route-map. */ if (red->rmap.name) { - memset(&info, 0, sizeof(struct bgp_info)); + memset(&info, 0, sizeof(struct bgp_path_info)); info.peer = bgp->peer_self; info.attr = &attr_new; @@ -6222,7 +6227,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 *ri; struct bgp_redist *red; afi = family2afi(p->family); @@ -6256,7 +6261,7 @@ 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 *ri; struct bgp_table *table; table = bgp->rib[afi][SAFI_UNICAST]; @@ -6340,7 +6345,8 @@ enum bgp_display_type { }; /* Print the short form route status for a bgp_info */ -static void route_vty_short_status_out(struct vty *vty, struct bgp_info *binfo, +static void route_vty_short_status_out(struct vty *vty, + struct bgp_path_info *binfo, json_object *json_path) { if (json_path) { @@ -6418,8 +6424,9 @@ static void route_vty_short_status_out(struct vty *vty, struct bgp_info *binfo, } /* 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 *binfo, int display, safi_t safi, + json_object *json_paths) { struct attr *attr; json_object *json_path = NULL; @@ -6910,7 +6917,7 @@ 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 *binfo, int display, safi_t safi, json_object *json) { json_object *json_out = NULL; @@ -7025,7 +7032,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 *binfo, int display, json_object *json_paths) { struct attr *attr; @@ -7103,8 +7110,8 @@ 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 *binfo, int display, + safi_t safi, bool use_json, json_object *json) { struct attr *attr; int len; @@ -7166,8 +7173,8 @@ 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 *binfo, int display, + safi_t safi, bool use_json, json_object *json) { struct attr *attr; struct bgp_damp_info *bdi; @@ -7314,7 +7321,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 *binfo, afi_t afi, safi_t safi, json_object *json_paths) { char buf[INET6_ADDRSTRLEN]; @@ -7365,10 +7372,11 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, } vty_out(vty, "\n"); if (binfo->extra && binfo->extra->parent) { - struct bgp_info *parent_ri; + 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 *)binfo->extra->parent; rn = parent_ri->net; if (rn && rn->prn) { prn = rn->prn; @@ -8189,7 +8197,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 *ri; struct bgp_node *rn; int header = 1; int display; @@ -8266,7 +8274,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, } if (type == bgp_show_type_route_map) { struct route_map *rmap = output_arg; - struct bgp_info binfo; + struct bgp_path_info binfo; struct attr dummy_attr; int ret; @@ -8591,7 +8599,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 *ri; struct prefix *p; struct peer *peer; struct listnode *node, *nnode; @@ -8799,7 +8807,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 *ri; struct bgp_table *table; json_object *json = NULL; json_object *json_paths = NULL; @@ -9677,7 +9685,7 @@ 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 *ri; struct bgp_node *prn = bgp_node_parent_nolock(rn); unsigned int rinum = 0; @@ -9887,7 +9895,7 @@ 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 *ri; for (ain = rn->adj_in; ain; ain = ain->next) if (ain->peer == peer) @@ -10864,8 +10872,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 *rinfo, + afi_t afi, safi_t safi, struct bgp *bgp) { struct bgp_node *rn; struct prefix q; @@ -11143,8 +11151,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 *ri; + struct bgp_path_info *ri_temp; struct bgp *bgp; struct bgp_table *table; diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index ebfe0278fa..e9e282d371 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; @@ -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. */ @@ -339,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 *ri, struct peer *peer, afi_t afi, safi_t safi); extern void bgp_process_queue_init(void); extern void bgp_route_init(void); @@ -358,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_info_lock(struct bgp_path_info *path); +extern struct bgp_path_info *bgp_info_unlock(struct bgp_path_info *path); +extern void bgp_info_add(struct bgp_node *rn, struct bgp_path_info *ri); +extern void bgp_info_reap(struct bgp_node *rn, struct bgp_path_info *ri); +extern void bgp_info_delete(struct bgp_node *rn, struct bgp_path_info *ri); +extern struct bgp_path_info_extra * +bgp_info_extra_get(struct bgp_path_info *path); +extern void bgp_info_set_flag(struct bgp_node *rn, struct bgp_path_info *path, + uint32_t flag); +extern void bgp_info_unset_flag(struct bgp_node *rn, struct bgp_path_info *path, + uint32_t flag); +extern void bgp_info_path_with_addpath_rx_str(struct bgp_path_info *ri, + char *buf); extern int bgp_nlri_parse_ip(struct peer *, struct attr *, struct bgp_nlri *); @@ -420,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 *binfo, 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 *ri, struct update_subgroup *subgrp, struct prefix *p, struct attr *attr); @@ -462,28 +472,28 @@ 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 struct bgp_path_info *bgp_info_new(void); +extern void bgp_info_restore(struct bgp_node *rn, struct bgp_path_info *path); -extern int bgp_info_cmp_compatible(struct bgp *, struct bgp_info *, - struct bgp_info *, char *pfx_buf, afi_t afi, - safi_t safi); +extern int bgp_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 *binfo, 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..f6eae653ac 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -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 *info = (struct bgp_path_info *)object; lua_State *L = lua_initialize("/etc/frr/lua.scr"); if (L == NULL) @@ -477,7 +477,7 @@ 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 *bgp_info; struct prefix_ipv4 p; if (type == RMAP_BGP && prefix->family == AF_INET) { @@ -524,7 +524,7 @@ 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 *bgp_info; struct peer *peer; struct prefix_ipv4 p; @@ -610,7 +610,7 @@ 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 *bgp_info; struct prefix_ipv4 p; if (type == RMAP_BGP && prefix->family == AF_INET) { @@ -651,10 +651,10 @@ 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 *bgp_info; if (type == RMAP_BGP && prefix->family == AF_INET) { - bgp_info = (struct bgp_info *)object; + bgp_info = (struct bgp_path_info *)object; if (!bgp_info || !bgp_info->attr) return RMAP_DENYMATCH; @@ -692,7 +692,7 @@ 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 *bgp_info; struct peer *peer; struct prefix_ipv4 p; @@ -810,11 +810,11 @@ 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 *bgp_info = NULL; if (type == RMAP_BGP) { vni = *((vni_t *)rule); - bgp_info = (struct bgp_info *)object; + bgp_info = (struct bgp_path_info *)object; if (bgp_info->extra == NULL) return RMAP_NOMATCH; @@ -914,7 +914,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { local_pref = rule; @@ -974,7 +974,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { rv = rule; @@ -999,7 +999,7 @@ static route_map_result_t route_match_aspath(void *rule, { struct as_list *as_list; - struct bgp_info *bgp_info; + struct bgp_path_info *bgp_info; if (type == RMAP_BGP) { as_list = as_list_lookup((char *)rule); @@ -1047,7 +1047,7 @@ 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 *bgp_info; struct rmap_community *rcom; if (type == RMAP_BGP) { @@ -1115,7 +1115,7 @@ 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 *bgp_info; struct rmap_community *rcom; if (type == RMAP_BGP) { @@ -1176,7 +1176,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { bgp_info = object; @@ -1219,7 +1219,7 @@ static route_map_result_t route_match_origin(void *rule, void *object) { uint8_t *origin; - struct bgp_info *bgp_info; + struct bgp_path_info *bgp_info; if (type == RMAP_BGP) { origin = rule; @@ -1322,7 +1322,7 @@ static route_map_result_t route_match_interface(void *rule, void *object) { struct interface *ifp; - struct bgp_info *info; + struct bgp_path_info *info; if (type == RMAP_BGP) { info = object; @@ -1368,7 +1368,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { tag = rule; @@ -1402,7 +1402,7 @@ 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 *bgp_info; struct peer *peer; if (type == RMAP_BGP) { @@ -1510,7 +1510,7 @@ 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 *bgp_info; uint32_t locpref = 0; if (type == RMAP_BGP) { @@ -1545,7 +1545,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { /* Fetch routemap's rule information. */ @@ -1574,7 +1574,7 @@ 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 *bgp_info; uint32_t med = 0; if (type == RMAP_BGP) { @@ -1608,7 +1608,7 @@ 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 *binfo; if (type == RMAP_BGP) { binfo = object; @@ -1670,7 +1670,7 @@ 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 *binfo; if (type == RMAP_BGP) { exclude_path = rule; @@ -1705,7 +1705,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 *binfo; struct attr *attr; struct community *new = NULL; struct community *old; @@ -1821,7 +1821,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 *binfo; struct attr *attr; struct lcommunity *new = NULL; struct lcommunity *old; @@ -1937,7 +1937,7 @@ 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 *binfo; if (type == RMAP_BGP) { if (!rule) @@ -2022,7 +2022,7 @@ 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 *binfo; if (type == RMAP_BGP) { if (!rule) @@ -2104,7 +2104,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { ecom = rule; @@ -2190,7 +2190,7 @@ static route_map_result_t route_set_origin(void *rule, void *object) { uint8_t *origin; - struct bgp_info *bgp_info; + struct bgp_path_info *bgp_info; if (type == RMAP_BGP) { origin = rule; @@ -2239,7 +2239,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { bgp_info = object; @@ -2279,7 +2279,7 @@ 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 *bgp_info; struct aggregator *aggregator; if (type == RMAP_BGP) { @@ -2327,13 +2327,13 @@ 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 *bgp_info; if (type == RMAP_BGP) { tag = rule; @@ -2352,14 +2352,14 @@ 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 *bgp_info; uint32_t label_index; if (type == RMAP_BGP) { @@ -2429,7 +2429,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { bgp_info = object; @@ -2514,11 +2514,11 @@ 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 *bgp_info; struct in6_addr *addr = rule; if (type == RMAP_BGP && prefix->family == AF_INET6) { - bgp_info = (struct bgp_info *)object; + bgp_info = (struct bgp_path_info *)object; if (!bgp_info || !bgp_info->attr) return RMAP_DENYMATCH; @@ -2564,7 +2564,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { /* Fetch routemap's rule information. */ @@ -2622,7 +2622,7 @@ 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 *bgp_info; struct peer *peer; if (type == RMAP_BGP) { @@ -2678,7 +2678,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { /* Fetch routemap's rule information. */ @@ -2741,7 +2741,7 @@ 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 *bgp_info; struct peer *peer; if (type == RMAP_BGP) { @@ -2820,7 +2820,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { /* Fetch routemap's rule information. */ @@ -2860,7 +2860,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { /* Fetch routemap's rule information. */ @@ -2916,7 +2916,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { address = rule; diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 56566525a4..84fca2d125 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -217,7 +217,7 @@ 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 *bgp_info; if (type == RMAP_BGP) { bgp_info = object; @@ -418,7 +418,7 @@ 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 *bgp_info = bgp_node->info; mpls_label_t *label = NULL; uint32_t num_labels = 0; diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 0700e0ac24..46a15540a4 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 *binfo; + struct bgp_path_info *min; struct bgp_node *rn; union sockunion su; unsigned int len; @@ -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 *binfo; struct prefix_ipv4 addr; bgp = bgp_get_default(); diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index e2e25e50f5..1b116c1ba4 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1904,7 +1904,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 *ri) { if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h index c1cbca6dcf..b7b73e786f 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 *ri; 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 *ri); 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 *binfo); 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 *ri); /* * Inline functions diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index e4fda568e8..a2e3aa3917 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 *ri; afi_t afi; safi_t safi; struct peer *peer; @@ -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 *binfo) { struct bgp_adj_out *adj = NULL; struct bgp_advertise *adv; @@ -453,7 +453,8 @@ 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 */ + /* bgp_path_info adj_out reference */ + adv->binfo = bgp_info_lock(binfo); 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; @@ -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,7 +831,7 @@ 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 *ri) { struct updwalk_context ctx; ctx.ri = ri; diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 56a82c801c..c3ca3e6526 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 *binfo = NULL; bgp_size_t total_attr_len = 0; unsigned long attrlen_pos = 0; size_t mpattrlen_pos = 0; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index e705a714e9..c7f8494d3b 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, diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 1b6364ca9a..7dd5165072 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -925,7 +925,7 @@ 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, +static struct in6_addr *bgp_info_to_ipv6_nexthop(struct bgp_path_info *info, ifindex_t *ifindex) { struct in6_addr *nexthop = NULL; @@ -968,7 +968,7 @@ 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 *info) { route_map_result_t ret; @@ -1121,13 +1121,11 @@ 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 *ri, + struct bgp_path_info *best_ri, bool is_evpn, + struct zapi_nexthop *api_nh) { struct attr *attr; @@ -1183,7 +1181,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 +1191,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 +1240,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; @@ -1466,7 +1465,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 *ri; /* Don't try to install if we're not connected to Zebra or Zebra doesn't * know of this instance. @@ -1490,7 +1489,7 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi) 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 +1679,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 *ri; if (red->redist_metric_flag && red->redist_metric == metric) return 0; @@ -2081,20 +2080,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 *bgp_info; + 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_info to bpme */ + bgp_info = (struct bgp_path_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); } break; case ZAPI_IPSET_ENTRY_FAIL_REMOVE: diff --git a/bgpd/bgp_zebra.h b/bgpd/bgp_zebra.h index 0223c423df..1118eaab24 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); diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 0845f2d825..4d2efaafd7 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 *bi; char buf[PREFIX_STRLEN]; char buf2[RD_ADDRSTRLEN]; struct prefix_rd prd0; @@ -575,8 +575,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 *bi; struct bgp_node *bn; struct attr attr = {0}; @@ -3690,7 +3690,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 *bi; if (!bgp) return; diff --git a/bgpd/rfapi/rfapi_backend.h b/bgpd/rfapi/rfapi_backend.h index bcd894b884..0e4fc8208b 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 *bi, 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 da617f53a6..c0297d7437 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,8 +150,8 @@ 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 *bi; + struct bgp_path_info *next; for (bi = rn->info; bi; bi = next) { next = bi->next; @@ -218,7 +218,7 @@ void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, int lockoffset) { unsigned int count_bi = 0; unsigned int count_monitor = 0; - struct bgp_info *bi; + struct bgp_path_info *bi; struct rfapi_monitor_encap *hme; struct rfapi_monitor_vpn *hmv; @@ -457,7 +457,7 @@ 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 *bi, struct prefix *p) { /* If it's in this route's VNC attribute, we're done */ if (!rfapiGetVncTunnelUnAddr(bi->attr, p)) @@ -501,12 +501,13 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_info *bi, struct prefix *p) /* * Make a new bgp_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(); assert(new); @@ -534,7 +535,7 @@ static struct bgp_info *rfapiBgpInfoCreate(struct attr *attr, struct peer *peer, * Frees bgp_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 *bi; struct agg_node *par; struct rfapi_monitor_vpn *m; struct rfapi_monitor_vpn *mlast; @@ -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 *bi; struct agg_node *par; RFAPI_CHECK_REFCOUNT(new_vpn_node, SAFI_MPLS_VPN, 0); @@ -881,9 +882,9 @@ static void rfapiMonitorMoveLonger(struct agg_node *new_vpn_node) } -static void rfapiBgpInfoChainFree(struct bgp_info *bi) +static void rfapiBgpInfoChainFree(struct bgp_path_info *bi) { - struct bgp_info *next; + struct bgp_path_info *next; while (bi) { @@ -1100,7 +1101,8 @@ 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 *bi, + struct rfapi_ip_addr *hpt) { uint8_t family; @@ -1136,7 +1138,8 @@ 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 *bi1, + struct bgp_path_info *bi2) { struct prefix pfx_un1; struct prefix pfx_un2; @@ -1295,9 +1298,9 @@ 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 *bi, /* 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; @@ -1485,7 +1488,7 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix, int rfapiHasNonRemovedRoutes(struct agg_node *rn) { - struct bgp_info *bi; + struct bgp_path_info *bi; for (bi = rn->info; bi; bi = bi->next) { struct prefix pfx; @@ -1505,7 +1508,7 @@ int rfapiHasNonRemovedRoutes(struct agg_node *rn) */ void rfapiDumpNode(struct agg_node *rn) { - struct bgp_info *bi; + struct bgp_path_info *bi; vnc_zlog_debug_verbose("%s: rn=%p", __func__, rn); for (bi = rn->info; bi; bi = bi->next) { @@ -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 *bi; struct rfapi_next_hop_entry *new; struct prefix pfx_un; struct skiplist *seen_nexthops; @@ -1995,12 +1998,12 @@ struct rfapi_next_hop_entry *rfapiEthRouteTable2NextHopList( * keeping the list of BIs 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]; @@ -2037,7 +2040,7 @@ 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 *bi) { /* * Remove the route (doubly-linked) @@ -2056,8 +2059,8 @@ 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 *bi1 = b1; + struct bgp_path_info *bi2 = b2; /* * Compare peers @@ -2081,8 +2084,8 @@ static int rfapi_bi_peer_rd_cmp(void *b1, void *b2) */ 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 *bi1 = b1; + struct bgp_path_info *bi2 = b2; int rc; /* @@ -2134,7 +2137,7 @@ 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 *bi) /* new BI */ { struct skiplist *sl; @@ -2171,8 +2174,8 @@ 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); @@ -2197,16 +2200,16 @@ static void rfapiItBiIndexDump(struct agg_node *rn) } } -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 bi_fake; + struct bgp_path_info_extra bi_extra; + struct bgp_path_info *bi_result; sl = RFAPI_RDINDEX(rn); if (!sl) @@ -2305,7 +2308,7 @@ static struct bgp_info *rfapiItBiIndexSearch( } static void rfapiItBiIndexDel(struct agg_node *rn, /* Import table VPN node */ - struct bgp_info *bi) /* old BI */ + struct bgp_path_info *bi) /* old BI */ { struct skiplist *sl; int rc; @@ -2337,10 +2340,11 @@ static void rfapiItBiIndexDel(struct agg_node *rn, /* Import table VPN node */ * 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_bi) /* VPN bi/route */ { afi_t afi = family2afi(p->family); struct agg_node *rn; @@ -2375,7 +2379,7 @@ static void rfapiMonitorEncapAdd(struct rfapi_import_table *import_table, bgp_attr_intern(vpn_bi->attr); } -static void rfapiMonitorEncapDelete(struct bgp_info *vpn_bi) +static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bi) { /* * Remove encap monitor @@ -2418,7 +2422,7 @@ 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 *bi = wcb->info; struct bgp *bgp = bgp_get_default(); struct rfapi_monitor_vpn *moved; @@ -2466,7 +2470,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 *bii; /* * First check if there are any OTHER routes at this node @@ -2614,8 +2618,8 @@ 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_bi, + struct bgp_path_info *vpn_bi) { if (!encap_bi->attr) { zlog_warn("%s: no encap bi attr/extra, can't copy UN address", @@ -2664,8 +2668,8 @@ 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) + struct rfapi_import_table *import_table, struct bgp_path_info *encap_bi, + struct agg_node *vpn_rn, struct bgp_path_info *vpn_bi) { if (!encap_bi) { @@ -2720,7 +2724,7 @@ 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 *bi = wcb->info; int was_first_route = 0; struct rfapi_monitor_encap *em; struct skiplist *vpn_node_sl = skiplist_new(0, NULL, NULL); @@ -2801,8 +2805,8 @@ 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 *bi, + afi_t afi, safi_t safi, int (*timer_service_func)(struct thread *)) { uint32_t lifetime; @@ -2876,7 +2880,7 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table, } /* re-sort route list (BGP_PATH_REMOVED routes are last) */ - if (((struct bgp_info *)rn->info)->next) { + if (((struct bgp_path_info *)rn->info)->next) { rfapiBgpInfoDetach(rn, bi); rfapiBgpInfoAttachSorted(rn, bi, afi, safi); } @@ -2891,7 +2895,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 *bi) { struct rfapi_withdraw *wcb; struct thread t; @@ -2946,9 +2950,9 @@ static void rfapiBgpInfoFilteredImportEncap( { 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 *bi; + struct bgp_path_info *next; char buf[BUFSIZ]; struct prefix p_firstbi_old; @@ -3060,7 +3064,7 @@ static void rfapiBgpInfoFilteredImportEncap( */ if (rn->info) { rfapiNexthop2Prefix( - ((struct bgp_info *)(rn->info))->attr, + ((struct bgp_path_info *)(rn->info))->attr, &p_firstbi_old); } @@ -3245,7 +3249,7 @@ static void rfapiBgpInfoFilteredImportEncap( rfapiExpireEncapNow(import_table, rn, bi); } - rfapiNexthop2Prefix(((struct bgp_info *)(rn->info))->attr, + rfapiNexthop2Prefix(((struct bgp_path_info *)(rn->info))->attr, &p_firstbi_new); /* @@ -3370,7 +3374,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 *bi, int lockoffset) { struct rfapi_withdraw *wcb; @@ -3408,9 +3412,9 @@ void rfapiBgpInfoFilteredImportVPN( 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 *bi; + struct bgp_path_info *next; char buf[BUFSIZ]; struct prefix vn_prefix; struct prefix un_prefix; @@ -4115,7 +4119,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 *bi; struct agg_table *rt; int (*timer_service_func)(struct thread *); @@ -4239,7 +4243,7 @@ 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 *bi; for (bi = rn2->info; bi; bi = bi->next) { uint32_t label = 0; @@ -4473,8 +4477,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 *bi; + struct bgp_path_info *next; if (VNC_DEBUG(IMPORT_DEL_REMOTE)) { char p1line[PREFIX_STRLEN]; diff --git a/bgpd/rfapi/rfapi_import.h b/bgpd/rfapi/rfapi_import.h index ae3d248367..94b05ed14a 100644 --- a/bgpd/rfapi/rfapi_import.h +++ b/bgpd/rfapi/rfapi_import.h @@ -77,7 +77,7 @@ extern void rfapiCheckRouteCount(void); /* * Print BI in an Import Table */ -extern void rfapiPrintBi(void *stream, struct bgp_info *bi); +extern void rfapiPrintBi(void *stream, struct bgp_path_info *bi); extern void rfapiShowImportTable(void *stream, const char *label, struct agg_table *rt, int isvpn); @@ -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 *bi, 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..846a63f4fa 100644 --- a/bgpd/rfapi/rfapi_monitor.c +++ b/bgpd/rfapi/rfapi_monitor.c @@ -346,7 +346,7 @@ 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 *bi; struct prefix pfx_dummy; /* TBD update this code to use new valid_interior_count */ diff --git a/bgpd/rfapi/rfapi_monitor.h b/bgpd/rfapi/rfapi_monitor.h index 9b85f6248e..117bed347b 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 *bi; /* VPN bi */ struct agg_node *rn; /* parent node */ }; 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..b0f71fde5c 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -616,9 +616,9 @@ 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 *bi, struct rfapi_info *ri, uint32_t lifetime) { struct bgp_attr_encap_subtlv *pEncap; @@ -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 *bi) { struct rfapi_descriptor *rfd; struct skiplist *slRibPt = 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 *bi; struct agg_node *pn; afi_t afi; uint32_t queued_flag; diff --git a/bgpd/rfapi/rfapi_rib.h b/bgpd/rfapi/rfapi_rib.h index a8872295cd..3ee9d447e6 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 *bi); 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 cae004c2e1..62ca4cd29b 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 *bi, safi_t safi) { char *s; uint32_t lifetime; @@ -479,7 +479,7 @@ void rfapiPrintAttrPtrs(void *stream, struct attr *attr) /* * Print BI in an Import Table */ -void rfapiPrintBi(void *stream, struct bgp_info *bi) +void rfapiPrintBi(void *stream, struct bgp_path_info *bi) { char buf[BUFSIZ]; char *s; @@ -740,7 +740,7 @@ static void rfapiDebugPrintMonitorEncap(void *stream, void rfapiShowItNode(void *stream, struct agg_node *rn) { - struct bgp_info *bi; + struct bgp_path_info *bi; char buf[BUFSIZ]; int (*fp)(void *, const char *, ...); @@ -779,7 +779,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 *bi; if (rn->p.family == AF_ETHERNET) { rfapiEthAddr2Str(&rn->p.u.prefix_eth, buf, BUFSIZ); @@ -1008,7 +1008,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 *bi) { int (*fp)(void *, const char *, ...); struct vty *vty; @@ -1126,7 +1126,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream, #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. @@ -1222,7 +1222,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 *bi; int count_only; /* allow for wider or more narrow mask from user */ @@ -1535,7 +1535,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 *bi; uint8_t type = ZEBRA_ROUTE_BGP; struct bgp *bgp; int printed = 0; diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index af1e25a180..0c46419f3f 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 *bi) { struct attr *attr = bi->attr; struct peer *peer = bi->peer; struct prefix *prefix = &rn->p; afi_t afi = family2afi(prefix->family); struct bgp_node *urn; - struct bgp_info *ubi; + struct bgp_path_info *ubi; struct attr hattr; struct attr *iattr; struct prefix ce_nexthop; @@ -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 *bi) { afi_t afi = family2afi(rn->p.family); - struct bgp_info *vbi; + struct bgp_path_info *vbi; struct prefix ce_nexthop; if (!afi) { @@ -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,7 +516,7 @@ 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 *bi; if (!rn->info) return NULL; @@ -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; @@ -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)); @@ -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..3d66f93c9b 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 *bi); extern void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn, - struct bgp_info *bi); + struct bgp_path_info *bi); 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 fed876ad8a..b96c669f0d 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 *ubi; /* unicast route */ }; static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, @@ -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 *bi, /* VPN bi */ + 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 */ @@ -521,7 +521,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd( struct prefix *ubi_nexthop) /* unicast nexthop */ { struct bgp_node *bn; - struct bgp_info *bi; + struct bgp_path_info *bi; if (!table_rd) return; @@ -542,7 +542,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd( return; } - /* Iterate over bgp_info items at this node */ + /* Iterate over bgp_path_info items at this node */ for (bi = bn->info; bi; bi = bi->next) { vnc_import_bgp_add_route_mode_resolve_nve_one_bi( @@ -555,7 +555,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); @@ -693,7 +693,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 +808,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 +881,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,7 +1010,7 @@ 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 binfo; route_map_result_t ret; memset(&binfo, 0, sizeof(binfo)); @@ -1085,7 +1085,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 +1158,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,8 +1238,8 @@ 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 *bi, /* VPN bi */ + struct prefix_rd *prd, /* RD */ struct prefix *prefix) /* unicast route prefix */ { struct prefix un; @@ -1278,7 +1278,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd( struct prefix *ubi_nexthop) /* unicast bi's nexthop */ { struct bgp_node *bn; - struct bgp_info *bi; + struct bgp_path_info *bi; if (!table_rd) return; @@ -1299,7 +1299,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd( return; } - /* Iterate over bgp_info items at this node */ + /* Iterate over bgp_path_info items at this node */ for (bi = bn->info; bi; bi = bi->next) { vnc_import_bgp_del_route_mode_resolve_nve_one_bi( @@ -1311,10 +1311,10 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd( 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 */ @@ -1398,7 +1398,7 @@ 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 *bi) /* new VPN host route */ { afi_t afi = family2afi(prefix->family); struct skiplist *sl = NULL; @@ -1538,7 +1538,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 *bi) /* old VPN host route */ { afi_t afi = family2afi(prefix->family); struct skiplist *sl = NULL; @@ -1648,7 +1648,7 @@ 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 *bi_interior) { if (!VALID_INTERIOR_TYPE(bi_interior->type)) { #if DEBUG_IS_USABLE_INTERIOR @@ -1680,7 +1680,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 +1740,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 *bi_interior; int have_usable_route; vnc_zlog_debug_verbose("%s: doing it %p", __func__, it); @@ -1854,9 +1854,9 @@ static void vnc_import_bgp_exterior_add_route_it( } 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 +1872,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 +1931,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 *bi_interior; int have_usable_route; table = it->imported_vpn[afi]; @@ -2038,12 +2038,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 *bi_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 *bi_exterior; struct prefix *pfx_exterior; /* exterior pfx */ void *cursor; int rc; @@ -2194,7 +2194,7 @@ void vnc_import_bgp_exterior_add_route_interior( if (prefix_match(&rn_interior->p, &pfx_nexthop)) { - struct bgp_info *bi; + struct bgp_path_info *bi; struct prefix_rd *prd; struct attr new_attr; uint32_t label = 0; @@ -2420,12 +2420,12 @@ 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 *bi_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 *bi_exterior; struct prefix *pfx_exterior; /* exterior pfx */ void *cursor; int rc; @@ -2532,7 +2532,7 @@ void vnc_import_bgp_exterior_del_route_interior( if (par) { - struct bgp_info *bi; + struct bgp_path_info *bi; /* * Add monitor to parent node @@ -2612,7 +2612,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 +2681,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,7 +2768,7 @@ 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 *bi; for (bi = rn->info; bi; bi = bi->next) { @@ -2808,7 +2808,7 @@ 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 *bi; for (bi = rn->info; bi; bi = bi->next) { @@ -2853,7 +2853,7 @@ 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 *bi; for (bi = rn->info; bi; bi = bi->next) { @@ -2896,8 +2896,8 @@ 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 *bi; + struct bgp_path_info *nextbi; for (bi = rn2->info; bi; bi = nextbi) { @@ -2944,7 +2944,7 @@ 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; @@ -2985,7 +2985,7 @@ 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 *bi; for (bi = rn->info; bi; bi = bi->next) { diff --git a/bgpd/rfapi/vnc_import_bgp.h b/bgpd/rfapi/vnc_import_bgp.h index 7c15939904..294740c864 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 *bi); /* 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 *bi); /* 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..1d2b51713b 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 *bi_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 *bi_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/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/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c index bc6c06aa90..193cbc2b7d 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,13 +317,13 @@ 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_PATH_MULTIPATH), test_result); - mpath = bgp_info_mpath_next(mpath); + mpath = bgp_path_info_mpath_next(mpath); EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result); EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_PATH_MULTIPATH), test_result); @@ -331,10 +331,10 @@ 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[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_PATH_MULTIPATH), test_result); EXPECT_TRUE(!CHECK_FLAG(test_mp_list_info[0].flags, BGP_PATH_MULTIPATH), @@ -343,7 +343,7 @@ static int run_bgp_info_mpath_update(testcase_t *t) 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 +353,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 +365,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") -- 2.39.5