Merge pull request #6068 from donaldsharp/agg_to_use_rn_lookup

Agg to use rn lookup
This commit is contained in:
Russ White 2020-03-24 10:49:36 -04:00 committed by GitHub
commit 3dc9c1e49f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 437 additions and 466 deletions

View File

@ -2528,12 +2528,12 @@ bool bgp_debug_update(struct peer *peer, const struct prefix *p,
return false; return false;
} }
bool bgp_debug_bestpath(struct prefix *p) bool bgp_debug_bestpath(struct bgp_node *rn)
{ {
if (BGP_DEBUG(bestpath, BESTPATH)) { if (BGP_DEBUG(bestpath, BESTPATH)) {
if (bgp_debug_per_prefix(p, term_bgp_debug_bestpath, if (bgp_debug_per_prefix(
BGP_DEBUG_BESTPATH, &rn->p, term_bgp_debug_bestpath,
bgp_debug_bestpath_prefixes)) BGP_DEBUG_BESTPATH, bgp_debug_bestpath_prefixes))
return true; return true;
} }

View File

@ -168,7 +168,7 @@ extern int bgp_debug_neighbor_events(struct peer *peer);
extern int bgp_debug_keepalive(struct peer *peer); extern int bgp_debug_keepalive(struct peer *peer);
extern bool bgp_debug_update(struct peer *peer, const struct prefix *p, extern bool bgp_debug_update(struct peer *peer, const struct prefix *p,
struct update_group *updgrp, unsigned int inbound); struct update_group *updgrp, unsigned int inbound);
extern bool bgp_debug_bestpath(struct prefix *p); extern bool bgp_debug_bestpath(struct bgp_node *rn);
extern bool bgp_debug_zebra(const struct prefix *p); extern bool bgp_debug_zebra(const struct prefix *p);
extern const char *bgp_debug_rdpfxpath2str(afi_t, safi_t, struct prefix_rd *, extern const char *bgp_debug_rdpfxpath2str(afi_t, safi_t, struct prefix_rd *,

View File

@ -3524,7 +3524,7 @@ static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi,
* Install or uninstall route for appropriate VNIs/ESIs. * Install or uninstall route for appropriate VNIs/ESIs.
*/ */
static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
struct prefix *p, const struct prefix *p,
struct bgp_path_info *pi, int import) struct bgp_path_info *pi, int import)
{ {
struct prefix_evpn *evp = (struct prefix_evpn *)p; struct prefix_evpn *evp = (struct prefix_evpn *)p;
@ -5550,7 +5550,7 @@ void bgp_evpn_es_free(struct bgp *bgp, struct evpnes *es)
* Import evpn route from global table to VNI/VRF/ESI. * Import evpn route from global table to VNI/VRF/ESI.
*/ */
int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi, int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
struct prefix *p, struct bgp_path_info *pi) const struct prefix *p, struct bgp_path_info *pi)
{ {
return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 1); return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 1);
} }
@ -5559,7 +5559,7 @@ int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
* Unimport evpn route from VNI/VRF/ESI. * Unimport evpn route from VNI/VRF/ESI.
*/ */
int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi, int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi,
struct prefix *p, struct bgp_path_info *pi) const struct prefix *p, struct bgp_path_info *pi)
{ {
return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 0); return install_uninstall_evpn_route(bgp, afi, safi, p, pi, 0);
} }
@ -6280,7 +6280,7 @@ int bgp_evpn_get_type5_prefixlen(struct prefix *pfx)
/* /*
* Should we register nexthop for this EVPN prefix for nexthop tracking? * Should we register nexthop for this EVPN prefix for nexthop tracking?
*/ */
bool bgp_evpn_is_prefix_nht_supported(struct prefix *pfx) bool bgp_evpn_is_prefix_nht_supported(const struct prefix *pfx)
{ {
struct prefix_evpn *evp = (struct prefix_evpn *)pfx; struct prefix_evpn *evp = (struct prefix_evpn *)pfx;

View File

@ -164,9 +164,11 @@ extern void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
extern int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr, extern int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet, int withdraw); struct bgp_nlri *packet, int withdraw);
extern int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi, extern int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
struct prefix *p, struct bgp_path_info *ri); const struct prefix *p,
struct bgp_path_info *ri);
extern int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi, extern int bgp_evpn_unimport_route(struct bgp *bgp, afi_t afi, safi_t safi,
struct prefix *p, struct bgp_path_info *ri); const struct prefix *p,
struct bgp_path_info *ri);
extern int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp); 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, extern int bgp_evpn_local_macip_del(struct bgp *bgp, vni_t vni,
struct ethaddr *mac, struct ipaddr *ip, struct ethaddr *mac, struct ipaddr *ip,
@ -194,7 +196,7 @@ extern void bgp_evpn_cleanup_on_disable(struct bgp *bgp);
extern void bgp_evpn_cleanup(struct bgp *bgp); extern void bgp_evpn_cleanup(struct bgp *bgp);
extern void bgp_evpn_init(struct bgp *bgp); extern void bgp_evpn_init(struct bgp *bgp);
extern int bgp_evpn_get_type5_prefixlen(struct prefix *pfx); extern int bgp_evpn_get_type5_prefixlen(struct prefix *pfx);
extern bool bgp_evpn_is_prefix_nht_supported(struct prefix *pfx); extern bool bgp_evpn_is_prefix_nht_supported(const struct prefix *pfx);
extern void update_advertise_vrf_routes(struct bgp *bgp_vrf); extern void update_advertise_vrf_routes(struct bgp *bgp_vrf);
#endif /* _QUAGGA_BGP_EVPN_H */ #endif /* _QUAGGA_BGP_EVPN_H */

View File

@ -358,7 +358,7 @@ void bgp_mac_del_mac_entry(struct interface *ifp)
* An example: router-mac attribute in any of evpn update * An example: router-mac attribute in any of evpn update
* requires to compare against local mac. * requires to compare against local mac.
*/ */
bool bgp_mac_exist(struct ethaddr *mac) bool bgp_mac_exist(const struct ethaddr *mac)
{ {
struct bgp_self_mac lookup; struct bgp_self_mac lookup;
struct bgp_self_mac *bsm; struct bgp_self_mac *bsm;
@ -379,9 +379,9 @@ bool bgp_mac_exist(struct ethaddr *mac)
* mac against any of local assigned (SVIs) MAC * mac against any of local assigned (SVIs) MAC
* address. * address.
*/ */
bool bgp_mac_entry_exists(struct prefix *p) bool bgp_mac_entry_exists(const struct prefix *p)
{ {
struct prefix_evpn *pevpn = (struct prefix_evpn *)p; const struct prefix_evpn *pevpn = (const struct prefix_evpn *)p;
if (pevpn->family != AF_EVPN) if (pevpn->family != AF_EVPN)
return false; return false;

View File

@ -36,7 +36,7 @@ void bgp_mac_dump_table(struct vty *vty);
/* /*
* Function to lookup the prefix and see if we have a matching mac * Function to lookup the prefix and see if we have a matching mac
*/ */
bool bgp_mac_entry_exists(struct prefix *p); bool bgp_mac_entry_exists(const struct prefix *p);
bool bgp_mac_exist(struct ethaddr *mac); bool bgp_mac_exist(const struct ethaddr *mac);
#endif #endif

View File

@ -457,7 +457,7 @@ void bgp_path_info_mpath_update(struct bgp_node *rn,
old_mpath_count = 0; old_mpath_count = 0;
prev_mpath = new_best; prev_mpath = new_best;
mp_node = listhead(mp_list); mp_node = listhead(mp_list);
debug = bgp_debug_bestpath(&rn->p); debug = bgp_debug_bestpath(rn);
if (debug) if (debug)
prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf)); prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf));

View File

@ -685,9 +685,9 @@ static int bgp_pbr_validate_policy_route(struct bgp_pbr_entry_main *api)
} }
/* return -1 if build or validation failed */ /* return -1 if build or validation failed */
int bgp_pbr_build_and_validate_entry(struct prefix *p, int bgp_pbr_build_and_validate_entry(const struct prefix *p,
struct bgp_path_info *path, struct bgp_path_info *path,
struct bgp_pbr_entry_main *api) struct bgp_pbr_entry_main *api)
{ {
int ret; int ret;
int i, action_count = 0; int i, action_count = 0;
@ -2610,7 +2610,7 @@ static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *path,
} }
} }
void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p, void bgp_pbr_update_entry(struct bgp *bgp, const struct prefix *p,
struct bgp_path_info *info, afi_t afi, safi_t safi, struct bgp_path_info *info, afi_t afi, safi_t safi,
bool nlri_update) bool nlri_update)
{ {

View File

@ -291,7 +291,7 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api);
struct bgp_node; struct bgp_node;
struct bgp_path_info; struct bgp_path_info;
extern void bgp_pbr_update_entry(struct bgp *bgp, struct prefix *p, extern void bgp_pbr_update_entry(struct bgp *bgp, const struct prefix *p,
struct bgp_path_info *new_select, afi_t afi, struct bgp_path_info *new_select, afi_t afi,
safi_t safi, bool nlri_update); safi_t safi, bool nlri_update);
@ -301,7 +301,7 @@ extern void bgp_pbr_reset(struct bgp *bgp, afi_t afi);
extern struct bgp_pbr_interface *bgp_pbr_interface_lookup(const char *name, extern struct bgp_pbr_interface *bgp_pbr_interface_lookup(const char *name,
struct bgp_pbr_interface_head *head); struct bgp_pbr_interface_head *head);
extern int bgp_pbr_build_and_validate_entry(struct prefix *p, extern int bgp_pbr_build_and_validate_entry(const struct prefix *p,
struct bgp_path_info *path, struct bgp_path_info *path,
struct bgp_pbr_entry_main *api); struct bgp_pbr_entry_main *api);
#endif /* __BGP_PBR_H__ */ #endif /* __BGP_PBR_H__ */

View File

@ -76,7 +76,7 @@ void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as)
} }
/* type == RD_TYPE_IP */ /* type == RD_TYPE_IP */
void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip) void decode_rd_ip(const uint8_t *pnt, struct rd_ip *rd_ip)
{ {
memcpy(&rd_ip->ip, pnt, 4); memcpy(&rd_ip->ip, pnt, 4);
pnt += 4; pnt += 4;

View File

@ -59,7 +59,7 @@ extern void encode_rd_type(uint16_t, uint8_t *);
extern void decode_rd_as(const uint8_t *pnt, struct rd_as *rd_as); extern void decode_rd_as(const uint8_t *pnt, struct rd_as *rd_as);
extern void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as); extern void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as);
extern void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip); extern void decode_rd_ip(const uint8_t *pnt, struct rd_ip *rd_ip);
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
extern void decode_rd_vnc_eth(uint8_t *pnt, struct rd_vnc_eth *rd_vnc_eth); extern void decode_rd_vnc_eth(uint8_t *pnt, struct rd_vnc_eth *rd_vnc_eth);
#endif #endif

View File

@ -116,7 +116,7 @@ DEFINE_HOOK(bgp_process,
struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi, struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
safi_t safi, struct prefix *p, safi_t safi, const struct prefix *p,
struct prefix_rd *prd) struct prefix_rd *prd)
{ {
struct bgp_node *rn; struct bgp_node *rn;
@ -1202,7 +1202,8 @@ int bgp_path_info_cmp_compatible(struct bgp *bgp, struct bgp_path_info *new,
return ret; return ret;
} }
static enum filter_type bgp_input_filter(struct peer *peer, struct prefix *p, static enum filter_type bgp_input_filter(struct peer *peer,
const struct prefix *p,
struct attr *attr, afi_t afi, struct attr *attr, afi_t afi,
safi_t safi) safi_t safi)
{ {
@ -1322,7 +1323,7 @@ static bool bgp_cluster_filter(struct peer *peer, struct attr *attr)
return false; return false;
} }
static int bgp_input_modifier(struct peer *peer, struct prefix *p, static int bgp_input_modifier(struct peer *peer, const struct prefix *p,
struct attr *attr, afi_t afi, safi_t safi, struct attr *attr, afi_t afi, safi_t safi,
const char *rmap_name, mpls_label_t *label, const char *rmap_name, mpls_label_t *label,
uint32_t num_labels, struct bgp_node *rn) uint32_t num_labels, struct bgp_node *rn)
@ -2096,7 +2097,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
do_mpath = do_mpath =
(mpath_cfg->maxpaths_ebgp > 1 || mpath_cfg->maxpaths_ibgp > 1); (mpath_cfg->maxpaths_ebgp > 1 || mpath_cfg->maxpaths_ibgp > 1);
debug = bgp_debug_bestpath(&rn->p); debug = bgp_debug_bestpath(rn);
if (debug) if (debug)
prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf)); prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf));
@ -2450,7 +2451,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) {
if (rn) if (rn)
debug = bgp_debug_bestpath(&rn->p); debug = bgp_debug_bestpath(rn);
if (debug) { if (debug) {
prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf)); prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf));
zlog_debug( zlog_debug(
@ -2477,7 +2478,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
struct prefix *p = &rn->p; struct prefix *p = &rn->p;
debug = bgp_debug_bestpath(&rn->p); debug = bgp_debug_bestpath(rn);
if (debug) { if (debug) {
prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf)); prefix2str(&rn->p, pfx_buf, sizeof(pfx_buf));
zlog_debug("%s: p=%s afi=%s, safi=%s start", __func__, pfx_buf, zlog_debug("%s: p=%s afi=%s, safi=%s start", __func__, pfx_buf,
@ -3258,7 +3259,7 @@ static bool bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi,
return ret; return ret;
} }
int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
struct attr *attr, afi_t afi, safi_t safi, int type, struct attr *attr, afi_t afi, safi_t safi, int type,
int sub_type, struct prefix_rd *prd, mpls_label_t *label, int sub_type, struct prefix_rd *prd, mpls_label_t *label,
uint32_t num_labels, int soft_reconfig, uint32_t num_labels, int soft_reconfig,
@ -4027,7 +4028,7 @@ filtered:
return 0; return 0;
} }
int bgp_withdraw(struct peer *peer, struct prefix *p, uint32_t addpath_id, int bgp_withdraw(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
struct attr *attr, afi_t afi, safi_t safi, int type, struct attr *attr, afi_t afi, safi_t safi, int type,
int sub_type, struct prefix_rd *prd, mpls_label_t *label, int sub_type, struct prefix_rd *prd, mpls_label_t *label,
uint32_t num_labels, struct bgp_route_evpn *evpn) uint32_t num_labels, struct bgp_route_evpn *evpn)
@ -6614,7 +6615,7 @@ static void bgp_remove_route_from_aggregate(struct bgp *bgp, afi_t afi,
lcommunity, atomic_aggregate, aggregate); lcommunity, atomic_aggregate, aggregate);
} }
void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p, void bgp_aggregate_increment(struct bgp *bgp, const struct prefix *p,
struct bgp_path_info *pi, afi_t afi, safi_t safi) struct bgp_path_info *pi, afi_t afi, safi_t safi)
{ {
struct bgp_node *child; struct bgp_node *child;
@ -6647,7 +6648,7 @@ void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p,
bgp_unlock_node(child); bgp_unlock_node(child);
} }
void bgp_aggregate_decrement(struct bgp *bgp, struct prefix *p, void bgp_aggregate_decrement(struct bgp *bgp, const struct prefix *p,
struct bgp_path_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 *child;

View File

@ -510,7 +510,7 @@ extern bool bgp_outbound_policy_exists(struct peer *, struct bgp_filter *);
extern bool bgp_inbound_policy_exists(struct peer *, struct bgp_filter *); extern bool bgp_inbound_policy_exists(struct peer *, struct bgp_filter *);
extern struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi, extern struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
safi_t safi, struct prefix *p, safi_t safi, const struct prefix *p,
struct prefix_rd *prd); struct prefix_rd *prd);
extern struct bgp_path_info *bgp_path_info_lock(struct bgp_path_info *path); extern struct bgp_path_info *bgp_path_info_lock(struct bgp_path_info *path);
extern struct bgp_path_info *bgp_path_info_unlock(struct bgp_path_info *path); extern struct bgp_path_info *bgp_path_info_unlock(struct bgp_path_info *path);
@ -558,12 +558,17 @@ extern int bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *,
const char *, const char *, const char *); const char *, const char *, const char *);
/* this is primarily for MPLS-VPN */ /* this is primarily for MPLS-VPN */
extern int bgp_update(struct peer *, struct prefix *, uint32_t, struct attr *, extern int bgp_update(struct peer *peer, const struct prefix *p,
afi_t, safi_t, int, int, struct prefix_rd *, uint32_t addpath_id, struct attr *attr,
mpls_label_t *, uint32_t, int, struct bgp_route_evpn *); afi_t afi, safi_t safi, int type, int sub_type,
extern int bgp_withdraw(struct peer *, struct prefix *, uint32_t, struct attr *, struct prefix_rd *prd, mpls_label_t *label,
afi_t, safi_t, int, int, struct prefix_rd *, uint32_t num_labels, int soft_reconfig,
mpls_label_t *, uint32_t, struct bgp_route_evpn *); struct bgp_route_evpn *evpn);
extern int bgp_withdraw(struct peer *peer, const struct prefix *p,
uint32_t addpath_id, struct attr *attr, afi_t afi,
safi_t safi, int type, int sub_type,
struct prefix_rd *prd, mpls_label_t *label,
uint32_t num_labels, struct bgp_route_evpn *evpn);
/* for bgp_nexthop and bgp_damp */ /* for bgp_nexthop and bgp_damp */
extern void bgp_process(struct bgp *, struct bgp_node *, afi_t, safi_t); extern void bgp_process(struct bgp *, struct bgp_node *, afi_t, safi_t);
@ -583,10 +588,10 @@ extern void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
safi_t safi, struct bgp_aggregate *aggregate); safi_t safi, struct bgp_aggregate *aggregate);
extern void bgp_aggregate_route(struct bgp *bgp, struct prefix *p, afi_t afi, extern void bgp_aggregate_route(struct bgp *bgp, struct prefix *p, afi_t afi,
safi_t safi, struct bgp_aggregate *aggregate); safi_t safi, struct bgp_aggregate *aggregate);
extern void bgp_aggregate_increment(struct bgp *bgp, struct prefix *p, extern void bgp_aggregate_increment(struct bgp *bgp, const struct prefix *p,
struct bgp_path_info *path, afi_t afi, struct bgp_path_info *path, afi_t afi,
safi_t safi); safi_t safi);
extern void bgp_aggregate_decrement(struct bgp *bgp, struct prefix *p, extern void bgp_aggregate_decrement(struct bgp *bgp, const struct prefix *p,
struct bgp_path_info *path, afi_t afi, struct bgp_path_info *path, afi_t afi,
safi_t safi); safi_t safi);

View File

@ -1484,7 +1484,7 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi)
safi); safi);
} }
void bgp_zebra_withdraw(struct prefix *p, struct bgp_path_info *info, void bgp_zebra_withdraw(const struct prefix *p, struct bgp_path_info *info,
struct bgp *bgp, safi_t safi) struct bgp *bgp, safi_t safi)
{ {
struct zapi_route api; struct zapi_route api;

View File

@ -36,8 +36,9 @@ extern void bgp_zebra_announce(struct bgp_node *rn, const struct prefix *p,
struct bgp_path_info *path, struct bgp *bgp, struct bgp_path_info *path, struct bgp *bgp,
afi_t afi, safi_t safi); afi_t afi, safi_t safi);
extern void bgp_zebra_announce_table(struct bgp *, afi_t, safi_t); extern void bgp_zebra_announce_table(struct bgp *, afi_t, safi_t);
extern void bgp_zebra_withdraw(struct prefix *p, struct bgp_path_info *path, extern void bgp_zebra_withdraw(const struct prefix *p,
struct bgp *bgp, safi_t safi); 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_initiate_radv(struct bgp *bgp, struct peer *peer);
extern void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer); extern void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer);

View File

@ -355,7 +355,7 @@ int rfapi_check(void *handle)
void del_vnc_route(struct rfapi_descriptor *rfd, void del_vnc_route(struct rfapi_descriptor *rfd,
struct peer *peer, /* rfd->peer for RFP regs */ struct peer *peer, /* rfd->peer for RFP regs */
struct bgp *bgp, safi_t safi, struct prefix *p, struct bgp *bgp, safi_t safi, const struct prefix *p,
struct prefix_rd *prd, uint8_t type, uint8_t sub_type, struct prefix_rd *prd, uint8_t type, uint8_t sub_type,
struct rfapi_nexthop *lnh, int kill) struct rfapi_nexthop *lnh, int kill)
{ {
@ -557,7 +557,7 @@ void rfapi_vn_options_free(struct rfapi_vn_option *p)
/* Based on bgp_redistribute_add() */ /* Based on bgp_redistribute_add() */
void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
struct bgp *bgp, int safi, struct prefix *p, struct bgp *bgp, int safi, const struct prefix *p,
struct prefix_rd *prd, struct rfapi_ip_addr *nexthop, struct prefix_rd *prd, struct rfapi_ip_addr *nexthop,
uint32_t *local_pref, uint32_t *local_pref,
uint32_t *lifetime, /* NULL => dont send lifetime */ uint32_t *lifetime, /* NULL => dont send lifetime */

View File

@ -81,10 +81,10 @@
* is used to spread out the sort for adbs with the same lifetime * is used to spread out the sort for adbs with the same lifetime
* and thereby make the skip list operations more efficient. * and thereby make the skip list operations more efficient.
*/ */
static int sl_adb_lifetime_cmp(void *adb1, void *adb2) static int sl_adb_lifetime_cmp(const void *adb1, const void *adb2)
{ {
struct rfapi_adb *a1 = adb1; const struct rfapi_adb *a1 = adb1;
struct rfapi_adb *a2 = adb2; const struct rfapi_adb *a2 = adb2;
if (a1->lifetime < a2->lifetime) if (a1->lifetime < a2->lifetime)
return -1; return -1;

View File

@ -35,16 +35,16 @@ extern void rfapi_delete(struct bgp *);
struct rfapi *bgp_rfapi_new(struct bgp *bgp); struct rfapi *bgp_rfapi_new(struct bgp *bgp);
void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h); void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h);
extern void rfapiProcessUpdate(struct peer *peer, void *rfd, struct prefix *p, extern void rfapiProcessUpdate(struct peer *peer, void *rfd,
struct prefix_rd *prd, struct attr *attr, const struct prefix *p, struct prefix_rd *prd,
afi_t afi, safi_t safi, uint8_t type, struct attr *attr, afi_t afi, safi_t safi,
uint8_t sub_type, uint32_t *label); uint8_t type, uint8_t sub_type, uint32_t *label);
extern void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p, extern void rfapiProcessWithdraw(struct peer *peer, void *rfd,
struct prefix_rd *prd, struct attr *attr, const struct prefix *p, struct prefix_rd *prd,
afi_t afi, safi_t safi, uint8_t type, struct attr *attr, afi_t afi, safi_t safi,
int kill); uint8_t type, int kill);
extern void rfapiProcessPeerDown(struct peer *peer); extern void rfapiProcessPeerDown(struct peer *peer);

View File

@ -663,14 +663,17 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
* If no less-specific routes, try to use the 0/0 node * If no less-specific routes, try to use the 0/0 node
*/ */
if (!par) { if (!par) {
const struct prefix *p;
/* this isn't necessarily 0/0 */ /* this isn't necessarily 0/0 */
par = agg_route_table_top(original_vpn_node); par = agg_route_table_top(original_vpn_node);
if (par)
p = agg_node_get_prefix(par);
/* /*
* If we got the top node but it wasn't 0/0, * If we got the top node but it wasn't 0/0,
* ignore it * ignore it
*/ */
if (par && par->p.prefixlen) { if (par && p->prefixlen) {
agg_unlock_node(par); /* maybe free */ agg_unlock_node(par); /* maybe free */
par = NULL; par = NULL;
} }
@ -685,9 +688,10 @@ rfapiMonitorMoveShorter(struct agg_node *original_vpn_node, int lockoffset)
*/ */
if (!par) { if (!par) {
struct prefix pfx_default; struct prefix pfx_default;
const struct prefix *p = agg_node_get_prefix(original_vpn_node);
memset(&pfx_default, 0, sizeof(pfx_default)); memset(&pfx_default, 0, sizeof(pfx_default));
pfx_default.family = original_vpn_node->p.family; pfx_default.family = p->family;
/* creates default node if none exists */ /* creates default node if none exists */
par = agg_node_get(agg_get_table(original_vpn_node), par = agg_node_get(agg_get_table(original_vpn_node),
@ -768,6 +772,7 @@ static void rfapiMonitorMoveLonger(struct agg_node *new_vpn_node)
struct rfapi_monitor_vpn *mlast; struct rfapi_monitor_vpn *mlast;
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
struct agg_node *par; struct agg_node *par;
const struct prefix *new_vpn_node_p = agg_node_get_prefix(new_vpn_node);
RFAPI_CHECK_REFCOUNT(new_vpn_node, SAFI_MPLS_VPN, 0); RFAPI_CHECK_REFCOUNT(new_vpn_node, SAFI_MPLS_VPN, 0);
@ -808,12 +813,11 @@ static void rfapiMonitorMoveLonger(struct agg_node *new_vpn_node)
* specific updated node * specific updated node
*/ */
for (mlast = NULL, monitor = RFAPI_MONITOR_VPN(par); monitor;) { for (mlast = NULL, monitor = RFAPI_MONITOR_VPN(par); monitor;) {
/* /*
* If new longest match for monitor prefix is the new * If new longest match for monitor prefix is the new
* route's prefix, move monitor to new route's prefix * route's prefix, move monitor to new route's prefix
*/ */
if (prefix_match(&new_vpn_node->p, &monitor->p)) { if (prefix_match(new_vpn_node_p, &monitor->p)) {
/* detach */ /* detach */
if (mlast) { if (mlast) {
mlast->next = monitor->next; mlast->next = monitor->next;
@ -1266,6 +1270,7 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
{ {
struct rfapi_next_hop_entry *new; struct rfapi_next_hop_entry *new;
int have_vnc_tunnel_un = 0; int have_vnc_tunnel_un = 0;
const struct prefix *p = agg_node_get_prefix(rn);
#ifdef DEBUG_ENCAP_MONITOR #ifdef DEBUG_ENCAP_MONITOR
vnc_zlog_debug_verbose("%s: entry, bpi %p, rn %p", __func__, bpi, rn); vnc_zlog_debug_verbose("%s: entry, bpi %p, rn %p", __func__, bpi, rn);
@ -1289,8 +1294,7 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
vo->type = RFAPI_VN_OPTION_TYPE_L2ADDR; vo->type = RFAPI_VN_OPTION_TYPE_L2ADDR;
memcpy(&vo->v.l2addr.macaddr, &rn->p.u.prefix_eth.octet, memcpy(&vo->v.l2addr.macaddr, &p->u.prefix_eth.octet, ETH_ALEN);
ETH_ALEN);
/* only low 3 bytes of this are significant */ /* only low 3 bytes of this are significant */
(void)rfapiEcommunityGetLNI(bpi->attr->ecommunity, (void)rfapiEcommunityGetLNI(bpi->attr->ecommunity,
&vo->v.l2addr.logical_net_id); &vo->v.l2addr.logical_net_id);
@ -1493,7 +1497,8 @@ static int rfapiNhlAddNodeRoutes(
struct prefix pfx_un; struct prefix pfx_un;
struct skiplist *seen_nexthops; struct skiplist *seen_nexthops;
int count = 0; int count = 0;
int is_l2 = (rn->p.family == AF_ETHERNET); const struct prefix *p = agg_node_get_prefix(rn);
int is_l2 = (p->family == AF_ETHERNET);
if (rfd_rib_node) { if (rfd_rib_node) {
struct agg_table *atable = agg_get_table(rfd_rib_node); struct agg_table *atable = agg_get_table(rfd_rib_node);
@ -1626,14 +1631,14 @@ static int rfapiNhlAddSubtree(
* hands in node->link */ * hands in node->link */
if (agg_node_left(rn) && agg_node_left(rn) != omit_node) { if (agg_node_left(rn) && agg_node_left(rn) != omit_node) {
if (agg_node_left(rn)->info) { if (agg_node_left(rn)->info) {
const struct prefix *p =
agg_node_get_prefix(agg_node_left(rn));
int count = 0; int count = 0;
struct agg_node *rib_rn = NULL; struct agg_node *rib_rn = NULL;
rfapiQprefix2Rprefix(&agg_node_left(rn)->p, &rprefix); rfapiQprefix2Rprefix(p, &rprefix);
if (rfd_rib_table) { if (rfd_rib_table)
rib_rn = agg_node_get(rfd_rib_table, rib_rn = agg_node_get(rfd_rib_table, p);
&agg_node_left(rn)->p);
}
count = rfapiNhlAddNodeRoutes( count = rfapiNhlAddNodeRoutes(
agg_node_left(rn), &rprefix, lifetime, 0, head, agg_node_left(rn), &rprefix, lifetime, 0, head,
@ -1653,14 +1658,15 @@ static int rfapiNhlAddSubtree(
if (agg_node_right(rn) && agg_node_right(rn) != omit_node) { if (agg_node_right(rn) && agg_node_right(rn) != omit_node) {
if (agg_node_right(rn)->info) { if (agg_node_right(rn)->info) {
const struct prefix *p =
agg_node_get_prefix(agg_node_right(rn));
int count = 0; int count = 0;
struct agg_node *rib_rn = NULL; struct agg_node *rib_rn = NULL;
rfapiQprefix2Rprefix(&agg_node_right(rn)->p, &rprefix); rfapiQprefix2Rprefix(p, &rprefix);
if (rfd_rib_table) { if (rfd_rib_table)
rib_rn = agg_node_get(rfd_rib_table, rib_rn = agg_node_get(rfd_rib_table, p);
&agg_node_right(rn)->p);
}
count = rfapiNhlAddNodeRoutes( count = rfapiNhlAddNodeRoutes(
agg_node_right(rn), &rprefix, lifetime, 0, head, agg_node_right(rn), &rprefix, lifetime, 0, head,
tail, exclude_vnaddr, rib_rn, tail, exclude_vnaddr, rib_rn,
@ -1712,23 +1718,18 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList(
struct rfapi_next_hop_entry *answer = NULL; struct rfapi_next_hop_entry *answer = NULL;
struct rfapi_next_hop_entry *last = NULL; struct rfapi_next_hop_entry *last = NULL;
struct agg_node *parent; struct agg_node *parent;
const struct prefix *p = agg_node_get_prefix(rn);
int count = 0; int count = 0;
struct agg_node *rib_rn; struct agg_node *rib_rn;
#ifdef DEBUG_RETURNED_NHL #ifdef DEBUG_RETURNED_NHL
{ vnc_zlog_debug_verbose("%s: called with node pfx=%rRN", __func__, rn);
char buf[PREFIX_STRLEN];
prefix2str(&rn->p, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: called with node pfx=%s", __func__,
buf);
}
rfapiDebugBacktrace(); rfapiDebugBacktrace();
#endif #endif
rfapiQprefix2Rprefix(&rn->p, &rprefix); rfapiQprefix2Rprefix(p, &rprefix);
rib_rn = rfd_rib_table ? agg_node_get(rfd_rib_table, &rn->p) : NULL; rib_rn = rfd_rib_table ? agg_node_get(rfd_rib_table, p) : NULL;
/* /*
* Add non-withdrawn routes at this node * Add non-withdrawn routes at this node
@ -1780,9 +1781,10 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList(
* Add non-withdrawn routes from less-specific prefix * Add non-withdrawn routes from less-specific prefix
*/ */
if (parent) { if (parent) {
rib_rn = rfd_rib_table ? agg_node_get(rfd_rib_table, &parent->p) const struct prefix *p = agg_node_get_prefix(parent);
: NULL;
rfapiQprefix2Rprefix(&parent->p, &rprefix); rib_rn = rfd_rib_table ? agg_node_get(rfd_rib_table, p) : NULL;
rfapiQprefix2Rprefix(p, &rprefix);
count += rfapiNhlAddNodeRoutes(parent, &rprefix, lifetime, 0, count += rfapiNhlAddNodeRoutes(parent, &rprefix, lifetime, 0,
&answer, &last, exclude_vnaddr, &answer, &last, exclude_vnaddr,
rib_rn, pfx_target_original); rib_rn, pfx_target_original);
@ -1863,7 +1865,9 @@ struct rfapi_next_hop_entry *rfapiEthRouteNode2NextHopList(
struct rfapi_next_hop_entry *last = NULL; struct rfapi_next_hop_entry *last = NULL;
struct agg_node *rib_rn; struct agg_node *rib_rn;
rib_rn = rfd_rib_table ? agg_node_get(rfd_rib_table, &rn->p) : NULL; rib_rn = rfd_rib_table
? agg_node_get(rfd_rib_table, agg_node_get_prefix(rn))
: NULL;
count = rfapiNhlAddNodeRoutes(rn, rprefix, lifetime, 0, &answer, &last, count = rfapiNhlAddNodeRoutes(rn, rprefix, lifetime, 0, &answer, &last,
NULL, rib_rn, pfx_target_original); NULL, rib_rn, pfx_target_original);
@ -2006,10 +2010,10 @@ static void rfapiBgpInfoDetach(struct agg_node *rn, struct bgp_path_info *bpi)
/* /*
* For L3-indexed import tables * For L3-indexed import tables
*/ */
static int rfapi_bi_peer_rd_cmp(void *b1, void *b2) static int rfapi_bi_peer_rd_cmp(const void *b1, const void *b2)
{ {
struct bgp_path_info *bpi1 = b1; const struct bgp_path_info *bpi1 = b1;
struct bgp_path_info *bpi2 = b2; const struct bgp_path_info *bpi2 = b2;
/* /*
* Compare peers * Compare peers
@ -2022,8 +2026,9 @@ static int rfapi_bi_peer_rd_cmp(void *b1, void *b2)
/* /*
* compare RDs * compare RDs
*/ */
return vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc.import.rd, return vnc_prefix_cmp(
(struct prefix *)&bpi2->extra->vnc.import.rd); (const struct prefix *)&bpi1->extra->vnc.import.rd,
(const struct prefix *)&bpi2->extra->vnc.import.rd);
} }
/* /*
@ -2031,10 +2036,10 @@ static int rfapi_bi_peer_rd_cmp(void *b1, void *b2)
* The BPIs in these tables should ALWAYS have an aux_prefix set because * The BPIs in these tables should ALWAYS have an aux_prefix set because
* they arrive via IPv4 or IPv6 advertisements. * they arrive via IPv4 or IPv6 advertisements.
*/ */
static int rfapi_bi_peer_rd_aux_cmp(void *b1, void *b2) static int rfapi_bi_peer_rd_aux_cmp(const void *b1, const void *b2)
{ {
struct bgp_path_info *bpi1 = b1; const struct bgp_path_info *bpi1 = b1;
struct bgp_path_info *bpi2 = b2; const struct bgp_path_info *bpi2 = b2;
int rc; int rc;
/* /*
@ -2089,6 +2094,7 @@ static void rfapiItBiIndexAdd(struct agg_node *rn, /* Import table VPN node */
struct bgp_path_info *bpi) /* new BPI */ struct bgp_path_info *bpi) /* new BPI */
{ {
struct skiplist *sl; struct skiplist *sl;
const struct prefix *p;
assert(rn); assert(rn);
assert(bpi); assert(bpi);
@ -2105,7 +2111,8 @@ static void rfapiItBiIndexAdd(struct agg_node *rn, /* Import table VPN node */
sl = RFAPI_RDINDEX_W_ALLOC(rn); sl = RFAPI_RDINDEX_W_ALLOC(rn);
if (!sl) { if (!sl) {
if (AF_ETHERNET == rn->p.family) { p = agg_node_get_prefix(rn);
if (AF_ETHERNET == p->family) {
sl = skiplist_new(0, rfapi_bi_peer_rd_aux_cmp, NULL); sl = skiplist_new(0, rfapi_bi_peer_rd_aux_cmp, NULL);
} else { } else {
sl = skiplist_new(0, rfapi_bi_peer_rd_cmp, NULL); sl = skiplist_new(0, rfapi_bi_peer_rd_cmp, NULL);
@ -2152,7 +2159,7 @@ static void rfapiItBiIndexDump(struct agg_node *rn)
static struct bgp_path_info *rfapiItBiIndexSearch( static struct bgp_path_info *rfapiItBiIndexSearch(
struct agg_node *rn, /* Import table VPN node */ struct agg_node *rn, /* Import table VPN node */
struct prefix_rd *prd, struct peer *peer, struct prefix_rd *prd, struct peer *peer,
struct prefix *aux_prefix) /* optional L3 addr for L2 ITs */ const struct prefix *aux_prefix) /* optional L3 addr for L2 ITs */
{ {
struct skiplist *sl; struct skiplist *sl;
int rc; int rc;
@ -2375,7 +2382,7 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
struct rfapi_withdraw *wcb = t->arg; struct rfapi_withdraw *wcb = t->arg;
struct bgp_path_info *bpi = wcb->info; struct bgp_path_info *bpi = wcb->info;
struct bgp *bgp = bgp_get_default(); struct bgp *bgp = bgp_get_default();
const struct prefix *p;
struct rfapi_monitor_vpn *moved; struct rfapi_monitor_vpn *moved;
afi_t afi; afi_t afi;
@ -2398,15 +2405,8 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_MPLS_VPN, wcb->lockoffset); RFAPI_CHECK_REFCOUNT(wcb->node, SAFI_MPLS_VPN, wcb->lockoffset);
{ vnc_zlog_debug_verbose("%s: removing bpi %p at prefix %pRN", __func__,
char buf[BUFSIZ]; bpi, wcb->node);
vnc_zlog_debug_verbose(
"%s: removing bpi %p at prefix %s/%d", __func__, bpi,
rfapi_ntop(wcb->node->p.family, &wcb->node->p.u.prefix,
buf, BUFSIZ),
wcb->node->p.prefixlen);
}
/* /*
* Remove the route (doubly-linked) * Remove the route (doubly-linked)
@ -2415,7 +2415,8 @@ static int rfapiWithdrawTimerVPN(struct thread *t)
&& VALID_INTERIOR_TYPE(bpi->type)) && VALID_INTERIOR_TYPE(bpi->type))
RFAPI_MONITOR_EXTERIOR(wcb->node)->valid_interior_count--; RFAPI_MONITOR_EXTERIOR(wcb->node)->valid_interior_count--;
afi = family2afi(wcb->node->p.family); p = agg_node_get_prefix(wcb->node);
afi = family2afi(p->family);
wcb->import_table->holddown_count[afi] -= 1; /* keep count consistent */ wcb->import_table->holddown_count[afi] -= 1; /* keep count consistent */
rfapiItBiIndexDel(wcb->node, bpi); rfapiItBiIndexDel(wcb->node, bpi);
rfapiBgpInfoDetach(wcb->node, bpi); /* with removed bpi */ rfapiBgpInfoDetach(wcb->node, bpi); /* with removed bpi */
@ -2846,11 +2847,13 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
} }
typedef void(rfapi_bi_filtered_import_f)(struct rfapi_import_table *, int, typedef void(rfapi_bi_filtered_import_f)(struct rfapi_import_table *table,
struct peer *, void *, struct prefix *, int action, struct peer *peer,
struct prefix *, afi_t, void *rfd, const struct prefix *prefix,
struct prefix_rd *, struct attr *, const struct prefix *aux_prefix,
uint8_t, uint8_t, uint32_t *); afi_t afi, struct prefix_rd *prd,
struct attr *attr, uint8_t type,
uint8_t sub_type, uint32_t *label);
static void rfapiExpireEncapNow(struct rfapi_import_table *it, static void rfapiExpireEncapNow(struct rfapi_import_table *it,
@ -2899,11 +2902,11 @@ static int rfapiGetNexthop(struct attr *attr, struct prefix *prefix)
static void rfapiBgpInfoFilteredImportEncap( static void rfapiBgpInfoFilteredImportEncap(
struct rfapi_import_table *import_table, int action, struct peer *peer, struct rfapi_import_table *import_table, int action, struct peer *peer,
void *rfd, /* set for looped back routes */ void *rfd, /* set for looped back routes */
struct prefix *p, const struct prefix *p,
struct prefix *aux_prefix, /* Unused for encap routes */ const struct prefix *aux_prefix, /* Unused for encap routes */
afi_t afi, struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd,
struct attr *attr, /* part of bgp_path_info */ struct attr *attr, /* part of bgp_path_info */
uint8_t type, /* part of bgp_path_info */ uint8_t type, /* part of bgp_path_info */
uint8_t sub_type, /* part of bgp_path_info */ uint8_t sub_type, /* part of bgp_path_info */
uint32_t *label) /* part of bgp_path_info */ uint32_t *label) /* part of bgp_path_info */
{ {
@ -3074,11 +3077,8 @@ static void rfapiBgpInfoFilteredImportEncap(
if (action == FIF_ACTION_WITHDRAW) { if (action == FIF_ACTION_WITHDRAW) {
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: withdrawing at prefix %s/%d", "%s: withdrawing at prefix %pRN",
__func__, __func__, rn);
inet_ntop(rn->p.family, &rn->p.u.prefix,
buf, BUFSIZ),
rn->p.prefixlen);
rfapiBiStartWithdrawTimer( rfapiBiStartWithdrawTimer(
import_table, rn, bpi, afi, SAFI_ENCAP, import_table, rn, bpi, afi, SAFI_ENCAP,
@ -3086,13 +3086,11 @@ static void rfapiBgpInfoFilteredImportEncap(
} else { } else {
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: %s at prefix %s/%d", __func__, "%s: %s at prefix %pRN", __func__,
((action == FIF_ACTION_KILL) ((action == FIF_ACTION_KILL)
? "killing" ? "killing"
: "replacing"), : "replacing"),
inet_ntop(rn->p.family, &rn->p.u.prefix, rn);
buf, BUFSIZ),
rn->p.prefixlen);
/* /*
* If this route is waiting to be deleted * If this route is waiting to be deleted
@ -3160,10 +3158,8 @@ static void rfapiBgpInfoFilteredImportEncap(
rn = agg_node_get(rt, p); rn = agg_node_get(rt, p);
} }
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose("%s: (afi=%d, rn=%p) inserting at prefix %pRN",
"%s: (afi=%d, rn=%p) inserting at prefix %s/%d", __func__, afi, __func__, afi, rn, rn);
rn, inet_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
rn->p.prefixlen);
rfapiBgpInfoAttachSorted(rn, info_new, afi, SAFI_ENCAP); rfapiBgpInfoAttachSorted(rn, info_new, afi, SAFI_ENCAP);
@ -3246,6 +3242,7 @@ static void rfapiBgpInfoFilteredImportEncap(
__func__, rn); __func__, rn);
#endif #endif
for (m = RFAPI_MONITOR_ENCAP(rn); m; m = m->next) { for (m = RFAPI_MONITOR_ENCAP(rn); m; m = m->next) {
const struct prefix *p;
/* /*
* For each referenced bpi/route, copy the ENCAP route's * For each referenced bpi/route, copy the ENCAP route's
@ -3273,9 +3270,9 @@ static void rfapiBgpInfoFilteredImportEncap(
* list * list
* per prefix. * per prefix.
*/ */
p = agg_node_get_prefix(m->node);
referenced_vpn_prefix = referenced_vpn_prefix =
agg_node_get(referenced_vpn_table, &m->node->p); agg_node_get(referenced_vpn_table, p);
assert(referenced_vpn_prefix); assert(referenced_vpn_prefix);
for (mnext = referenced_vpn_prefix->info; mnext; for (mnext = referenced_vpn_prefix->info; mnext;
mnext = mnext->next) { mnext = mnext->next) {
@ -3360,11 +3357,11 @@ static void rfapiExpireVpnNow(struct rfapi_import_table *it,
void rfapiBgpInfoFilteredImportVPN( void rfapiBgpInfoFilteredImportVPN(
struct rfapi_import_table *import_table, int action, struct peer *peer, struct rfapi_import_table *import_table, int action, struct peer *peer,
void *rfd, /* set for looped back routes */ void *rfd, /* set for looped back routes */
struct prefix *p, const struct prefix *p,
struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */ const struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
afi_t afi, struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd,
struct attr *attr, /* part of bgp_path_info */ struct attr *attr, /* part of bgp_path_info */
uint8_t type, /* part of bgp_path_info */ uint8_t type, /* part of bgp_path_info */
uint8_t sub_type, /* part of bgp_path_info */ uint8_t sub_type, /* part of bgp_path_info */
uint32_t *label) /* part of bgp_path_info */ uint32_t *label) /* part of bgp_path_info */
{ {
@ -3525,11 +3522,8 @@ void rfapiBgpInfoFilteredImportVPN(
BGP_PATH_REMOVED); BGP_PATH_REMOVED);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: withdrawing at prefix %s/%d%s", "%s: withdrawing at prefix %pRN%s",
__func__, rfapi_ntop(rn->p.family, __func__, rn,
&rn->p.u.prefix,
buf, BUFSIZ),
rn->p.prefixlen,
(washolddown (washolddown
? " (already being withdrawn)" ? " (already being withdrawn)"
: "")); : ""));
@ -3548,14 +3542,11 @@ void rfapiBgpInfoFilteredImportVPN(
VNC_ITRCCK; VNC_ITRCCK;
} else { } else {
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: %s at prefix %s/%d", __func__, "%s: %s at prefix %pRN", __func__,
((action == FIF_ACTION_KILL) ((action == FIF_ACTION_KILL)
? "killing" ? "killing"
: "replacing"), : "replacing"),
rfapi_ntop(rn->p.family, rn);
&rn->p.u.prefix, buf,
BUFSIZ),
rn->p.prefixlen);
/* /*
* If this route is waiting to be deleted * If this route is waiting to be deleted
@ -3673,10 +3664,8 @@ void rfapiBgpInfoFilteredImportVPN(
info_new->extra->vnc.import.aux_prefix = *aux_prefix; info_new->extra->vnc.import.aux_prefix = *aux_prefix;
} }
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose("%s: inserting bpi %p at prefix %pRN #%d",
"%s: inserting bpi %p at prefix %s/%d #%d", __func__, info_new, __func__, info_new, rn, rn->lock);
rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
rn->p.prefixlen, rn->lock);
rfapiBgpInfoAttachSorted(rn, info_new, afi, SAFI_MPLS_VPN); rfapiBgpInfoAttachSorted(rn, info_new, afi, SAFI_MPLS_VPN);
rfapiItBiIndexAdd(rn, info_new); rfapiItBiIndexAdd(rn, info_new);
@ -3839,11 +3828,11 @@ void rfapiBgpInfoFilteredImportVPN(
static void rfapiBgpInfoFilteredImportBadSafi( static void rfapiBgpInfoFilteredImportBadSafi(
struct rfapi_import_table *import_table, int action, struct peer *peer, struct rfapi_import_table *import_table, int action, struct peer *peer,
void *rfd, /* set for looped back routes */ void *rfd, /* set for looped back routes */
struct prefix *p, const struct prefix *p,
struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */ const struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
afi_t afi, struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd,
struct attr *attr, /* part of bgp_path_info */ struct attr *attr, /* part of bgp_path_info */
uint8_t type, /* part of bgp_path_info */ uint8_t type, /* part of bgp_path_info */
uint8_t sub_type, /* part of bgp_path_info */ uint8_t sub_type, /* part of bgp_path_info */
uint32_t *label) /* part of bgp_path_info */ uint32_t *label) /* part of bgp_path_info */
{ {
@ -3869,7 +3858,7 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
void rfapiProcessUpdate(struct peer *peer, void rfapiProcessUpdate(struct peer *peer,
void *rfd, /* set when looped from RFP/RFAPI */ void *rfd, /* set when looped from RFP/RFAPI */
struct prefix *p, struct prefix_rd *prd, const struct prefix *p, struct prefix_rd *prd,
struct attr *attr, afi_t afi, safi_t safi, uint8_t type, struct attr *attr, afi_t afi, safi_t safi, uint8_t type,
uint8_t sub_type, uint32_t *label) uint8_t sub_type, uint32_t *label)
{ {
@ -3953,7 +3942,7 @@ void rfapiProcessUpdate(struct peer *peer,
} }
void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p, void rfapiProcessWithdraw(struct peer *peer, void *rfd, const struct prefix *p,
struct prefix_rd *prd, struct attr *attr, afi_t afi, struct prefix_rd *prd, struct attr *attr, afi_t afi,
safi_t safi, uint8_t type, int kill) safi_t safi, uint8_t type, int kill)
{ {
@ -4444,27 +4433,20 @@ static void rfapiDeleteRemotePrefixesIt(
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) { for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
struct bgp_path_info *next; struct bgp_path_info *next;
const struct prefix *rn_p = agg_node_get_prefix(rn);
if (p && VNC_DEBUG(IMPORT_DEL_REMOTE)) { if (p && VNC_DEBUG(IMPORT_DEL_REMOTE)) {
char p1line[PREFIX_STRLEN]; char p1line[PREFIX_STRLEN];
char p2line[PREFIX_STRLEN];
prefix2str(p, p1line, sizeof(p1line)); prefix2str(p, p1line, sizeof(p1line));
prefix2str(&rn->p, p2line, sizeof(p2line)); vnc_zlog_debug_any("%s: want %s, have %pRN",
vnc_zlog_debug_any("%s: want %s, have %s", __func__, p1line, rn);
__func__, p1line, p2line);
} }
if (p && prefix_cmp(p, &rn->p)) if (p && prefix_cmp(p, rn_p))
continue; continue;
{ vnc_zlog_debug_verbose("%s: rn pfx=%pRN", __func__, rn);
char buf_pfx[PREFIX_STRLEN];
prefix2str(&rn->p, buf_pfx, sizeof(buf_pfx));
vnc_zlog_debug_verbose("%s: rn pfx=%s",
__func__, buf_pfx);
}
/* TBD is this valid for afi == AFI_L2VPN? */ /* TBD is this valid for afi == AFI_L2VPN? */
RFAPI_CHECK_REFCOUNT(rn, SAFI_MPLS_VPN, 1); RFAPI_CHECK_REFCOUNT(rn, SAFI_MPLS_VPN, 1);
@ -4596,7 +4578,7 @@ static void rfapiDeleteRemotePrefixesIt(
} }
} }
vnc_direct_bgp_rh_del_route(bgp, afi, &rn->p, vnc_direct_bgp_rh_del_route(bgp, afi, rn_p,
bpi->peer); bpi->peer);
RFAPI_UPDATE_ITABLE_COUNT(bpi, it, afi, -1); RFAPI_UPDATE_ITABLE_COUNT(bpi, it, afi, -1);

View File

@ -143,11 +143,11 @@ extern void rfapiUnicastNexthop2Prefix(afi_t afi, struct attr *attr,
extern void rfapiBgpInfoFilteredImportVPN( extern void rfapiBgpInfoFilteredImportVPN(
struct rfapi_import_table *import_table, int action, struct peer *peer, struct rfapi_import_table *import_table, int action, struct peer *peer,
void *rfd, /* set for looped back routes */ void *rfd, /* set for looped back routes */
struct prefix *p, const struct prefix *p,
struct prefix *aux_prefix, /* AFI_ETHER: optional IP */ const struct prefix *aux_prefix, /* AFI_ETHER: optional IP */
afi_t afi, struct prefix_rd *prd, afi_t afi, struct prefix_rd *prd,
struct attr *attr, /* part of bgp_path_info */ struct attr *attr, /* part of bgp_path_info */
uint8_t type, /* part of bgp_path_info */ uint8_t type, /* part of bgp_path_info */
uint8_t sub_type, /* part of bgp_path_info */ uint8_t sub_type, /* part of bgp_path_info */
uint32_t *label); /* part of bgp_path_info */ uint32_t *label); /* part of bgp_path_info */

View File

@ -789,7 +789,8 @@ static void rfapiMonitorTimerRestart(struct rfapi_monitor_vpn *m)
* been responsible for the response, i.e., any monitors for * been responsible for the response, i.e., any monitors for
* the exact prefix or a parent of it. * the exact prefix or a parent of it.
*/ */
void rfapiMonitorTimersRestart(struct rfapi_descriptor *rfd, struct prefix *p) void rfapiMonitorTimersRestart(struct rfapi_descriptor *rfd,
const struct prefix *p)
{ {
struct agg_node *rn; struct agg_node *rn;
@ -818,12 +819,14 @@ void rfapiMonitorTimersRestart(struct rfapi_descriptor *rfd, struct prefix *p)
for (rn = agg_route_top(rfd->mon); rn; for (rn = agg_route_top(rfd->mon); rn;
rn = agg_route_next(rn)) { rn = agg_route_next(rn)) {
struct rfapi_monitor_vpn *m; struct rfapi_monitor_vpn *m;
const struct prefix *p_node;
if (!((m = rn->info))) if (!((m = rn->info)))
continue; continue;
p_node = agg_node_get_prefix(m->node);
/* NB order of test is significant ! */ /* NB order of test is significant ! */
if (!m->node || prefix_match(&m->node->p, p)) { if (!m->node || prefix_match(p_node, p)) {
rfapiMonitorTimerRestart(m); rfapiMonitorTimerRestart(m);
} }
} }
@ -841,7 +844,8 @@ void rfapiMonitorItNodeChanged(
struct skiplist *nves_seen; struct skiplist *nves_seen;
struct agg_node *rn = it_node; struct agg_node *rn = it_node;
struct bgp *bgp = bgp_get_default(); struct bgp *bgp = bgp_get_default();
afi_t afi = family2afi(rn->p.family); const struct prefix *p = agg_node_get_prefix(rn);
afi_t afi = family2afi(p->family);
#if DEBUG_L2_EXTRA #if DEBUG_L2_EXTRA
char buf_prefix[PREFIX_STRLEN]; char buf_prefix[PREFIX_STRLEN];
#endif #endif
@ -931,17 +935,14 @@ void rfapiMonitorItNodeChanged(
assert(!skiplist_insert(nves_seen, assert(!skiplist_insert(nves_seen,
m->rfd, NULL)); m->rfd, NULL));
char buf_attach_pfx[PREFIX_STRLEN];
char buf_target_pfx[PREFIX_STRLEN]; char buf_target_pfx[PREFIX_STRLEN];
prefix2str(&m->node->p, buf_attach_pfx,
sizeof(buf_attach_pfx));
prefix2str(&m->p, buf_target_pfx, prefix2str(&m->p, buf_target_pfx,
sizeof(buf_target_pfx)); sizeof(buf_target_pfx));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: update rfd %p attached to pfx %s (targ=%s)", "%s: update rfd %p attached to pfx %pRN (targ=%s)",
__func__, m->rfd, __func__, m->rfd, m->node,
buf_attach_pfx, buf_target_pfx); buf_target_pfx);
/* /*
* update its RIB * update its RIB
@ -1103,10 +1104,10 @@ static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m)
m->rfd->response_lifetime, &m->timer); m->rfd->response_lifetime, &m->timer);
} }
static int mon_eth_cmp(void *a, void *b) static int mon_eth_cmp(const void *a, const void *b)
{ {
struct rfapi_monitor_eth *m1; const struct rfapi_monitor_eth *m1;
struct rfapi_monitor_eth *m2; const struct rfapi_monitor_eth *m2;
int i; int i;

View File

@ -167,7 +167,7 @@ extern void rfapiMonitorResponseRemovalOn(struct bgp *bgp);
extern void rfapiMonitorExtraPrune(safi_t safi, struct agg_node *rn); extern void rfapiMonitorExtraPrune(safi_t safi, struct agg_node *rn);
extern void rfapiMonitorTimersRestart(struct rfapi_descriptor *rfd, extern void rfapiMonitorTimersRestart(struct rfapi_descriptor *rfd,
struct prefix *p); const struct prefix *p);
extern void rfapiMonitorItNodeChanged(struct rfapi_import_table *import_table, extern void rfapiMonitorItNodeChanged(struct rfapi_import_table *import_table,
struct agg_node *it_node, struct agg_node *it_node,

View File

@ -58,10 +58,10 @@ static void logdifferent(const char *tag, struct rfapi_nve_addr *a,
#endif #endif
int rfapi_nve_addr_cmp(void *k1, void *k2) int rfapi_nve_addr_cmp(const void *k1, const void *k2)
{ {
struct rfapi_nve_addr *a = (struct rfapi_nve_addr *)k1; const struct rfapi_nve_addr *a = (struct rfapi_nve_addr *)k1;
struct rfapi_nve_addr *b = (struct rfapi_nve_addr *)k2; const struct rfapi_nve_addr *b = (struct rfapi_nve_addr *)k2;
int ret = 0; int ret = 0;
if (!a || !b) { if (!a || !b) {

View File

@ -30,7 +30,7 @@ struct rfapi_nve_addr {
}; };
extern int rfapi_nve_addr_cmp(void *k1, void *k2); extern int rfapi_nve_addr_cmp(const void *k1, const void *k2);
extern void rfapiNveAddr2Str(struct rfapi_nve_addr *na, char *buf, int bufsize); extern void rfapiNveAddr2Str(struct rfapi_nve_addr *na, char *buf, int bufsize);

View File

@ -272,16 +272,13 @@ struct rfapi {
? ((prefix)->prefixlen == 128) \ ? ((prefix)->prefixlen == 128) \
: 0)) : 0))
extern void rfapiQprefix2Rprefix(struct prefix *qprefix,
struct rfapi_ip_prefix *rprefix);
extern int rfapi_find_rfd(struct bgp *bgp, struct rfapi_ip_addr *vn_addr, extern int rfapi_find_rfd(struct bgp *bgp, struct rfapi_ip_addr *vn_addr,
struct rfapi_ip_addr *un_addr, struct rfapi_ip_addr *un_addr,
struct rfapi_descriptor **rfd); struct rfapi_descriptor **rfd);
extern void extern void
add_vnc_route(struct rfapi_descriptor *rfd, /* cookie + UN addr for VPN */ add_vnc_route(struct rfapi_descriptor *rfd, /* cookie + UN addr for VPN */
struct bgp *bgp, int safi, struct prefix *p, struct bgp *bgp, int safi, const struct prefix *p,
struct prefix_rd *prd, struct rfapi_ip_addr *nexthop, struct prefix_rd *prd, struct rfapi_ip_addr *nexthop,
uint32_t *local_pref, /* host byte order */ uint32_t *local_pref, /* host byte order */
uint32_t *lifetime, /* host byte order */ uint32_t *lifetime, /* host byte order */
@ -297,7 +294,7 @@ add_vnc_route(struct rfapi_descriptor *rfd, /* cookie + UN addr for VPN */
#endif #endif
extern void del_vnc_route(struct rfapi_descriptor *rfd, struct peer *peer, extern void del_vnc_route(struct rfapi_descriptor *rfd, struct peer *peer,
struct bgp *bgp, safi_t safi, struct prefix *p, struct bgp *bgp, safi_t safi, const struct prefix *p,
struct prefix_rd *prd, uint8_t type, uint8_t sub_type, struct prefix_rd *prd, uint8_t type, uint8_t sub_type,
struct rfapi_nexthop *lnh, int kill); struct rfapi_nexthop *lnh, int kill);

View File

@ -340,7 +340,6 @@ static void rfapiRibStartTimer(struct rfapi_descriptor *rfd,
{ {
struct thread *t = ri->timer; struct thread *t = ri->timer;
struct rfapi_rib_tcb *tcb = NULL; struct rfapi_rib_tcb *tcb = NULL;
char buf_prefix[PREFIX_STRLEN];
if (t) { if (t) {
tcb = t->arg; tcb = t->arg;
@ -361,9 +360,8 @@ static void rfapiRibStartTimer(struct rfapi_descriptor *rfd,
UNSET_FLAG(tcb->flags, RFAPI_RIB_TCB_FLAG_DELETED); UNSET_FLAG(tcb->flags, RFAPI_RIB_TCB_FLAG_DELETED);
} }
prefix2str(&rn->p, buf_prefix, sizeof(buf_prefix)); vnc_zlog_debug_verbose("%s: rfd %p pfx %pRN life %u", __func__, rfd, rn,
vnc_zlog_debug_verbose("%s: rfd %p pfx %s life %u", __func__, rfd, ri->lifetime);
buf_prefix, ri->lifetime);
ri->timer = NULL; ri->timer = NULL;
thread_add_timer(bm->master, rfapiRibExpireTimer, tcb, ri->lifetime, thread_add_timer(bm->master, rfapiRibExpireTimer, tcb, ri->lifetime,
&ri->timer); &ri->timer);
@ -388,10 +386,10 @@ extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */
/* /*
* Compares two <struct rfapi_rib_key>s * Compares two <struct rfapi_rib_key>s
*/ */
int rfapi_rib_key_cmp(void *k1, void *k2) int rfapi_rib_key_cmp(const void *k1, const void *k2)
{ {
struct rfapi_rib_key *a = (struct rfapi_rib_key *)k1; const struct rfapi_rib_key *a = (struct rfapi_rib_key *)k1;
struct rfapi_rib_key *b = (struct rfapi_rib_key *)k2; const struct rfapi_rib_key *b = (struct rfapi_rib_key *)k2;
int ret; int ret;
if (!a || !b) if (!a || !b)
@ -741,11 +739,12 @@ int rfapiRibPreloadBi(
struct rfapi_rib_key rk; struct rfapi_rib_key rk;
struct agg_node *trn; struct agg_node *trn;
afi_t afi; afi_t afi;
const struct prefix *p = agg_node_get_prefix(rfd_rib_node);
if (!rfd_rib_node) if (!rfd_rib_node)
return 0; return 0;
afi = family2afi(rfd_rib_node->p.family); afi = family2afi(p->family);
rfd = agg_get_table_info(agg_get_table(rfd_rib_node)); rfd = agg_get_table_info(agg_get_table(rfd_rib_node));
@ -803,8 +802,7 @@ int rfapiRibPreloadBi(
/* /*
* Update last sent time for prefix * Update last sent time for prefix
*/ */
trn = agg_node_get(rfd->rsp_times[afi], trn = agg_node_get(rfd->rsp_times[afi], p); /* locks trn */
&rfd_rib_node->p); /* locks trn */
trn->info = (void *)(uintptr_t)bgp_clock(); trn->info = (void *)(uintptr_t)bgp_clock();
if (trn->lock > 1) if (trn->lock > 1)
agg_unlock_node(trn); agg_unlock_node(trn);
@ -852,10 +850,9 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
struct list *lPendCost = NULL; struct list *lPendCost = NULL;
struct list *delete_list = NULL; struct list *delete_list = NULL;
int printedprefix = 0; int printedprefix = 0;
char buf_prefix[PREFIX_STRLEN];
int rib_node_started_nonempty = 0; int rib_node_started_nonempty = 0;
int sendingsomeroutes = 0; int sendingsomeroutes = 0;
const struct prefix *p;
#if DEBUG_PROCESS_PENDING_NODE #if DEBUG_PROCESS_PENDING_NODE
unsigned int count_rib_initial = 0; unsigned int count_rib_initial = 0;
unsigned int count_pend_vn_initial = 0; unsigned int count_pend_vn_initial = 0;
@ -863,12 +860,12 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
#endif #endif
assert(pn); assert(pn);
prefix2str(&pn->p, buf_prefix, sizeof(buf_prefix)); p = agg_node_get_prefix(pn);
vnc_zlog_debug_verbose("%s: afi=%d, %s pn->info=%p", __func__, afi, vnc_zlog_debug_verbose("%s: afi=%d, %pRN pn->info=%p", __func__, afi,
buf_prefix, pn->info); pn, pn->info);
if (AFI_L2VPN != afi) { if (AFI_L2VPN != afi) {
rfapiQprefix2Rprefix(&pn->p, &hp); rfapiQprefix2Rprefix(p, &hp);
} }
RFAPI_RIB_CHECK_COUNTS(1, 0); RFAPI_RIB_CHECK_COUNTS(1, 0);
@ -876,7 +873,7 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
/* /*
* Find corresponding RIB node * Find corresponding RIB node
*/ */
rn = agg_node_get(rfd->rib[afi], &pn->p); /* locks rn */ rn = agg_node_get(rfd->rib[afi], p); /* locks rn */
/* /*
* RIB skiplist has key=rfapi_addr={vn,un}, val = rfapi_info, * RIB skiplist has key=rfapi_addr={vn,un}, val = rfapi_info,
@ -935,9 +932,9 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd,
prefix2str(&ri->rk.vn, buf, sizeof(buf)); prefix2str(&ri->rk.vn, buf, sizeof(buf));
prefix2str(&ri->un, buf2, sizeof(buf2)); prefix2str(&ri->un, buf2, sizeof(buf2));
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
"%s: put dl pfx=%s vn=%s un=%s cost=%d life=%d vn_options=%p", "%s: put dl pfx=%pRN vn=%s un=%s cost=%d life=%d vn_options=%p",
__func__, buf_prefix, buf, buf2, __func__, pn, buf, buf2, ri->cost,
ri->cost, ri->lifetime, ri->vn_options); ri->lifetime, ri->vn_options);
skiplist_delete_first(slRibPt); skiplist_delete_first(slRibPt);
} }
@ -1186,8 +1183,7 @@ callback:
vnc_zlog_debug_verbose("%s: lPendCost->count now %d", __func__, vnc_zlog_debug_verbose("%s: lPendCost->count now %d", __func__,
lPendCost->count); lPendCost->count);
vnc_zlog_debug_verbose("%s: For prefix %s (a)", __func__, vnc_zlog_debug_verbose("%s: For prefix %pRN (a)", __func__, pn);
buf_prefix);
printedprefix = 1; printedprefix = 1;
for (ALL_LIST_ELEMENTS(lPendCost, node, nnode, ri)) { for (ALL_LIST_ELEMENTS(lPendCost, node, nnode, ri)) {
@ -1246,7 +1242,7 @@ callback:
* update this NVE's timestamp for this prefix * update this NVE's timestamp for this prefix
*/ */
trn = agg_node_get(rfd->rsp_times[afi], trn = agg_node_get(rfd->rsp_times[afi],
&pn->p); /* locks trn */ p); /* locks trn */
trn->info = (void *)(uintptr_t)bgp_clock(); trn->info = (void *)(uintptr_t)bgp_clock();
if (trn->lock > 1) if (trn->lock > 1)
agg_unlock_node(trn); agg_unlock_node(trn);
@ -1268,8 +1264,8 @@ callback:
char buf2[BUFSIZ]; char buf2[BUFSIZ];
if (!printedprefix) { if (!printedprefix) {
vnc_zlog_debug_verbose("%s: For prefix %s (d)", vnc_zlog_debug_verbose("%s: For prefix %pRN (d)",
__func__, buf_prefix); __func__, pn);
} }
vnc_zlog_debug_verbose("%s: delete_list has %d elements", vnc_zlog_debug_verbose("%s: delete_list has %d elements",
__func__, delete_list->count); __func__, delete_list->count);
@ -1465,7 +1461,7 @@ callback:
} }
if (sendingsomeroutes) if (sendingsomeroutes)
rfapiMonitorTimersRestart(rfd, &pn->p); rfapiMonitorTimersRestart(rfd, p);
agg_unlock_node(rn); /* agg_node_get() */ agg_unlock_node(rn); /* agg_node_get() */
@ -1589,7 +1585,7 @@ void rfapiRibUpdatePendingNode(
struct rfapi_import_table *it, /* needed for L2 */ struct rfapi_import_table *it, /* needed for L2 */
struct agg_node *it_node, uint32_t lifetime) struct agg_node *it_node, uint32_t lifetime)
{ {
struct prefix *prefix; const struct prefix *prefix;
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
struct agg_node *pn; struct agg_node *pn;
afi_t afi; afi_t afi;
@ -1606,7 +1602,7 @@ void rfapiRibUpdatePendingNode(
RFAPI_RIB_CHECK_COUNTS(1, 0); RFAPI_RIB_CHECK_COUNTS(1, 0);
prefix = &it_node->p; prefix = agg_node_get_prefix(it_node);
afi = family2afi(prefix->family); afi = family2afi(prefix->family);
prefix2str(prefix, buf, sizeof(buf)); prefix2str(prefix, buf, sizeof(buf));
vnc_zlog_debug_verbose("%s: prefix=%s", __func__, buf); vnc_zlog_debug_verbose("%s: prefix=%s", __func__, buf);
@ -1794,7 +1790,8 @@ int rfapiRibFTDFilterRecentPrefix(
struct prefix *pfx_target_original) /* query target */ struct prefix *pfx_target_original) /* query target */
{ {
struct bgp *bgp = rfd->bgp; struct bgp *bgp = rfd->bgp;
afi_t afi = family2afi(it_rn->p.family); const struct prefix *p = agg_node_get_prefix(it_rn);
afi_t afi = family2afi(p->family);
time_t prefix_time; time_t prefix_time;
struct agg_node *trn; struct agg_node *trn;
@ -1809,7 +1806,7 @@ int rfapiRibFTDFilterRecentPrefix(
* This matches behavior of now-obsolete rfapiRibFTDFilterRecent(), * This matches behavior of now-obsolete rfapiRibFTDFilterRecent(),
* but we need to decide if that is correct. * but we need to decide if that is correct.
*/ */
if (it_rn->p.family == AF_ETHERNET) if (p->family == AF_ETHERNET)
return 0; return 0;
#ifdef DEBUG_FTD_FILTER_RECENT #ifdef DEBUG_FTD_FILTER_RECENT
@ -1824,7 +1821,7 @@ int rfapiRibFTDFilterRecentPrefix(
/* /*
* prefix covers target address, so allow prefix * prefix covers target address, so allow prefix
*/ */
if (prefix_match(&it_rn->p, pfx_target_original)) { if (prefix_match(p, pfx_target_original)) {
#ifdef DEBUG_FTD_FILTER_RECENT #ifdef DEBUG_FTD_FILTER_RECENT
vnc_zlog_debug_verbose("%s: prefix covers target, allowed", vnc_zlog_debug_verbose("%s: prefix covers target, allowed",
__func__); __func__);
@ -1835,7 +1832,7 @@ int rfapiRibFTDFilterRecentPrefix(
/* /*
* check this NVE's timestamp for this prefix * check this NVE's timestamp for this prefix
*/ */
trn = agg_node_get(rfd->rsp_times[afi], &it_rn->p); /* locks trn */ trn = agg_node_get(rfd->rsp_times[afi], p); /* locks trn */
prefix_time = (time_t)trn->info; prefix_time = (time_t)trn->info;
if (trn->lock > 1) if (trn->lock > 1)
agg_unlock_node(trn); agg_unlock_node(trn);
@ -2114,11 +2111,10 @@ void rfapiRibPendingDeleteRoute(struct bgp *bgp, struct rfapi_import_table *it,
{ {
struct rfapi_descriptor *rfd; struct rfapi_descriptor *rfd;
struct listnode *node; struct listnode *node;
char buf[PREFIX_STRLEN]; const struct prefix *p = agg_node_get_prefix(it_node);
prefix2str(&it_node->p, buf, sizeof(buf)); vnc_zlog_debug_verbose("%s: entry, it=%p, afi=%d, it_node=%p, pfx=%pRN",
vnc_zlog_debug_verbose("%s: entry, it=%p, afi=%d, it_node=%p, pfx=%s", __func__, it, afi, it_node, it_node);
__func__, it, afi, it_node, buf);
if (AFI_L2VPN == afi) { if (AFI_L2VPN == afi) {
/* /*
@ -2157,7 +2153,7 @@ void rfapiRibPendingDeleteRoute(struct bgp *bgp, struct rfapi_import_table *it,
* delete * delete
*/ */
if ((rn = agg_node_lookup(m->rfd->rib[afi], if ((rn = agg_node_lookup(m->rfd->rib[afi],
&it_node->p))) { p))) {
rfapiRibUpdatePendingNode( rfapiRibUpdatePendingNode(
bgp, m->rfd, it, it_node, bgp, m->rfd, it, it_node,
m->rfd->response_lifetime); m->rfd->response_lifetime);
@ -2179,8 +2175,7 @@ void rfapiRibPendingDeleteRoute(struct bgp *bgp, struct rfapi_import_table *it,
* this * this
* NVE, it's OK to send an update with the delete * NVE, it's OK to send an update with the delete
*/ */
if ((rn = agg_node_lookup(m->rfd->rib[afi], if ((rn = agg_node_lookup(m->rfd->rib[afi], p))) {
&it_node->p))) {
rfapiRibUpdatePendingNode( rfapiRibUpdatePendingNode(
bgp, m->rfd, it, it_node, bgp, m->rfd, it, it_node,
m->rfd->response_lifetime); m->rfd->response_lifetime);
@ -2212,8 +2207,7 @@ void rfapiRibPendingDeleteRoute(struct bgp *bgp, struct rfapi_import_table *it,
* prefix * prefix
* previously, we should send an updated response. * previously, we should send an updated response.
*/ */
if ((rn = agg_node_lookup(rfd->rib[afi], if ((rn = agg_node_lookup(rfd->rib[afi], p))) {
&it_node->p))) {
rfapiRibUpdatePendingNode( rfapiRibUpdatePendingNode(
bgp, rfd, it, it_node, bgp, rfd, it, it_node,
rfd->response_lifetime); rfd->response_lifetime);
@ -2416,7 +2410,8 @@ void rfapiRibShowResponses(void *stream, struct prefix *pfx_match,
for (rn = agg_route_top(rfd->rib[afi]); rn; for (rn = agg_route_top(rfd->rib[afi]); rn;
rn = agg_route_next(rn)) { rn = agg_route_next(rn)) {
const struct prefix *p =
agg_node_get_prefix(rn);
struct skiplist *sl; struct skiplist *sl;
char str_pfx[PREFIX_STRLEN]; char str_pfx[PREFIX_STRLEN];
int printedprefix = 0; int printedprefix = 0;
@ -2433,9 +2428,8 @@ void rfapiRibShowResponses(void *stream, struct prefix *pfx_match,
nhs_total += skiplist_count(sl); nhs_total += skiplist_count(sl);
++prefixes_total; ++prefixes_total;
if (pfx_match if (pfx_match && !prefix_match(pfx_match, p)
&& !prefix_match(pfx_match, &rn->p) && !prefix_match(p, pfx_match))
&& !prefix_match(&rn->p, pfx_match))
continue; continue;
++prefixes_displayed; ++prefixes_displayed;
@ -2472,7 +2466,7 @@ void rfapiRibShowResponses(void *stream, struct prefix *pfx_match,
str_un, str_un,
BUFSIZ)); BUFSIZ));
} }
prefix2str(&rn->p, str_pfx, sizeof(str_pfx)); prefix2str(p, str_pfx, sizeof(str_pfx));
// fp(out, " %s\n", buf); /* prefix */ // fp(out, " %s\n", buf); /* prefix */
routes_displayed++; routes_displayed++;

View File

@ -147,7 +147,7 @@ extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */
struct prefix *aux, /* may be NULL */ struct prefix *aux, /* may be NULL */
struct rfapi_rib_key *rk); struct rfapi_rib_key *rk);
extern int rfapi_rib_key_cmp(void *k1, void *k2); extern int rfapi_rib_key_cmp(const void *k1, const void *k2);
extern void rfapiAdbFree(struct rfapi_adb *adb); extern void rfapiAdbFree(struct rfapi_adb *adb);

View File

@ -194,7 +194,7 @@ int rfapiQprefix2Raddr(struct prefix *qprefix, struct rfapi_ip_addr *raddr)
* Translate Quagga prefix to RFAPI prefix * Translate Quagga prefix to RFAPI prefix
*/ */
/* rprefix->cost set to 0 */ /* rprefix->cost set to 0 */
void rfapiQprefix2Rprefix(struct prefix *qprefix, void rfapiQprefix2Rprefix(const struct prefix *qprefix,
struct rfapi_ip_prefix *rprefix) struct rfapi_ip_prefix *rprefix)
{ {
memset(rprefix, 0, sizeof(struct rfapi_ip_prefix)); memset(rprefix, 0, sizeof(struct rfapi_ip_prefix));
@ -743,7 +743,6 @@ static void rfapiDebugPrintMonitorEncap(void *stream,
void rfapiShowItNode(void *stream, struct agg_node *rn) void rfapiShowItNode(void *stream, struct agg_node *rn)
{ {
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
char buf[BUFSIZ];
int (*fp)(void *, const char *, ...); int (*fp)(void *, const char *, ...);
struct vty *vty; struct vty *vty;
@ -753,9 +752,7 @@ void rfapiShowItNode(void *stream, struct agg_node *rn)
if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0) if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
return; return;
fp(out, "%s/%d @%p #%d%s", fp(out, "%pRN @%p #%d%s", rn, rn, rn->lock, HVTYNL);
rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
rn->p.prefixlen, rn, rn->lock, HVTYNL);
for (bpi = rn->info; bpi; bpi = bpi->next) { for (bpi = rn->info; bpi; bpi = bpi->next) {
rfapiPrintBi(stream, bpi); rfapiPrintBi(stream, bpi);
@ -782,14 +779,15 @@ void rfapiShowImportTable(void *stream, const char *label, struct agg_table *rt,
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) { for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
const struct prefix *p = agg_node_get_prefix(rn);
if (rn->p.family == AF_ETHERNET) { if (p->family == AF_ETHERNET) {
rfapiEthAddr2Str(&rn->p.u.prefix_eth, buf, BUFSIZ); rfapiEthAddr2Str(&p->u.prefix_eth, buf, BUFSIZ);
} else { } else {
inet_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ); inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ);
} }
fp(out, "%s/%d @%p #%d%s", buf, rn->p.prefixlen, rn, fp(out, "%s/%d @%p #%d%s", buf, p->prefixlen, rn,
rn->lock - 1, /* account for loop iterator locking */ rn->lock - 1, /* account for loop iterator locking */
HVTYNL); HVTYNL);
@ -868,6 +866,8 @@ int rfapiShowVncQueries(void *stream, struct prefix *pfx_match)
if (rfd->mon) { if (rfd->mon) {
for (rn = agg_route_top(rfd->mon); rn; for (rn = agg_route_top(rfd->mon); rn;
rn = agg_route_next(rn)) { rn = agg_route_next(rn)) {
const struct prefix *p =
agg_node_get_prefix(rn);
struct rfapi_monitor_vpn *m; struct rfapi_monitor_vpn *m;
char buf_remain[BUFSIZ]; char buf_remain[BUFSIZ];
char buf_pfx[BUFSIZ]; char buf_pfx[BUFSIZ];
@ -879,9 +879,8 @@ int rfapiShowVncQueries(void *stream, struct prefix *pfx_match)
++queries_total; ++queries_total;
if (pfx_match if (pfx_match && !prefix_match(pfx_match, p)
&& !prefix_match(pfx_match, &rn->p) && !prefix_match(p, pfx_match))
&& !prefix_match(&rn->p, pfx_match))
continue; continue;
++queries_displayed; ++queries_displayed;
@ -1028,6 +1027,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
char buf_vn[BUFSIZ]; char buf_vn[BUFSIZ];
char buf_lifetime[BUFSIZ]; char buf_lifetime[BUFSIZ];
int nlines = 0; int nlines = 0;
const struct prefix *p = agg_node_get_prefix(rn);
if (!stream) if (!stream)
return 0; /* for debug log, print into buf & call output once */ return 0; /* for debug log, print into buf & call output once */
@ -1040,8 +1040,8 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
*/ */
buf_pfx[0] = 0; buf_pfx[0] = 0;
snprintf(buf_pfx, BUFSIZ, "%s/%d", snprintf(buf_pfx, BUFSIZ, "%s/%d",
rfapi_ntop(rn->p.family, &rn->p.u.prefix, buf_ntop, BUFSIZ), rfapi_ntop(p->family, &p->u.prefix, buf_ntop, BUFSIZ),
rn->p.prefixlen); p->prefixlen);
buf_pfx[BUFSIZ - 1] = 0; buf_pfx[BUFSIZ - 1] = 0;
nlines++; nlines++;
@ -1155,7 +1155,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
} }
fp(out, "%s", HVTYNL); fp(out, "%s", HVTYNL);
if (rn->p.family == AF_ETHERNET) { if (p->family == AF_ETHERNET) {
/* /*
* If there is a corresponding IP address && != VN address, * If there is a corresponding IP address && != VN address,
* print that on the next line * print that on the next line
@ -1221,13 +1221,13 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream,
for (rn = agg_route_top(it->imported_vpn[afi]); rn; for (rn = agg_route_top(it->imported_vpn[afi]); rn;
rn = agg_route_next(rn)) { rn = agg_route_next(rn)) {
const struct prefix *p = agg_node_get_prefix(rn);
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
int count_only; int count_only;
/* allow for wider or more narrow mask from user */ /* allow for wider or more narrow mask from user */
if (prefix_only && !prefix_match(prefix_only, &rn->p) if (prefix_only && !prefix_match(prefix_only, p)
&& !prefix_match(&rn->p, prefix_only)) && !prefix_match(p, prefix_only))
count_only = 1; count_only = 1;
else else
count_only = 0; count_only = 0;
@ -2754,10 +2754,10 @@ static void nve_addr_free(void *hap)
XFREE(MTYPE_RFAPI_NVE_ADDR, hap); XFREE(MTYPE_RFAPI_NVE_ADDR, hap);
} }
static int nve_addr_cmp(void *k1, void *k2) static int nve_addr_cmp(const void *k1, const void *k2)
{ {
struct nve_addr *a = (struct nve_addr *)k1; const struct nve_addr *a = (struct nve_addr *)k1;
struct nve_addr *b = (struct nve_addr *)k2; const struct nve_addr *b = (struct nve_addr *)k2;
int ret = 0; int ret = 0;
if (!a || !b) { if (!a || !b) {

View File

@ -43,7 +43,7 @@ extern void rfapiRprefixApplyMask(struct rfapi_ip_prefix *rprefix);
extern int rfapiQprefix2Raddr(struct prefix *qprefix, extern int rfapiQprefix2Raddr(struct prefix *qprefix,
struct rfapi_ip_addr *raddr); struct rfapi_ip_addr *raddr);
extern void rfapiQprefix2Rprefix(struct prefix *qprefix, extern void rfapiQprefix2Rprefix(const struct prefix *qprefix,
struct rfapi_ip_prefix *rprefix); struct rfapi_ip_prefix *rprefix);
extern int rfapiRprefix2Qprefix(struct rfapi_ip_prefix *rprefix, extern int rfapiRprefix2Qprefix(struct rfapi_ip_prefix *rprefix,

View File

@ -177,7 +177,7 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
{ {
struct attr *attr = bpi->attr; struct attr *attr = bpi->attr;
struct peer *peer = bpi->peer; struct peer *peer = bpi->peer;
struct prefix *prefix = &rn->p; const struct prefix *prefix = agg_node_get_prefix(rn);
afi_t afi = family2afi(prefix->family); afi_t afi = family2afi(prefix->family);
struct bgp_node *urn; struct bgp_node *urn;
struct bgp_path_info *ubpi; struct bgp_path_info *ubpi;
@ -330,7 +330,8 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn,
void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn, void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
struct bgp_path_info *bpi) struct bgp_path_info *bpi)
{ {
afi_t afi = family2afi(rn->p.family); const struct prefix *p = agg_node_get_prefix(rn);
afi_t afi = family2afi(p->family);
struct bgp_path_info *vbpi; struct bgp_path_info *vbpi;
struct prefix ce_nexthop; struct prefix ce_nexthop;
@ -395,8 +396,8 @@ void vnc_direct_bgp_del_route_ce(struct bgp *bgp, struct agg_node *rn,
/* /*
* withdraw the route * withdraw the route
*/ */
bgp_withdraw(bpi->peer, &rn->p, 0, /* addpath_id */ bgp_withdraw(bpi->peer, p, 0, /* addpath_id */
NULL, /* attr, ignored */ NULL, /* attr, ignored */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT, afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */ BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */
NULL, 0, NULL); /* tag not used for unicast */ NULL, 0, NULL); /* tag not used for unicast */
@ -432,17 +433,11 @@ static void vnc_direct_bgp_vpn_enable_ce(struct bgp *bgp, afi_t afi)
*/ */
for (rn = agg_route_top(bgp->rfapi->it_ce->imported_vpn[afi]); rn; for (rn = agg_route_top(bgp->rfapi->it_ce->imported_vpn[afi]); rn;
rn = agg_route_next(rn)) { rn = agg_route_next(rn)) {
if (!rn->info) if (!rn->info)
continue; continue;
{ vnc_zlog_debug_verbose("%s: checking prefix %pRN", __func__,
char prefixstr[PREFIX_STRLEN]; rn);
prefix2str(&rn->p, prefixstr, sizeof(prefixstr));
vnc_zlog_debug_verbose("%s: checking prefix %s",
__func__, prefixstr);
}
for (ri = rn->info; ri; ri = ri->next) { for (ri = rn->info; ri; ri = ri->next) {
@ -698,7 +693,8 @@ void vnc_direct_bgp_add_prefix(struct bgp *bgp,
struct attr attr = {0}; struct attr attr = {0};
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct rfapi_rfg_name *rfgn; struct rfapi_rfg_name *rfgn;
afi_t afi = family2afi(rn->p.family); const struct prefix *p = agg_node_get_prefix(rn);
afi_t afi = family2afi(p->family);
if (!afi) { if (!afi) {
flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of route node", flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi of route node",
@ -769,7 +765,7 @@ void vnc_direct_bgp_add_prefix(struct bgp *bgp,
*/ */
if (rfgn->rfg->plist_export_bgp[afi]) { if (rfgn->rfg->plist_export_bgp[afi]) {
if (prefix_list_apply(rfgn->rfg->plist_export_bgp[afi], if (prefix_list_apply(rfgn->rfg->plist_export_bgp[afi],
&rn->p) p)
== PREFIX_DENY) == PREFIX_DENY)
continue; continue;
@ -808,7 +804,8 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp,
{ {
struct listnode *node, *nnode; struct listnode *node, *nnode;
struct rfapi_rfg_name *rfgn; struct rfapi_rfg_name *rfgn;
afi_t afi = family2afi(rn->p.family); const struct prefix *p = agg_node_get_prefix(rn);
afi_t afi = family2afi(p->family);
if (!afi) { if (!afi) {
flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi route node", flog_err(EC_LIB_DEVELOPMENT, "%s: can't get afi route node",
@ -877,9 +874,9 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp,
if (rfapiRaddr2Qprefix(&irfd->vn_addr, &nhp)) if (rfapiRaddr2Qprefix(&irfd->vn_addr, &nhp))
continue; continue;
bgp_withdraw(irfd->peer, &rn->p, /* prefix */ bgp_withdraw(irfd->peer, p, /* prefix */
0, /* addpath_id */ 0, /* addpath_id */
NULL, /* attr, ignored */ NULL, /* attr, ignored */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT, afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, BGP_ROUTE_REDISTRIBUTE,
NULL, /* RD not used for unicast */ NULL, /* RD not used for unicast */
@ -907,9 +904,9 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp,
if (rfapiRaddr2Qprefix(&irfd->vn_addr, &nhp)) if (rfapiRaddr2Qprefix(&irfd->vn_addr, &nhp))
continue; continue;
bgp_withdraw(irfd->peer, &rn->p, /* prefix */ bgp_withdraw(irfd->peer, p, /* prefix */
0, /* addpath_id */ 0, /* addpath_id */
NULL, /* attr, ignored */ NULL, /* attr, ignored */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT, afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, BGP_ROUTE_REDISTRIBUTE,
NULL, /* RD not used for unicast */ NULL, /* RD not used for unicast */
@ -998,6 +995,8 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
struct attr hattr; struct attr hattr;
struct attr *iattr; struct attr *iattr;
struct bgp_path_info info; struct bgp_path_info info;
const struct prefix *p =
agg_node_get_prefix(rn);
if (rfapiRaddr2Qprefix(&irfd->vn_addr, if (rfapiRaddr2Qprefix(&irfd->vn_addr,
&nhp)) &nhp))
@ -1010,7 +1009,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
if (prefix_list_apply( if (prefix_list_apply(
rfgn->rfg->plist_export_bgp rfgn->rfg->plist_export_bgp
[afi], [afi],
&rn->p) p)
== PREFIX_DENY) == PREFIX_DENY)
continue; continue;
@ -1033,8 +1032,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
ret = route_map_apply( ret = route_map_apply(
rfgn->rfg rfgn->rfg
->routemap_export_bgp, ->routemap_export_bgp,
&rn->p, RMAP_BGP, p, RMAP_BGP, &info);
&info);
if (ret == RMAP_DENYMATCH) { if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr); bgp_attr_flush(&hattr);
continue; continue;
@ -1044,8 +1042,8 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
iattr = bgp_attr_intern(&hattr); iattr = bgp_attr_intern(&hattr);
bgp_attr_flush(&hattr); bgp_attr_flush(&hattr);
bgp_update( bgp_update(
irfd->peer, &rn->p, /* prefix */ irfd->peer, p, /* prefix */
0, /* addpath_id */ 0, /* addpath_id */
iattr, /* bgp_update copies iattr, /* bgp_update copies
it */ it */
afi, SAFI_UNICAST, afi, SAFI_UNICAST,
@ -1134,7 +1132,8 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
rn = agg_route_next(rn)) { rn = agg_route_next(rn)) {
if (rn->info) { if (rn->info) {
const struct prefix *p =
agg_node_get_prefix(rn);
struct prefix nhp; struct prefix nhp;
struct rfapi_descriptor *irfd = rfd; struct rfapi_descriptor *irfd = rfd;
@ -1142,10 +1141,9 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
&nhp)) &nhp))
continue; continue;
bgp_withdraw(irfd->peer, bgp_withdraw(irfd->peer, p, /* prefix */
&rn->p, /* prefix */ 0, /* addpath_id */
0, /* addpath_id */ NULL, /* attr, ignored */
NULL, /* attr, ignored */
afi, SAFI_UNICAST, afi, SAFI_UNICAST,
ZEBRA_ROUTE_VNC_DIRECT, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, BGP_ROUTE_REDISTRIBUTE,
@ -1169,6 +1167,7 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
struct bgp_path_info info; struct bgp_path_info info;
struct attr hattr; struct attr hattr;
struct attr *iattr; struct attr *iattr;
const struct prefix *p = agg_node_get_prefix(rn);
if (irfd == NULL && rfg->type != RFAPI_GROUP_CFG_VRF) { if (irfd == NULL && rfg->type != RFAPI_GROUP_CFG_VRF) {
/* need new rfapi_handle, for peer strcture /* need new rfapi_handle, for peer strcture
@ -1242,8 +1241,8 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
info.peer = irfd->peer; info.peer = irfd->peer;
info.attr = &hattr; info.attr = &hattr;
ret = route_map_apply(rfg->routemap_export_bgp, &rn->p, ret = route_map_apply(rfg->routemap_export_bgp, p, RMAP_BGP,
RMAP_BGP, &info); &info);
if (ret == RMAP_DENYMATCH) { if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr); bgp_attr_flush(&hattr);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
@ -1261,9 +1260,9 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
iattr = bgp_attr_intern(&hattr); iattr = bgp_attr_intern(&hattr);
bgp_attr_flush(&hattr); bgp_attr_flush(&hattr);
bgp_update(irfd->peer, &rn->p, /* prefix */ bgp_update(irfd->peer, p, /* prefix */
0, /* addpath_id */ 0, /* addpath_id */
iattr, /* bgp_update copies it */ iattr, /* bgp_update copies it */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT, afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */ BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */
NULL, /* tag not used for unicast */ NULL, /* tag not used for unicast */
@ -1317,7 +1316,7 @@ static void vnc_direct_bgp_add_group_afi(struct bgp *bgp,
for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) { for (rn = agg_route_top(rt); rn; rn = agg_route_next(rn)) {
if (rn->info) { if (rn->info) {
const struct prefix *p = agg_node_get_prefix(rn);
struct listnode *ln; struct listnode *ln;
/* /*
@ -1325,7 +1324,7 @@ static void vnc_direct_bgp_add_group_afi(struct bgp *bgp,
*/ */
if (rfg->plist_export_bgp[afi]) { if (rfg->plist_export_bgp[afi]) {
if (prefix_list_apply( if (prefix_list_apply(
rfg->plist_export_bgp[afi], &rn->p) rfg->plist_export_bgp[afi], p)
== PREFIX_DENY) == PREFIX_DENY)
continue; continue;
@ -1374,9 +1373,10 @@ static void vnc_direct_del_rn_group_rd(struct bgp *bgp,
{ {
if (irfd == NULL) if (irfd == NULL)
return; return;
bgp_withdraw(irfd->peer, &rn->p, /* prefix */
0, /* addpath_id */ bgp_withdraw(irfd->peer, agg_node_get_prefix(rn), /* prefix */
NULL, /* attr, ignored */ 0, /* addpath_id */
NULL, /* attr, ignored */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT, afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */ BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */
NULL, 0, NULL); /* tag not used for unicast */ NULL, 0, NULL); /* tag not used for unicast */
@ -1493,9 +1493,9 @@ static void vnc_direct_bgp_unexport_table(afi_t afi, struct agg_table *rt,
irfd)) { irfd)) {
bgp_withdraw(irfd->peer, bgp_withdraw(irfd->peer,
&rn->p, /* prefix */ agg_node_get_prefix(rn),
0, /* addpath_id */ 0, /* addpath_id */
NULL, /* attr, ignored */ NULL, /* attr, ignored */
afi, SAFI_UNICAST, afi, SAFI_UNICAST,
ZEBRA_ROUTE_VNC_DIRECT, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE, BGP_ROUTE_REDISTRIBUTE,
@ -1633,7 +1633,7 @@ void vnc_direct_bgp_vpn_disable(struct bgp *bgp, afi_t afi)
* caller do it? * caller do it?
*/ */
void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi, void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
struct prefix *prefix, struct peer *peer, const struct prefix *prefix, struct peer *peer,
struct attr *attr) struct attr *attr)
{ {
struct vnc_export_info *eti; struct vnc_export_info *eti;
@ -1732,13 +1732,14 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
static int vncExportWithdrawTimer(struct thread *t) static int vncExportWithdrawTimer(struct thread *t)
{ {
struct vnc_export_info *eti = t->arg; struct vnc_export_info *eti = t->arg;
const struct prefix *p = agg_node_get_prefix(eti->node);
/* /*
* withdraw the route * withdraw the route
*/ */
bgp_withdraw(eti->peer, &eti->node->p, 0, /* addpath_id */ bgp_withdraw(eti->peer, p, 0, /* addpath_id */
NULL, /* attr, ignored */ NULL, /* attr, ignored */
family2afi(eti->node->p.family), SAFI_UNICAST, eti->type, family2afi(p->family), SAFI_UNICAST, eti->type,
eti->subtype, NULL, /* RD not used for unicast */ eti->subtype, NULL, /* RD not used for unicast */
NULL, 0, NULL, 0,
NULL); /* tag not used for unicast, EVPN neither */ NULL); /* tag not used for unicast, EVPN neither */
@ -1757,7 +1758,7 @@ static int vncExportWithdrawTimer(struct thread *t)
* caller do it? * caller do it?
*/ */
void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi, void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
struct prefix *prefix, struct peer *peer) const struct prefix *prefix, struct peer *peer)
{ {
struct vnc_export_info *eti; struct vnc_export_info *eti;

View File

@ -61,12 +61,12 @@ extern void vnc_direct_bgp_reexport_group_afi(struct bgp *bgp,
extern void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi, extern void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
struct prefix *prefix, const struct prefix *prefix,
struct peer *peer, struct attr *attr); struct peer *peer, struct attr *attr);
extern void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi, extern void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi,
struct prefix *prefix, const struct prefix *prefix,
struct peer *peer); struct peer *peer);
extern void vnc_direct_bgp_reexport(struct bgp *bgp, afi_t afi); extern void vnc_direct_bgp_reexport(struct bgp *bgp, afi_t afi);

View File

@ -34,7 +34,7 @@
#include "bgpd/rfapi/vnc_debug.h" #include "bgpd/rfapi/vnc_debug.h"
struct agg_node *vnc_etn_get(struct bgp *bgp, vnc_export_type_t type, struct agg_node *vnc_etn_get(struct bgp *bgp, vnc_export_type_t type,
struct prefix *p) const struct prefix *p)
{ {
struct agg_table *t = NULL; struct agg_table *t = NULL;
struct agg_node *rn = NULL; struct agg_node *rn = NULL;
@ -66,7 +66,7 @@ struct agg_node *vnc_etn_get(struct bgp *bgp, vnc_export_type_t type,
} }
struct agg_node *vnc_etn_lookup(struct bgp *bgp, vnc_export_type_t type, struct agg_node *vnc_etn_lookup(struct bgp *bgp, vnc_export_type_t type,
struct prefix *p) const struct prefix *p)
{ {
struct agg_table *t = NULL; struct agg_table *t = NULL;
struct agg_node *rn = NULL; struct agg_node *rn = NULL;
@ -98,7 +98,7 @@ struct agg_node *vnc_etn_lookup(struct bgp *bgp, vnc_export_type_t type,
} }
struct vnc_export_info *vnc_eti_get(struct bgp *bgp, vnc_export_type_t etype, struct vnc_export_info *vnc_eti_get(struct bgp *bgp, vnc_export_type_t etype,
struct prefix *p, struct peer *peer, const struct prefix *p, struct peer *peer,
uint8_t type, uint8_t subtype) uint8_t type, uint8_t subtype)
{ {
struct agg_node *etn; struct agg_node *etn;

View File

@ -46,15 +46,14 @@ struct vnc_export_info {
}; };
extern struct agg_node *vnc_etn_get(struct bgp *bgp, vnc_export_type_t type, extern struct agg_node *vnc_etn_get(struct bgp *bgp, vnc_export_type_t type,
struct prefix *p); const struct prefix *p);
extern struct agg_node *vnc_etn_lookup(struct bgp *bgp, vnc_export_type_t type, extern struct agg_node *vnc_etn_lookup(struct bgp *bgp, vnc_export_type_t type,
struct prefix *p); const struct prefix *p);
extern struct vnc_export_info *vnc_eti_get(struct bgp *bgp, extern struct vnc_export_info *
vnc_export_type_t etype, vnc_eti_get(struct bgp *bgp, vnc_export_type_t etype, const struct prefix *p,
struct prefix *p, struct peer *peer, struct peer *peer, uint8_t type, uint8_t subtype);
uint8_t type, uint8_t subtype);
extern void vnc_eti_delete(struct vnc_export_info *goner); extern void vnc_eti_delete(struct vnc_export_info *goner);

View File

@ -104,7 +104,7 @@ uint32_t calc_local_pref(struct attr *attr, struct peer *peer)
return local_pref; return local_pref;
} }
static int is_host_prefix(struct prefix *p) static int is_host_prefix(const struct prefix *p)
{ {
switch (p->family) { switch (p->family) {
case AF_INET: case AF_INET:
@ -128,14 +128,14 @@ struct prefix_bag {
static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
0xf8, 0xfc, 0xfe, 0xff}; 0xf8, 0xfc, 0xfe, 0xff};
int vnc_prefix_cmp(void *pfx1, void *pfx2) int vnc_prefix_cmp(const void *pfx1, const void *pfx2)
{ {
int offset; int offset;
int shift; int shift;
uint8_t mask; uint8_t mask;
struct prefix *p1 = pfx1; const struct prefix *p1 = pfx1;
struct prefix *p2 = pfx2; const struct prefix *p2 = pfx2;
if (p1->family < p2->family) if (p1->family < p2->family)
return -1; return -1;
@ -299,9 +299,9 @@ static void vnc_rhnck(char *tag)
*/ */
static int process_unicast_route(struct bgp *bgp, /* in */ static int process_unicast_route(struct bgp *bgp, /* in */
afi_t afi, /* in */ afi_t afi, /* in */
struct prefix *prefix, /* in */ const struct prefix *prefix, /* in */
struct bgp_path_info *info, /* in */ struct bgp_path_info *info, /* in */
struct ecommunity **ecom, /* OUT */ struct ecommunity **ecom, /* OUT */
struct prefix *unicast_nexthop) /* OUT */ struct prefix *unicast_nexthop) /* OUT */
{ {
struct rfapi_cfg *hc = bgp->rfapi_cfg; struct rfapi_cfg *hc = bgp->rfapi_cfg;
@ -425,10 +425,10 @@ static int process_unicast_route(struct bgp *bgp, /* in */
static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi( static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */ struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */
struct prefix_rd *prd, /* RD */ struct prefix_rd *prd, /* RD */
struct prefix *prefix, /* unicast route prefix */ const struct prefix *prefix, /* unicast route prefix */
uint32_t *local_pref, /* NULL = no local_pref */ uint32_t *local_pref, /* NULL = no local_pref */
uint32_t *med, /* NULL = no med */ uint32_t *med, /* NULL = no med */
struct ecommunity *ecom) /* generated ecoms */ struct ecommunity *ecom) /* generated ecoms */
{ {
struct prefix un; struct prefix un;
struct prefix nexthop; struct prefix nexthop;
@ -509,11 +509,12 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi(
} }
static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd( static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
struct prefix_rd *prd, /* RD */ struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */ struct bgp_table *table_rd, /* per-rd VPN route table */
afi_t afi, struct bgp *bgp, struct prefix *prefix, /* unicast prefix */ afi_t afi, struct bgp *bgp,
struct ecommunity *ecom, /* generated ecoms */ const struct prefix *prefix, /* unicast prefix */
uint32_t *local_pref, /* NULL = no local_pref */ struct ecommunity *ecom, /* generated ecoms */
uint32_t *local_pref, /* NULL = no local_pref */
uint32_t *med, /* NULL = no med */ uint32_t *med, /* NULL = no med */
struct prefix *ubpi_nexthop) /* unicast nexthop */ struct prefix *ubpi_nexthop) /* unicast nexthop */
{ {
@ -552,8 +553,8 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_rd(
} }
static void vnc_import_bgp_add_route_mode_resolve_nve( static void vnc_import_bgp_add_route_mode_resolve_nve(
struct bgp *bgp, struct prefix *prefix, /* unicast prefix */ struct bgp *bgp, const struct prefix *prefix, /* unicast prefix */
struct bgp_path_info *info) /* unicast info */ struct bgp_path_info *info) /* unicast info */
{ {
afi_t afi = family2afi(prefix->family); afi_t afi = family2afi(prefix->family);
@ -686,7 +687,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve(
static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp, static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
struct prefix *prefix, const struct prefix *prefix,
struct bgp_path_info *info) struct bgp_path_info *info)
{ {
afi_t afi = family2afi(prefix->family); afi_t afi = family2afi(prefix->family);
@ -874,10 +875,9 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
ecommunity_free(&ecom); ecommunity_free(&ecom);
} }
static void static void vnc_import_bgp_add_route_mode_nvegroup(
vnc_import_bgp_add_route_mode_nvegroup(struct bgp *bgp, struct prefix *prefix, struct bgp *bgp, const struct prefix *prefix,
struct bgp_path_info *info, struct bgp_path_info *info, struct rfapi_nve_group_cfg *rfg)
struct rfapi_nve_group_cfg *rfg)
{ {
afi_t afi = family2afi(prefix->family); afi_t afi = family2afi(prefix->family);
struct peer *peer = info->peer; struct peer *peer = info->peer;
@ -1080,7 +1080,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, static void vnc_import_bgp_del_route_mode_plain(struct bgp *bgp,
struct prefix *prefix, const struct prefix *prefix,
struct bgp_path_info *info) struct bgp_path_info *info)
{ {
struct prefix_rd prd; struct prefix_rd prd;
@ -1153,7 +1153,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, static void vnc_import_bgp_del_route_mode_nvegroup(struct bgp *bgp,
struct prefix *prefix, const struct prefix *prefix,
struct bgp_path_info *info) struct bgp_path_info *info)
{ {
struct prefix_rd prd; struct prefix_rd prd;
@ -1236,7 +1236,7 @@ static void vnc_import_bgp_del_route_mode_nvegroup(struct bgp *bgp,
static void vnc_import_bgp_del_route_mode_resolve_nve_one_bi( static void vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */ struct bgp *bgp, afi_t afi, struct bgp_path_info *bpi, /* VPN bpi */
struct prefix_rd *prd, /* RD */ struct prefix_rd *prd, /* RD */
struct prefix *prefix) /* unicast route prefix */ const struct prefix *prefix) /* unicast route prefix */
{ {
struct prefix un; struct prefix un;
@ -1272,8 +1272,9 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_bi(
static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd( static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
struct prefix_rd *prd, struct prefix_rd *prd,
struct bgp_table *table_rd, /* per-rd VPN route table */ struct bgp_table *table_rd, /* per-rd VPN route table */
afi_t afi, struct bgp *bgp, struct prefix *prefix, /* unicast prefix */ afi_t afi, struct bgp *bgp,
struct prefix *ubpi_nexthop) /* unicast bpi's nexthop */ const struct prefix *prefix, /* unicast prefix */
const struct prefix *ubpi_nexthop) /* unicast bpi's nexthop */
{ {
struct bgp_node *bn; struct bgp_node *bn;
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
@ -1312,7 +1313,7 @@ static void vnc_import_bgp_del_route_mode_resolve_nve_one_rd(
static void static void
vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi, vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi,
struct prefix *prefix, const struct prefix *prefix,
struct bgp_path_info *info) struct bgp_path_info *info)
{ {
struct ecommunity *ecom = NULL; struct ecommunity *ecom = NULL;
@ -1396,7 +1397,7 @@ vnc_import_bgp_del_route_mode_resolve_nve(struct bgp *bgp, afi_t afi,
void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve( void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */ struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */ struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */ const struct prefix *prefix, /* VPN prefix */
struct bgp_path_info *bpi) /* new VPN host route */ struct bgp_path_info *bpi) /* new VPN host route */
{ {
afi_t afi = family2afi(prefix->family); afi_t afi = family2afi(prefix->family);
@ -1533,7 +1534,7 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve( void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */ struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */ struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */ const struct prefix *prefix, /* VPN prefix */
struct bgp_path_info *bpi) /* old VPN host route */ struct bgp_path_info *bpi) /* old VPN host route */
{ {
afi_t afi = family2afi(prefix->family); afi_t afi = family2afi(prefix->family);
@ -1675,8 +1676,8 @@ static int is_usable_interior_route(struct bgp_path_info *bpi_interior)
*/ */
static void vnc_import_bgp_exterior_add_route_it( static void vnc_import_bgp_exterior_add_route_it(
struct bgp *bgp, /* exterior instance, we hope */ struct bgp *bgp, /* exterior instance, we hope */
struct prefix *prefix, /* unicast prefix */ const struct prefix *prefix, /* unicast prefix */
struct bgp_path_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_import_table *it_only) /* NULL, or limit to this IT */
{ {
struct rfapi *h; struct rfapi *h;
@ -1844,9 +1845,9 @@ static void vnc_import_bgp_exterior_add_route_it(
} }
void vnc_import_bgp_exterior_add_route( void vnc_import_bgp_exterior_add_route(
struct bgp *bgp, /* exterior instance, we hope */ struct bgp *bgp, /* exterior instance, we hope */
struct prefix *prefix, /* unicast prefix */ const struct prefix *prefix, /* unicast prefix */
struct bgp_path_info *info) /* unicast info */ struct bgp_path_info *info) /* unicast info */
{ {
vnc_import_bgp_exterior_add_route_it(bgp, prefix, info, NULL); vnc_import_bgp_exterior_add_route_it(bgp, prefix, info, NULL);
} }
@ -1861,8 +1862,8 @@ void vnc_import_bgp_exterior_add_route(
* right routes. * right routes.
*/ */
void vnc_import_bgp_exterior_del_route( void vnc_import_bgp_exterior_del_route(
struct bgp *bgp, struct prefix *prefix, /* unicast prefix */ struct bgp *bgp, const struct prefix *prefix, /* unicast prefix */
struct bgp_path_info *info) /* unicast info */ struct bgp_path_info *info) /* unicast info */
{ {
struct rfapi *h; struct rfapi *h;
struct rfapi_cfg *hc; struct rfapi_cfg *hc;
@ -2027,7 +2028,8 @@ void vnc_import_bgp_exterior_add_route_interior(
struct agg_node *rn_interior, /* VPN IT node */ struct agg_node *rn_interior, /* VPN IT node */
struct bgp_path_info *bpi_interior) /* VPN IT route */ struct bgp_path_info *bpi_interior) /* VPN IT route */
{ {
afi_t afi = family2afi(rn_interior->p.family); const struct prefix *p = agg_node_get_prefix(rn_interior);
afi_t afi = family2afi(p->family);
struct agg_node *par; struct agg_node *par;
struct bgp_path_info *bpi_exterior; struct bgp_path_info *bpi_exterior;
struct prefix *pfx_exterior; /* exterior pfx */ struct prefix *pfx_exterior; /* exterior pfx */
@ -2057,13 +2059,8 @@ void vnc_import_bgp_exterior_add_route_interior(
} }
/*debugging */ /*debugging */
{ vnc_zlog_debug_verbose("%s: interior prefix=%pRN, bpi type=%d",
char str_pfx[PREFIX_STRLEN]; __func__, rn_interior, bpi_interior->type);
prefix2str(&rn_interior->p, str_pfx, sizeof(str_pfx));
vnc_zlog_debug_verbose("%s: interior prefix=%s, bpi type=%d",
__func__, str_pfx, bpi_interior->type);
}
if (RFAPI_HAS_MONITOR_EXTERIOR(rn_interior)) { if (RFAPI_HAS_MONITOR_EXTERIOR(rn_interior)) {
@ -2178,7 +2175,7 @@ void vnc_import_bgp_exterior_add_route_interior(
rfapiUnicastNexthop2Prefix(afi, bpi_exterior->attr, rfapiUnicastNexthop2Prefix(afi, bpi_exterior->attr,
&pfx_nexthop); &pfx_nexthop);
if (prefix_match(&rn_interior->p, &pfx_nexthop)) { if (prefix_match(p, &pfx_nexthop)) {
struct bgp_path_info *bpi; struct bgp_path_info *bpi;
struct prefix_rd *prd; struct prefix_rd *prd;
@ -2321,7 +2318,7 @@ void vnc_import_bgp_exterior_add_route_interior(
rfapiUnicastNexthop2Prefix(afi, bpi_exterior->attr, rfapiUnicastNexthop2Prefix(afi, bpi_exterior->attr,
&pfx_nexthop); &pfx_nexthop);
if (prefix_match(&rn_interior->p, &pfx_nexthop)) { if (prefix_match(p, &pfx_nexthop)) {
struct prefix_rd *prd; struct prefix_rd *prd;
struct attr new_attr; struct attr new_attr;
@ -2409,7 +2406,8 @@ void vnc_import_bgp_exterior_del_route_interior(
struct agg_node *rn_interior, /* VPN IT node */ struct agg_node *rn_interior, /* VPN IT node */
struct bgp_path_info *bpi_interior) /* VPN IT route */ struct bgp_path_info *bpi_interior) /* VPN IT route */
{ {
afi_t afi = family2afi(rn_interior->p.family); const struct prefix *p = agg_node_get_prefix(rn_interior);
afi_t afi = family2afi(p->family);
struct agg_node *par; struct agg_node *par;
struct bgp_path_info *bpi_exterior; struct bgp_path_info *bpi_exterior;
struct prefix *pfx_exterior; /* exterior pfx */ struct prefix *pfx_exterior; /* exterior pfx */
@ -2443,14 +2441,8 @@ void vnc_import_bgp_exterior_del_route_interior(
} }
/*debugging */ /*debugging */
{ vnc_zlog_debug_verbose("%s: interior prefix=%pRN, bpi type=%d",
char str_pfx[PREFIX_STRLEN]; __func__, rn_interior, bpi_interior->type);
prefix2str(&rn_interior->p, str_pfx, sizeof(str_pfx));
vnc_zlog_debug_verbose("%s: interior prefix=%s, bpi type=%d",
__func__, str_pfx, bpi_interior->type);
}
/* /*
* Remove constructed routes based on the deleted interior route * Remove constructed routes based on the deleted interior route
@ -2597,7 +2589,7 @@ void vnc_import_bgp_exterior_del_route_interior(
* Generic add/delete unicast routes * Generic add/delete unicast routes
***********************************************************************/ ***********************************************************************/
void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix, void vnc_import_bgp_add_route(struct bgp *bgp, const struct prefix *prefix,
struct bgp_path_info *info) struct bgp_path_info *info)
{ {
afi_t afi = family2afi(prefix->family); afi_t afi = family2afi(prefix->family);
@ -2666,7 +2658,7 @@ void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
/* /*
* "Withdrawing a Route" import process * "Withdrawing a Route" import process
*/ */
void vnc_import_bgp_del_route(struct bgp *bgp, struct prefix *prefix, void vnc_import_bgp_del_route(struct bgp *bgp, const struct prefix *prefix,
struct bgp_path_info *info) /* unicast info */ struct bgp_path_info *info) /* unicast info */
{ {
afi_t afi = family2afi(prefix->family); afi_t afi = family2afi(prefix->family);

View File

@ -32,12 +32,14 @@
extern uint32_t calc_local_pref(struct attr *attr, struct peer *peer); extern uint32_t calc_local_pref(struct attr *attr, struct peer *peer);
extern int vnc_prefix_cmp(void *pfx1, void *pfx2); extern int vnc_prefix_cmp(const void *pfx1, const void *pfx2);
extern void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix, extern void vnc_import_bgp_add_route(struct bgp *bgp,
const struct prefix *prefix,
struct bgp_path_info *info); struct bgp_path_info *info);
extern void vnc_import_bgp_del_route(struct bgp *bgp, struct prefix *prefix, extern void vnc_import_bgp_del_route(struct bgp *bgp,
const struct prefix *prefix,
struct bgp_path_info *info); struct bgp_path_info *info);
extern void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi); extern void vnc_import_bgp_redist_enable(struct bgp *bgp, afi_t afi);
@ -51,23 +53,23 @@ extern void vnc_import_bgp_exterior_redist_disable(struct bgp *bgp, afi_t afi);
extern void vnc_import_bgp_exterior_add_route( extern void vnc_import_bgp_exterior_add_route(
struct bgp *bgp, /* exterior instance, we hope */ struct bgp *bgp, /* exterior instance, we hope */
struct prefix *prefix, /* unicast prefix */ const struct prefix *prefix, /* unicast prefix */
struct bgp_path_info *info); /* unicast info */ struct bgp_path_info *info); /* unicast info */
extern void vnc_import_bgp_exterior_del_route( extern void vnc_import_bgp_exterior_del_route(
struct bgp *bgp, struct prefix *prefix, /* unicast prefix */ struct bgp *bgp, const struct prefix *prefix, /* unicast prefix */
struct bgp_path_info *info); /* unicast info */ struct bgp_path_info *info); /* unicast info */
extern void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve( extern void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */ struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */ struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */ const struct prefix *prefix, /* VPN prefix */
struct bgp_path_info *bpi); /* new VPN host route */ struct bgp_path_info *bpi); /* new VPN host route */
extern void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve( extern void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct bgp *bgp, struct prefix_rd *prd, /* RD */ struct bgp *bgp, struct prefix_rd *prd, /* RD */
struct bgp_table *table_rd, /* per-rd VPN route table */ struct bgp_table *table_rd, /* per-rd VPN route table */
struct prefix *prefix, /* VPN prefix */ const struct prefix *prefix, /* VPN prefix */
struct bgp_path_info *bpi); /* old VPN host route */ struct bgp_path_info *bpi); /* old VPN host route */
#endif /* _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_ */ #endif /* _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_ */

View File

@ -380,7 +380,7 @@ static int vnc_zebra_read_route(ZAPI_CALLBACK_ARGS)
/* /*
* low-level message builder * low-level message builder
*/ */
static void vnc_zebra_route_msg(struct prefix *p, unsigned int nhp_count, static void vnc_zebra_route_msg(const struct prefix *p, unsigned int nhp_count,
void *nhp_ary, int add) /* 1 = add, 0 = del */ void *nhp_ary, int add) /* 1 = add, 0 = del */
{ {
struct zapi_route api; struct zapi_route api;
@ -560,7 +560,7 @@ static void vnc_zebra_add_del_prefix(struct bgp *bgp,
int add) /* !0 = add, 0 = del */ int add) /* !0 = add, 0 = del */
{ {
struct list *nves; struct list *nves;
const struct prefix *p = agg_node_get_prefix(rn);
unsigned int nexthop_count = 0; unsigned int nexthop_count = 0;
void *nh_ary = NULL; void *nh_ary = NULL;
void *nhp_ary = NULL; void *nhp_ary = NULL;
@ -570,15 +570,15 @@ static void vnc_zebra_add_del_prefix(struct bgp *bgp,
if (zclient_vnc->sock < 0) if (zclient_vnc->sock < 0)
return; return;
if (rn->p.family != AF_INET && rn->p.family != AF_INET6) { if (p->family != AF_INET && p->family != AF_INET6) {
flog_err(EC_LIB_DEVELOPMENT, flog_err(EC_LIB_DEVELOPMENT,
"%s: invalid route node addr family", __func__); "%s: invalid route node addr family", __func__);
return; return;
} }
if (!vrf_bitmap_check(zclient_vnc->redist[family2afi(rn->p.family)] if (!vrf_bitmap_check(
[ZEBRA_ROUTE_VNC], zclient_vnc->redist[family2afi(p->family)][ZEBRA_ROUTE_VNC],
VRF_DEFAULT)) VRF_DEFAULT))
return; return;
if (!bgp->rfapi_cfg) { if (!bgp->rfapi_cfg) {
@ -592,17 +592,16 @@ static void vnc_zebra_add_del_prefix(struct bgp *bgp,
return; return;
} }
import_table_to_nve_list_zebra(bgp, import_table, &nves, rn->p.family); import_table_to_nve_list_zebra(bgp, import_table, &nves, p->family);
if (nves) { if (nves) {
nve_list_to_nh_array(rn->p.family, nves, &nexthop_count, nve_list_to_nh_array(p->family, nves, &nexthop_count, &nh_ary,
&nh_ary, &nhp_ary); &nhp_ary);
list_delete(&nves); list_delete(&nves);
if (nexthop_count) if (nexthop_count)
vnc_zebra_route_msg(&rn->p, nexthop_count, nhp_ary, vnc_zebra_route_msg(p, nexthop_count, nhp_ary, add);
add);
} }
XFREE(MTYPE_TMP, nhp_ary); XFREE(MTYPE_TMP, nhp_ary);
@ -695,15 +694,14 @@ static void vnc_zebra_add_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd,
*/ */
for (rn = agg_route_top(rt); rn; for (rn = agg_route_top(rt); rn;
rn = agg_route_next(rn)) { rn = agg_route_next(rn)) {
if (!rn->info)
continue;
if (rn->info) { vnc_zlog_debug_verbose("%s: sending %s",
__func__,
vnc_zlog_debug_verbose( (add ? "add" : "del"));
"%s: sending %s", __func__, vnc_zebra_route_msg(agg_node_get_prefix(rn), 1,
(add ? "add" : "del")); &pAddr, add);
vnc_zebra_route_msg(&rn->p, 1, &pAddr,
add);
}
} }
} }
} }
@ -778,9 +776,9 @@ static void vnc_zebra_add_del_group_afi(struct bgp *bgp,
for (rn = agg_route_top(rt); rn; for (rn = agg_route_top(rt); rn;
rn = agg_route_next(rn)) { rn = agg_route_next(rn)) {
if (rn->info) { if (rn->info) {
vnc_zebra_route_msg(&rn->p, vnc_zebra_route_msg(
nexthop_count, agg_node_get_prefix(rn),
nhp_ary, add); nexthop_count, nhp_ary, add);
} }
} }
} }

View File

@ -122,9 +122,9 @@ static bool neighbor_entry_hash_cmp(const void *a, const void *b)
return memcmp(na->id, nb->id, sizeof(na->id)) == 0; return memcmp(na->id, nb->id, sizeof(na->id)) == 0;
} }
static int neighbor_entry_list_cmp(void *a, void *b) static int neighbor_entry_list_cmp(const void *a, const void *b)
{ {
struct neighbor_entry *na = a, *nb = b; const struct neighbor_entry *na = a, *nb = b;
return -memcmp(na->id, nb->id, sizeof(na->id)); return -memcmp(na->id, nb->id, sizeof(na->id));
} }

View File

@ -117,11 +117,11 @@ static bool isis_vertex_queue_hash_cmp(const void *a, const void *b)
* Compares vertizes for sorting in the TENT list. Returns true * Compares vertizes for sorting in the TENT list. Returns true
* if candidate should be considered before current, false otherwise. * if candidate should be considered before current, false otherwise.
*/ */
__attribute__((__unused__)) __attribute__((__unused__)) static int isis_vertex_queue_tent_cmp(const void *a,
static int isis_vertex_queue_tent_cmp(void *a, void *b) const void *b)
{ {
struct isis_vertex *va = a; const struct isis_vertex *va = a;
struct isis_vertex *vb = b; const struct isis_vertex *vb = b;
if (va->d_N < vb->d_N) if (va->d_N < vb->d_N)
return -1; return -1;

View File

@ -155,6 +155,12 @@ static inline struct agg_table *agg_get_table(struct agg_node *node)
return (struct agg_table *)route_table_get_info(node->table); return (struct agg_table *)route_table_get_info(node->table);
} }
static inline const struct prefix *
agg_node_get_prefix(const struct agg_node *node)
{
return &node->p;
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -112,7 +112,7 @@ static int randomLevel(void)
return level; return level;
} }
static int default_cmp(void *key1, void *key2) static int default_cmp(const void *key1, const void *key2)
{ {
if (key1 < key2) if (key1 < key2)
return -1; return -1;
@ -126,7 +126,8 @@ unsigned int skiplist_count(struct skiplist *l)
return l->count; return l->count;
} }
struct skiplist *skiplist_new(int flags, int (*cmp)(void *key1, void *key2), struct skiplist *skiplist_new(int flags,
int (*cmp)(const void *key1, const void *key2),
void (*del)(void *val)) void (*del)(void *val))
{ {
struct skiplist *new; struct skiplist *new;
@ -329,8 +330,8 @@ int skiplist_delete(register struct skiplist *l, register void *key,
* Also set a cursor for use with skiplist_next_value. * Also set a cursor for use with skiplist_next_value.
*/ */
int skiplist_first_value(register struct skiplist *l, /* in */ int skiplist_first_value(register struct skiplist *l, /* in */
register void *key, /* in */ register const void *key, /* in */
void **valuePointer, /* out */ void **valuePointer, /* out */
void **cursor) /* out */ void **cursor) /* out */
{ {
register int k; register int k;
@ -374,7 +375,7 @@ int skiplist_search(register struct skiplist *l, register void *key,
* last element with the given key, -1 is returned. * last element with the given key, -1 is returned.
*/ */
int skiplist_next_value(register struct skiplist *l, /* in */ int skiplist_next_value(register struct skiplist *l, /* in */
register void *key, /* in */ register const void *key, /* in */
void **valuePointer, /* in/out */ void **valuePointer, /* in/out */
void **cursor) /* in/out */ void **cursor) /* in/out */
{ {

View File

@ -68,7 +68,7 @@ struct skiplist {
* Returns -1 if val1 < val2, 0 if equal?, 1 if val1 > val2. * Returns -1 if val1 < val2, 0 if equal?, 1 if val1 > val2.
* Used as definition of sorted for listnode_add_sort * Used as definition of sorted for listnode_add_sort
*/ */
int (*cmp)(void *val1, void *val2); int (*cmp)(const void *val1, const void *val2);
/* callback to free user-owned data when listnode is deleted. supplying /* callback to free user-owned data when listnode is deleted. supplying
* this callback is very much encouraged! * this callback is very much encouraged!
@ -81,8 +81,9 @@ struct skiplist {
extern struct skiplist * extern struct skiplist *
skiplist_new(/* encouraged: set list.del callback on new lists */ skiplist_new(/* encouraged: set list.del callback on new lists */
int flags, int flags,
int (*cmp)(void *key1, void *key2), /* NULL => default cmp */ int (*cmp)(const void *key1,
void (*del)(void *val)); /* NULL => no auto val free */ const void *key2), /* NULL => default cmp */
void (*del)(void *val)); /* NULL => no auto val free */
extern void skiplist_free(struct skiplist *); extern void skiplist_free(struct skiplist *);
@ -96,12 +97,12 @@ extern int skiplist_search(register struct skiplist *l, register void *key,
void **valuePointer); void **valuePointer);
extern int skiplist_first_value(register struct skiplist *l, /* in */ extern int skiplist_first_value(register struct skiplist *l, /* in */
register void *key, /* in */ register const void *key, /* in */
void **valuePointer, /* in/out */ void **valuePointer, /* in/out */
void **cursor); /* out */ void **cursor); /* out */
extern int skiplist_next_value(register struct skiplist *l, /* in */ extern int skiplist_next_value(register struct skiplist *l, /* in */
register void *key, /* in */ register const void *key, /* in */
void **valuePointer, /* in/out */ void **valuePointer, /* in/out */
void **cursor); /* in/out */ void **cursor); /* in/out */

View File

@ -867,17 +867,12 @@ int ripng_network_write(struct vty *vty, struct ripng *ripng)
unsigned int i; unsigned int i;
const char *ifname; const char *ifname;
struct agg_node *node; struct agg_node *node;
char buf[BUFSIZ];
/* Write enable network. */ /* Write enable network. */
for (node = agg_route_top(ripng->enable_network); node; for (node = agg_route_top(ripng->enable_network); node;
node = agg_route_next(node)) node = agg_route_next(node))
if (node->info) { if (node->info)
struct prefix *p = &node->p; vty_out(vty, " %pRN\n", node);
vty_out(vty, " %s/%d\n",
inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
p->prefixlen);
}
/* Write enable interface. */ /* Write enable interface. */
for (i = 0; i < vector_active(ripng->enable_if); i++) for (i = 0; i < vector_active(ripng->enable_if); i++)

View File

@ -158,7 +158,8 @@ int ripngd_instance_state_routes_route_get_keys(const void *list_entry,
const struct agg_node *rn = list_entry; const struct agg_node *rn = list_entry;
keys->num = 1; keys->num = 1;
(void)prefix2str(&rn->p, keys->key[0], sizeof(keys->key[0])); (void)prefix2str(agg_node_get_prefix(rn), keys->key[0],
sizeof(keys->key[0]));
return NB_OK; return NB_OK;
} }
@ -191,7 +192,7 @@ ripngd_instance_state_routes_route_prefix_get_elem(const char *xpath,
const struct agg_node *rn = list_entry; const struct agg_node *rn = list_entry;
const struct ripng_info *rinfo = listnode_head(rn->info); const struct ripng_info *rinfo = listnode_head(rn->info);
return yang_data_new_ipv6p(xpath, &rinfo->rp->p); return yang_data_new_ipv6p(xpath, agg_node_get_prefix(rinfo->rp));
} }
/* /*

View File

@ -46,12 +46,13 @@ static void ripng_zebra_ipv6_send(struct ripng *ripng, struct agg_node *rp,
struct listnode *listnode = NULL; struct listnode *listnode = NULL;
struct ripng_info *rinfo = NULL; struct ripng_info *rinfo = NULL;
int count = 0; int count = 0;
const struct prefix *p = agg_node_get_prefix(rp);
memset(&api, 0, sizeof(api)); memset(&api, 0, sizeof(api));
api.vrf_id = ripng->vrf->vrf_id; api.vrf_id = ripng->vrf->vrf_id;
api.type = ZEBRA_ROUTE_RIPNG; api.type = ZEBRA_ROUTE_RIPNG;
api.safi = SAFI_UNICAST; api.safi = SAFI_UNICAST;
api.prefix = rp->p; api.prefix = *p;
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) { for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
@ -85,18 +86,17 @@ static void ripng_zebra_ipv6_send(struct ripng *ripng, struct agg_node *rp,
if (IS_RIPNG_DEBUG_ZEBRA) { if (IS_RIPNG_DEBUG_ZEBRA) {
if (ripng->ecmp) if (ripng->ecmp)
zlog_debug("%s: %s/%d nexthops %d", zlog_debug("%s: %pRN nexthops %d",
(cmd == ZEBRA_ROUTE_ADD) (cmd == ZEBRA_ROUTE_ADD)
? "Install into zebra" ? "Install into zebra"
: "Delete from zebra", : "Delete from zebra",
inet6_ntoa(rp->p.u.prefix6), rp->p.prefixlen, rp, count);
count);
else else
zlog_debug( zlog_debug("%s: %pRN",
"%s: %s/%d", (cmd == ZEBRA_ROUTE_ADD)
(cmd == ZEBRA_ROUTE_ADD) ? "Install into zebra" ? "Install into zebra"
: "Delete from zebra", : "Delete from zebra",
inet6_ntoa(rp->p.u.prefix6), rp->p.prefixlen); rp);
} }
} }

View File

@ -1087,7 +1087,8 @@ void ripng_redistribute_withdraw(struct ripng *ripng, int type)
if (IS_RIPNG_DEBUG_EVENT) { if (IS_RIPNG_DEBUG_EVENT) {
struct prefix_ipv6 *p = struct prefix_ipv6 *p =
(struct prefix_ipv6 *)&rp->p; (struct prefix_ipv6 *)
agg_node_get_prefix(rp);
zlog_debug( zlog_debug(
"Poisone %s/%d on the interface %s [withdraw]", "Poisone %s/%d on the interface %s [withdraw]",
@ -1619,7 +1620,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
* following * following
* information. * information.
*/ */
p = (struct prefix_ipv6 *)&rp->p; p = (struct prefix_ipv6 *)agg_node_get_prefix(rp);
rinfo->metric_out = rinfo->metric; rinfo->metric_out = rinfo->metric;
rinfo->tag_out = rinfo->tag; rinfo->tag_out = rinfo->tag;
memset(&rinfo->nexthop_out, 0, memset(&rinfo->nexthop_out, 0,
@ -1761,7 +1762,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to,
* following * following
* information. * information.
*/ */
p = (struct prefix_ipv6 *)&rp->p; p = (struct prefix_ipv6 *)agg_node_get_prefix(rp);
aggregate->metric_set = 0; aggregate->metric_set = 0;
aggregate->metric_out = aggregate->metric; aggregate->metric_out = aggregate->metric;
aggregate->tag_out = aggregate->tag; aggregate->tag_out = aggregate->tag;
@ -2053,7 +2054,6 @@ DEFUN (show_ipv6_ripng,
struct agg_node *rp; struct agg_node *rp;
struct ripng_info *rinfo; struct ripng_info *rinfo;
struct ripng_aggregate *aggregate; struct ripng_aggregate *aggregate;
struct prefix_ipv6 *p;
struct list *list = NULL; struct list *list = NULL;
struct listnode *listnode = NULL; struct listnode *listnode = NULL;
int len; int len;
@ -2085,15 +2085,11 @@ DEFUN (show_ipv6_ripng,
for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) { for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) {
if ((aggregate = rp->aggregate) != NULL) { if ((aggregate = rp->aggregate) != NULL) {
p = (struct prefix_ipv6 *)&rp->p;
#ifdef DEBUG #ifdef DEBUG
vty_out(vty, "R(a) %d/%d %s/%d ", aggregate->count, vty_out(vty, "R(a) %d/%d %pRN ", aggregate->count,
aggregate->suppress, inet6_ntoa(p->prefix), aggregate->suppress, rp);
p->prefixlen);
#else #else
vty_out(vty, "R(a) %s/%d ", inet6_ntoa(p->prefix), vty_out(vty, "R(a) %pRN ", rp);
p->prefixlen);
#endif /* DEBUG */ #endif /* DEBUG */
vty_out(vty, "\n"); vty_out(vty, "\n");
vty_out(vty, "%*s", 18, " "); vty_out(vty, "%*s", 18, " ");
@ -2105,19 +2101,15 @@ DEFUN (show_ipv6_ripng,
if ((list = rp->info) != NULL) if ((list = rp->info) != NULL)
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) { for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
p = (struct prefix_ipv6 *)&rp->p;
#ifdef DEBUG #ifdef DEBUG
vty_out(vty, "%c(%s) 0/%d %s/%d ", vty_out(vty, "%c(%s) 0/%d %pRN ",
zebra_route_char(rinfo->type), zebra_route_char(rinfo->type),
ripng_route_subtype_print(rinfo), ripng_route_subtype_print(rinfo),
rinfo->suppress, inet6_ntoa(p->prefix), rinfo->suppress, rp);
p->prefixlen);
#else #else
vty_out(vty, "%c(%s) %s/%d ", vty_out(vty, "%c(%s) %pRN ",
zebra_route_char(rinfo->type), zebra_route_char(rinfo->type),
ripng_route_subtype_print(rinfo), ripng_route_subtype_print(rinfo), rp);
inet6_ntoa(p->prefix), p->prefixlen);
#endif /* DEBUG */ #endif /* DEBUG */
vty_out(vty, "\n"); vty_out(vty, "\n");
vty_out(vty, "%*s", 18, " "); vty_out(vty, "%*s", 18, " ");