mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 18:56:40 +00:00
bgpd: Convert to using ETH_ALEN
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
9bff805755
commit
28328ea953
@ -42,7 +42,7 @@ void bgp_add_routermac_ecom(struct attr *attr, struct ethaddr *routermac)
|
||||
memset(&routermac_ecom, 0, sizeof(struct ecommunity_val));
|
||||
routermac_ecom.val[0] = ECOMMUNITY_ENCODE_EVPN;
|
||||
routermac_ecom.val[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC;
|
||||
memcpy(&routermac_ecom.val[2], routermac->octet, ETHER_ADDR_LEN);
|
||||
memcpy(&routermac_ecom.val[2], routermac->octet, ETH_ALEN);
|
||||
if (!attr->ecommunity)
|
||||
attr->ecommunity = ecommunity_new();
|
||||
ecommunity_add_val(attr->ecommunity, &routermac_ecom);
|
||||
|
@ -351,7 +351,7 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn,
|
||||
s, add ? ZEBRA_REMOTE_MACIP_ADD : ZEBRA_REMOTE_MACIP_DEL,
|
||||
bgp->vrf_id);
|
||||
stream_putl(s, vpn->vni);
|
||||
stream_put(s, &p->prefix.mac.octet, ETHER_ADDR_LEN); /* Mac Addr */
|
||||
stream_put(s, &p->prefix.mac.octet, ETH_ALEN); /* Mac Addr */
|
||||
/* IP address length and IP address, if any. */
|
||||
if (IS_EVPN_PREFIX_IPADDR_NONE(p))
|
||||
stream_putl(s, 0);
|
||||
@ -1812,9 +1812,9 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi,
|
||||
macaddr_len = *pfx++;
|
||||
|
||||
/* Get the MAC Addr */
|
||||
if (macaddr_len == (ETHER_ADDR_LEN * 8)) {
|
||||
memcpy(&p.prefix.mac.octet, pfx, ETHER_ADDR_LEN);
|
||||
pfx += ETHER_ADDR_LEN;
|
||||
if (macaddr_len == (ETH_ALEN * 8)) {
|
||||
memcpy(&p.prefix.mac.octet, pfx, ETH_ALEN);
|
||||
pfx += ETH_ALEN;
|
||||
} else {
|
||||
zlog_err(
|
||||
"%u:%s - Rx EVPN Type-2 NLRI with unsupported MAC address length %d",
|
||||
@ -2186,7 +2186,7 @@ char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len)
|
||||
} else if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
|
||||
if (IS_EVPN_PREFIX_IPADDR_NONE(p))
|
||||
snprintf(buf, len, "[%d]:[0]:[0]:[%d]:[%s]",
|
||||
p->prefix.route_type, 8 * ETHER_ADDR_LEN,
|
||||
p->prefix.route_type, 8 * ETH_ALEN,
|
||||
prefix_mac2str(&p->prefix.mac, buf1,
|
||||
sizeof(buf1)));
|
||||
else {
|
||||
@ -2195,7 +2195,7 @@ char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len)
|
||||
family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET
|
||||
: AF_INET6;
|
||||
snprintf(buf, len, "[%d]:[0]:[0]:[%d]:[%s]:[%d]:[%s]",
|
||||
p->prefix.route_type, 8 * ETHER_ADDR_LEN,
|
||||
p->prefix.route_type, 8 * ETH_ALEN,
|
||||
prefix_mac2str(&p->prefix.mac, buf1,
|
||||
sizeof(buf1)),
|
||||
family == AF_INET ? IPV4_MAX_BITLEN
|
||||
@ -2237,7 +2237,7 @@ void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
|
||||
stream_put(s, prd->val, 8); /* RD */
|
||||
stream_put(s, 0, 10); /* ESI */
|
||||
stream_putl(s, 0); /* Ethernet Tag ID */
|
||||
stream_putc(s, 8 * ETHER_ADDR_LEN); /* Mac Addr Len - bits */
|
||||
stream_putc(s, 8 * ETH_ALEN); /* Mac Addr Len - bits */
|
||||
stream_put(s, evp->prefix.mac.octet, 6); /* Mac Addr */
|
||||
stream_putc(s, 8 * ipa_len); /* IP address Length */
|
||||
if (ipa_len)
|
||||
|
@ -174,7 +174,7 @@ static inline void build_evpn_type2_prefix(struct prefix_evpn *p,
|
||||
p->family = AF_ETHERNET;
|
||||
p->prefixlen = EVPN_TYPE_2_ROUTE_PREFIXLEN;
|
||||
p->prefix.route_type = BGP_EVPN_MAC_IP_ROUTE;
|
||||
memcpy(&p->prefix.mac.octet, mac->octet, ETHER_ADDR_LEN);
|
||||
memcpy(&p->prefix.mac.octet, mac->octet, ETH_ALEN);
|
||||
p->prefix.ip.ipa_type = IPADDR_NONE;
|
||||
if (ip)
|
||||
memcpy(&p->prefix.ip, ip, sizeof(*ip));
|
||||
|
@ -98,7 +98,7 @@ void decode_rd_vnc_eth(u_char *pnt, struct rd_vnc_eth *rd_vnc_eth)
|
||||
{
|
||||
rd_vnc_eth->type = RD_TYPE_VNC_ETH;
|
||||
rd_vnc_eth->local_nve_id = pnt[1];
|
||||
memcpy(rd_vnc_eth->macaddr.octet, pnt + 2, ETHER_ADDR_LEN);
|
||||
memcpy(rd_vnc_eth->macaddr.octet, pnt + 2, ETH_ALEN);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4775,7 +4775,7 @@ int bgp_static_set_safi(afi_t afi, safi_t safi, struct vty *vty,
|
||||
}
|
||||
if (routermac) {
|
||||
bgp_static->router_mac =
|
||||
XCALLOC(MTYPE_ATTR, ETHER_ADDR_LEN + 1);
|
||||
XCALLOC(MTYPE_ATTR, ETH_ALEN + 1);
|
||||
prefix_str2mac(routermac,
|
||||
bgp_static->router_mac);
|
||||
}
|
||||
|
@ -2125,7 +2125,7 @@ static int bgp_zebra_process_local_macip(int command, struct zclient *zclient,
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
s = zclient->ibuf;
|
||||
vni = stream_getl(s);
|
||||
stream_get(&mac.octet, s, ETHER_ADDR_LEN);
|
||||
stream_get(&mac.octet, s, ETH_ALEN);
|
||||
ipa_len = stream_getl(s);
|
||||
if (ipa_len != 0 && ipa_len != IPV4_MAX_BYTELEN
|
||||
&& ipa_len != IPV6_MAX_BYTELEN) {
|
||||
|
@ -1568,7 +1568,7 @@ rfapi_query_inner(void *handle, struct rfapi_ip_addr *target,
|
||||
|
||||
if (l2o) {
|
||||
if (!memcmp(l2o->macaddr.octet, rfapi_ethaddr0.octet,
|
||||
ETHER_ADDR_LEN)) {
|
||||
ETH_ALEN)) {
|
||||
eth_is_0 = 1;
|
||||
}
|
||||
/* per t/c Paul/Lou 151022 */
|
||||
@ -3416,7 +3416,7 @@ DEFUN (debug_rfapi_query_vn_un_l2o,
|
||||
/* construct option chain */
|
||||
|
||||
memset(valbuf, 0, sizeof(valbuf));
|
||||
memcpy(valbuf, &l2o_buf.macaddr.octet, ETHER_ADDR_LEN);
|
||||
memcpy(valbuf, &l2o_buf.macaddr.octet, ETH_ALEN);
|
||||
valbuf[11] = (l2o_buf.logical_net_id >> 16) & 0xff;
|
||||
valbuf[12] = (l2o_buf.logical_net_id >> 8) & 0xff;
|
||||
valbuf[13] = l2o_buf.logical_net_id & 0xff;
|
||||
|
@ -308,7 +308,7 @@ int rfapiGetL2o(struct attr *attr, struct rfapi_l2address_option *l2o)
|
||||
if (pEncap->value[1] == 14) {
|
||||
memcpy(l2o->macaddr.octet,
|
||||
pEncap->value + 2,
|
||||
ETHER_ADDR_LEN);
|
||||
ETH_ALEN);
|
||||
l2o->label =
|
||||
((pEncap->value[10]
|
||||
>> 4)
|
||||
@ -1327,7 +1327,7 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
|
||||
vo->type = RFAPI_VN_OPTION_TYPE_L2ADDR;
|
||||
|
||||
memcpy(&vo->v.l2addr.macaddr, &rn->p.u.prefix_eth.octet,
|
||||
ETHER_ADDR_LEN);
|
||||
ETH_ALEN);
|
||||
/* only low 3 bytes of this are significant */
|
||||
if (bi->attr) {
|
||||
(void)rfapiEcommunityGetLNI(
|
||||
|
@ -805,7 +805,7 @@ void rfapiMonitorTimersRestart(struct rfapi_descriptor *rfd, struct prefix *p)
|
||||
(void **)&mon_eth, &cursor)) {
|
||||
|
||||
if (!memcmp(mon_eth->macaddr.octet,
|
||||
p->u.prefix_eth.octet, ETHER_ADDR_LEN)) {
|
||||
p->u.prefix_eth.octet, ETH_ALEN)) {
|
||||
|
||||
rfapiMonitorEthTimerRestart(mon_eth);
|
||||
}
|
||||
@ -1117,7 +1117,7 @@ static int mon_eth_cmp(void *a, void *b)
|
||||
/*
|
||||
* compare ethernet addresses
|
||||
*/
|
||||
for (i = 0; i < ETHER_ADDR_LEN; ++i) {
|
||||
for (i = 0; i < ETH_ALEN; ++i) {
|
||||
if (m1->macaddr.octet[i] != m2->macaddr.octet[i])
|
||||
return (m1->macaddr.octet[i] - m2->macaddr.octet[i]);
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ static void rfapiRibBi2Ri(struct bgp_info *bi, struct rfapi_info *ri,
|
||||
/* copy from RD already stored in bi, so we don't need it_node
|
||||
*/
|
||||
memcpy(&vo->v.l2addr.macaddr, bi->extra->vnc.import.rd.val + 2,
|
||||
ETHER_ADDR_LEN);
|
||||
ETH_ALEN);
|
||||
|
||||
if (bi->attr) {
|
||||
(void)rfapiEcommunityGetLNI(
|
||||
|
@ -3092,7 +3092,7 @@ static int rfapiDeleteLocalPrefixesByRFD(struct rfapi_local_reg_delete_arg *cda,
|
||||
if (memcmp(cda->l2o.o.macaddr.octet,
|
||||
adb->u.s.prefix_eth.u
|
||||
.prefix_eth.octet,
|
||||
ETHER_ADDR_LEN)) {
|
||||
ETH_ALEN)) {
|
||||
#if DEBUG_L2_EXTRA
|
||||
vnc_zlog_debug_verbose(
|
||||
"%s: adb=%p, macaddr doesn't match, skipping",
|
||||
@ -3211,7 +3211,7 @@ static int rfapiDeleteLocalPrefixesByRFD(struct rfapi_local_reg_delete_arg *cda,
|
||||
adb->u.s.prefix_eth.u
|
||||
.prefix_eth
|
||||
.octet,
|
||||
ETHER_ADDR_LEN)) {
|
||||
ETH_ALEN)) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user