return lcom1;
}
-static void set_lcommunity_string(struct lcommunity *lcom, bool make_json)
+static void set_lcommunity_string(struct lcommunity *lcom, bool make_json,
+ bool translate_alias)
{
int i;
int len;
snprintf(lcsb, sizeof(lcsb), "%u:%u:%u", global, local1,
local2);
- const char *com2alias = bgp_community2alias(lcsb);
+ const char *com2alias =
+ translate_alias ? bgp_community2alias(lcsb) : lcsb;
len = strlcat(str_buf, com2alias, str_buf_sz);
assert((unsigned int)len < str_buf_sz);
find->refcnt++;
if (!find->str)
- set_lcommunity_string(find, false);
+ set_lcommunity_string(find, false, true);
return find;
}
}
/* Return string representation of lcommunities attribute. */
-char *lcommunity_str(struct lcommunity *lcom, bool make_json)
+char *lcommunity_str(struct lcommunity *lcom, bool make_json,
+ bool translate_alias)
{
if (!lcom)
return NULL;
XFREE(MTYPE_LCOMMUNITY_STR, lcom->str);
if (!lcom->str)
- set_lcommunity_string(lcom, make_json);
+ set_lcommunity_string(lcom, make_json, translate_alias);
return lcom->str;
}