mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 10:38:05 +00:00
lib: add define of compilation for EVPN in prefix.c
Because the prefix structure may include or not evpn sub structure, then HAVE_EVPN compilation define is also used in prefix.c, because it references the sub field evpn of prefix structure. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
b18825ebc7
commit
25098f9b97
14
lib/prefix.c
14
lib/prefix.c
@ -304,19 +304,17 @@ 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;
|
||||
#if defined(HAVE_EVPN)
|
||||
else if (src->family == AF_ETHERNET)
|
||||
{
|
||||
memcpy (&dest->u.prefix_evpn, &src->u.prefix_evpn, sizeof (struct evpn_addr));
|
||||
}
|
||||
#endif /* (HAVE_EVPN) */
|
||||
else if (src->family == AF_UNSPEC)
|
||||
{
|
||||
dest->u.lp.id = src->u.lp.id;
|
||||
dest->u.lp.adv_router = src->u.lp.adv_router;
|
||||
}
|
||||
else if (src->family == AF_ETHERNET)
|
||||
{
|
||||
dest->u.prefix_eth = src->u.prefix_eth;
|
||||
}
|
||||
else
|
||||
{
|
||||
zlog (NULL, LOG_ERR, "prefix_copy(): Unknown address family %d",
|
||||
@ -350,9 +348,11 @@ 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 defined(HAVE_EVPN)
|
||||
if (p1->family == AF_ETHERNET )
|
||||
if (!memcmp (&p1->u.prefix_evpn, &p2->u.prefix_evpn, sizeof (struct evpn_addr)))
|
||||
return 1;
|
||||
#endif /* (HAVE_EVPN) */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -866,8 +866,6 @@ prefix2str (union prefixconstptr pu, char *str, int size)
|
||||
|
||||
switch (p->family)
|
||||
{
|
||||
u_char family;
|
||||
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
snprintf (str, size, "%s/%d",
|
||||
@ -875,9 +873,11 @@ prefix2str (union prefixconstptr pu, char *str, int size)
|
||||
p->prefixlen);
|
||||
break;
|
||||
|
||||
#if defined(HAVE_EVPN)
|
||||
case AF_ETHERNET:
|
||||
if (p->u.prefix_evpn.route_type == 5)
|
||||
{
|
||||
u_char family;
|
||||
family = (p->u.prefix_evpn.flags & (IP_ADDR_V4 | IP_PREFIX_V4)) ?
|
||||
AF_INET : AF_INET6;
|
||||
snprintf (str, size, "[%d]:[%u][%s]/%d",
|
||||
@ -888,7 +888,7 @@ prefix2str (union prefixconstptr pu, char *str, int size)
|
||||
p->prefixlen);
|
||||
}
|
||||
break;
|
||||
|
||||
#endif /* (HAVE_EVPN) */
|
||||
default:
|
||||
sprintf (str, "UNK prefix");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user