diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-03-22 00:02:18 -0400 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-03-26 16:25:16 -0400 | 
| commit | b54892e0ea247f52beea96855734919f80de5217 (patch) | |
| tree | b76b8a7899121ff14334dd7773d335b8b8b705d2 /bgpd/bgp_mac.c | |
| parent | 5f040085bad9cff365fe4bed0696ccf7494840b5 (diff) | |
bgpd: Convert users of `rn->p` to use accessor function
Add new function `bgp_node_get_prefix()` and modify
the bgp code base to use it.
This is prep work for the struct bgp_dest rework.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_mac.c')
| -rw-r--r-- | bgpd/bgp_mac.c | 14 | 
1 files changed, 8 insertions, 6 deletions
diff --git a/bgpd/bgp_mac.c b/bgpd/bgp_mac.c index fed88fd508..af20e5fdd7 100644 --- a/bgpd/bgp_mac.c +++ b/bgpd/bgp_mac.c @@ -142,13 +142,15 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,  	for (prn = bgp_table_top(table); prn; prn = bgp_route_next(prn)) {  		struct bgp_table *sub = prn->info; +		const struct prefix *prn_p = bgp_node_get_prefix(prn);  		if (!sub)  			continue;  		for (rn = bgp_table_top(sub); rn; rn = bgp_route_next(rn)) {  			bool rn_affected; -			struct prefix_evpn *pevpn = (struct prefix_evpn *)&rn->p; +			const struct prefix *p = bgp_node_get_prefix(rn); +			const struct prefix_evpn *pevpn = (const struct prefix_evpn *)p;  			struct prefix_rd prd;  			uint32_t num_labels = 0;  			mpls_label_t *label_pnt = NULL; @@ -156,7 +158,7 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,  			if (pevpn->family == AF_EVPN &&  			    pevpn->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE && -			    memcmp(&rn->p.u.prefix_evpn.macip_addr.mac, +			    memcmp(&p->u.prefix_evpn.macip_addr.mac,  				   macaddr, ETH_ALEN) == 0)  				rn_affected = true;  			else @@ -185,15 +187,15 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,  			prd.family = AF_UNSPEC;  			prd.prefixlen = 64; -			memcpy(&prd.val, &prn->p.u.val, 8); +			memcpy(&prd.val, prn_p->u.val, 8);  			if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) { -				if (bgp_debug_update(peer, &rn->p, NULL, 1)) { +				if (bgp_debug_update(peer, p, NULL, 1)) {  					char pfx_buf[BGP_PRD_PATH_STRLEN];  					bgp_debug_rdpfxpath2str(  						AFI_L2VPN, SAFI_EVPN, &prd, -						&rn->p, label_pnt, num_labels, +						p, label_pnt, num_labels,  						pi->addpath_rx_id ? 1 : 0,  						pi->addpath_rx_id, pfx_buf,  						sizeof(pfx_buf)); @@ -205,7 +207,7 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,  			}  			memcpy(&evpn, &pi->attr->evpn_overlay, sizeof(evpn)); -			int32_t ret = bgp_update(peer, &rn->p, +			int32_t ret = bgp_update(peer, p,  						 pi->addpath_rx_id,  						 pi->attr, AFI_L2VPN, SAFI_EVPN,  						 ZEBRA_ROUTE_BGP,  | 
