mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 06:59:21 +00:00
lib: Functions related to AF_ETHERNET
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
This commit is contained in:
parent
b205584753
commit
fd6c6cb49b
18
lib/prefix.c
18
lib/prefix.c
@ -209,7 +209,7 @@ afi2family (afi_t afi)
|
||||
return AF_INET;
|
||||
else if (afi == AFI_IP6)
|
||||
return AF_INET6;
|
||||
else if (afi == AFI_ETHER)
|
||||
else if (afi == AFI_L2VPN)
|
||||
return AF_ETHERNET;
|
||||
return 0;
|
||||
}
|
||||
@ -222,7 +222,7 @@ family2afi (int family)
|
||||
else if (family == AF_INET6)
|
||||
return AFI_IP6;
|
||||
else if (family == AF_ETHERNET)
|
||||
return AFI_ETHER;
|
||||
return AFI_L2VPN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -304,6 +304,10 @@ prefix_copy (struct prefix *dest, const struct prefix *src)
|
||||
dest->u.prefix4 = src->u.prefix4;
|
||||
else if (src->family == AF_INET6)
|
||||
dest->u.prefix6 = src->u.prefix6;
|
||||
else if (src->family == AF_ETHERNET)
|
||||
{
|
||||
memcpy (&dest->u.prefix_evpn, &src->u.prefix_evpn, sizeof (struct evpn_addr));
|
||||
}
|
||||
else if (src->family == AF_UNSPEC)
|
||||
{
|
||||
dest->u.lp.id = src->u.lp.id;
|
||||
@ -346,10 +350,9 @@ prefix_same (const struct prefix *p1, const struct prefix *p2)
|
||||
if (p1->family == AF_INET6 )
|
||||
if (IPV6_ADDR_SAME (&p1->u.prefix6.s6_addr, &p2->u.prefix6.s6_addr))
|
||||
return 1;
|
||||
if (p1->family == AF_ETHERNET) {
|
||||
if (!memcmp(p1->u.prefix_eth.octet, p2->u.prefix_eth.octet, ETHER_ADDR_LEN))
|
||||
return 1;
|
||||
}
|
||||
if (p1->family == AF_ETHERNET )
|
||||
if (!memcmp (&p1->u.prefix_evpn, &p2->u.prefix_evpn, sizeof (struct evpn_addr)))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -412,6 +415,9 @@ prefix_common_bits (const struct prefix *p1, const struct prefix *p2)
|
||||
length = IPV4_MAX_BYTELEN;
|
||||
if (p1->family == AF_INET6)
|
||||
length = IPV6_MAX_BYTELEN;
|
||||
if (p1->family == AF_ETHERNET)
|
||||
length = 8 * sizeof (struct evpn_addr);
|
||||
|
||||
if (p1->family != p2->family || !length)
|
||||
return -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user