if ((*ecom)->str)
XFREE(MTYPE_ECOMMUNITY_STR, (*ecom)->str);
XFREE(MTYPE_ECOMMUNITY, *ecom);
- ecom = NULL;
}
static void ecommunity_hash_free(struct ecommunity *ecom)
}
/* Compare two Extended Communities Attribute structure. */
-int ecommunity_cmp(const void *arg1, const void *arg2)
+bool ecommunity_cmp(const void *arg1, const void *arg2)
{
const struct ecommunity *ecom1 = arg1;
const struct ecommunity *ecom2 = arg2;
if (ecom1 == NULL && ecom2 == NULL)
- return 1;
+ return true;
if (ecom1 == NULL || ecom2 == NULL)
- return 0;
+ return false;
return (ecom1->size == ecom2->size
&& memcmp(ecom1->val, ecom2->val, ecom1->size * ECOMMUNITY_SIZE)
/* Low-order octet of type. */
sub_type = *pnt++;
if (sub_type != ECOMMUNITY_ROUTE_TARGET
- && sub_type != ECOMMUNITY_SITE_ORIGIN)
- unk_ecom = 1;
- else
+ && sub_type != ECOMMUNITY_SITE_ORIGIN) {
+ if (sub_type ==
+ ECOMMUNITY_FLOWSPEC_REDIRECT_IPV4 &&
+ type == ECOMMUNITY_ENCODE_IP) {
+ struct in_addr *ipv4 =
+ (struct in_addr *)pnt;
+ char ipv4str[INET_ADDRSTRLEN];
+
+ inet_ntop(AF_INET, ipv4,
+ ipv4str,
+ INET_ADDRSTRLEN);
+ len = sprintf(str_buf + str_pnt,
+ "NH:%s:%d",
+ ipv4str, pnt[5]);
+ } else
+ unk_ecom = 1;
+ } else
len = ecommunity_rt_soo_str(str_buf + str_pnt,
pnt, type, sub_type,
format);
else
len = sprintf(str_buf + str_pnt,
"MM:%u", seqnum);
+ } else if (*pnt == ECOMMUNITY_EVPN_SUBTYPE_ND) {
+ uint8_t flags = *++pnt;
+
+ if (flags
+ & ECOMMUNITY_EVPN_SUBTYPE_ND_ROUTER_FLAG)
+ len = sprintf(str_buf + str_pnt,
+ "ND:Router Flag");
} else
unk_ecom = 1;
} else if (type == ECOMMUNITY_ENCODE_REDIRECT_IP_NH) {