mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 01:47:29 +00:00
zebra: extract gateway mac add from zebra_vxlan.c
extract mac_gateway add code from zevi_gw_macip_add and move it to a new generic function zebra_evpn_mac_gw_macip_add in zebra_evpn_mac.c Signed-off-by: Pat Ruddy <pat@voltanet.io>
This commit is contained in:
parent
ad6ca5f423
commit
7bce35354f
@ -2196,3 +2196,35 @@ int zebra_evpn_del_local_mac(zebra_evpn_t *zevpn, struct ethaddr *macaddr,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int zebra_evpn_mac_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn,
|
||||||
|
struct ipaddr *ip, zebra_mac_t **macp,
|
||||||
|
struct ethaddr *macaddr, vlanid_t vlan_id)
|
||||||
|
{
|
||||||
|
char buf[ETHER_ADDR_STRLEN];
|
||||||
|
zebra_mac_t *mac;
|
||||||
|
|
||||||
|
mac = zebra_evpn_mac_lookup(zevpn, macaddr);
|
||||||
|
if (!mac) {
|
||||||
|
mac = zebra_evpn_mac_add(zevpn, macaddr);
|
||||||
|
if (!mac) {
|
||||||
|
flog_err(EC_ZEBRA_MAC_ADD_FAILED,
|
||||||
|
"Failed to add MAC %s intf %s(%u) VID %u",
|
||||||
|
prefix_mac2str(macaddr, buf, sizeof(buf)),
|
||||||
|
ifp->name, ifp->ifindex, vlan_id);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set "local" forwarding info. */
|
||||||
|
SET_FLAG(mac->flags, ZEBRA_MAC_LOCAL);
|
||||||
|
SET_FLAG(mac->flags, ZEBRA_MAC_AUTO);
|
||||||
|
SET_FLAG(mac->flags, ZEBRA_MAC_DEF_GW);
|
||||||
|
memset(&mac->fwd_info, 0, sizeof(mac->fwd_info));
|
||||||
|
mac->fwd_info.local.ifindex = ifp->ifindex;
|
||||||
|
mac->fwd_info.local.vid = vlan_id;
|
||||||
|
|
||||||
|
*macp = mac;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -252,6 +252,9 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn,
|
|||||||
bool dp_static);
|
bool dp_static);
|
||||||
int zebra_evpn_del_local_mac(zebra_evpn_t *zevpn, struct ethaddr *macaddr,
|
int zebra_evpn_del_local_mac(zebra_evpn_t *zevpn, struct ethaddr *macaddr,
|
||||||
struct interface *ifp);
|
struct interface *ifp);
|
||||||
|
int zebra_evpn_mac_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn,
|
||||||
|
struct ipaddr *ip, zebra_mac_t **macp,
|
||||||
|
struct ethaddr *macaddr, vlanid_t vlan_id);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -2251,25 +2251,10 @@ static int zevpn_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn,
|
|||||||
|
|
||||||
vxl = &zif->l2info.vxl;
|
vxl = &zif->l2info.vxl;
|
||||||
|
|
||||||
mac = zebra_evpn_mac_lookup(zevpn, macaddr);
|
if (zebra_evpn_mac_gw_macip_add(ifp, zevpn, ip, &mac, macaddr,
|
||||||
if (!mac) {
|
vxl->access_vlan)
|
||||||
mac = zebra_evpn_mac_add(zevpn, macaddr);
|
!= 0)
|
||||||
if (!mac) {
|
|
||||||
flog_err(EC_ZEBRA_MAC_ADD_FAILED,
|
|
||||||
"Failed to add MAC %s intf %s(%u) VID %u",
|
|
||||||
prefix_mac2str(macaddr, buf, sizeof(buf)),
|
|
||||||
ifp->name, ifp->ifindex, vxl->access_vlan);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set "local" forwarding info. */
|
|
||||||
SET_FLAG(mac->flags, ZEBRA_MAC_LOCAL);
|
|
||||||
SET_FLAG(mac->flags, ZEBRA_MAC_AUTO);
|
|
||||||
SET_FLAG(mac->flags, ZEBRA_MAC_DEF_GW);
|
|
||||||
memset(&mac->fwd_info, 0, sizeof(mac->fwd_info));
|
|
||||||
mac->fwd_info.local.ifindex = ifp->ifindex;
|
|
||||||
mac->fwd_info.local.vid = vxl->access_vlan;
|
|
||||||
|
|
||||||
n = zevpn_neigh_lookup(zevpn, ip);
|
n = zevpn_neigh_lookup(zevpn, ip);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
|
Loading…
Reference in New Issue
Block a user