bgpd: change str2mac call api

With the changed API, some adaptations are done in rfapi code, and in
bgpd evpn code. For evpn code, the internal storage of routermac addr is
kept as struct ethaddr structure. Also the evpn add_routermac api has as
incoming parameter a struct ethaddr param.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2017-02-09 08:44:13 +01:00
parent db42a173d6
commit 31689a53f1
4 changed files with 6 additions and 7 deletions

View File

@ -34,7 +34,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_ecommunity.h"
#include "bgpd/bgp_evpn.h"
void bgp_add_routermac_ecom(struct attr *attr, char *routermac)
void bgp_add_routermac_ecom(struct attr *attr, struct ethaddr *routermac)
{
struct ecommunity_val routermac_ecom;
@ -42,7 +42,7 @@ void bgp_add_routermac_ecom(struct attr *attr, char *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, ETHER_ADDR_LEN);
memcpy(&routermac_ecom.val[2], routermac->octet, ETHER_ADDR_LEN);
if (!attr->extra->ecommunity)
attr->extra->ecommunity = ecommunity_new();
ecommunity_add_val(attr->extra->ecommunity, &routermac_ecom);
@ -171,7 +171,7 @@ char *ecom_mac2str(char *ecom_mac)
en = ecom_mac;
en += 2;
return prefix_mac2str(en, NULL, 0);
return prefix_mac2str((struct ethaddr *)en, NULL, 0);
}
/* dst prefix must be AF_INET or AF_INET6 prefix, to forge EVPN prefix */

View File

@ -50,11 +50,10 @@ struct bgp_route_evpn {
};
extern int str2esi(const char *str, struct eth_segment_id *id);
extern int str2mac(const char *str, char *mac);
extern char *esi2str(struct eth_segment_id *id);
extern char *ecom_mac2str(char *ecom_mac);
extern void bgp_add_routermac_ecom(struct attr *attr, char *routermac);
extern void bgp_add_routermac_ecom(struct attr *attr, struct ethaddr *routermac);
extern int bgp_build_evpn_prefix(int type, uint32_t eth_tag,
struct prefix *dst);
#endif /* _QUAGGA_BGP_ATTR_EVPN_H */

View File

@ -206,7 +206,7 @@ struct bgp_static
/* EVPN */
struct eth_segment_id *eth_s_id;
char *router_mac;
struct ethaddr *router_mac;
uint16_t encap_tunneltype;
struct prefix gatewayIp;
};

View File

@ -314,7 +314,7 @@ rfapiL2o2Qprefix (struct rfapi_l2address_option *l2o, struct prefix *pfx)
char *
rfapiEthAddr2Str (const struct ethaddr *ea, char *buf, int bufsize)
{
return prefix_mac2str (ea->octet, buf, bufsize);
return prefix_mac2str (ea, buf, bufsize);
}
int