mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 04:18:56 +00:00
bgpd: Show BGP community alias in JSON community list output
Before: ``` "community":{ "string":"first 65001:2 65001:3", "list":[ "65001:1", "65001:2", "65001:3" ] }, ``` After: ``` "community":{ "string":"first 65001:2 65001:3", "list":[ "first", "65001:2", "65001:3" ] }, ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
parent
9f977b2def
commit
d95a84e0a5
@ -451,9 +451,11 @@ static void set_community_string(struct community *com, bool make_json)
|
||||
val = comval & 0xFFFF;
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof(buf), "%u:%d", as, val);
|
||||
strlcat(str, bgp_community2alias(buf), len);
|
||||
const char *com2alias = bgp_community2alias(buf);
|
||||
|
||||
strlcat(str, com2alias, len);
|
||||
if (make_json) {
|
||||
json_string = json_object_new_string(buf);
|
||||
json_string = json_object_new_string(com2alias);
|
||||
json_object_array_add(json_community_list,
|
||||
json_string);
|
||||
}
|
||||
|
@ -232,11 +232,13 @@ static void set_lcommunity_string(struct lcommunity *lcom, bool make_json)
|
||||
snprintf(lcsb, sizeof(lcsb), "%u:%u:%u", global, local1,
|
||||
local2);
|
||||
|
||||
len = strlcat(str_buf, bgp_community2alias(lcsb), str_buf_sz);
|
||||
const char *com2alias = bgp_community2alias(lcsb);
|
||||
|
||||
len = strlcat(str_buf, com2alias, str_buf_sz);
|
||||
assert((unsigned int)len < str_buf_sz);
|
||||
|
||||
if (make_json) {
|
||||
json_string = json_object_new_string(lcsb);
|
||||
json_string = json_object_new_string(com2alias);
|
||||
json_object_array_add(json_lcommunity_list,
|
||||
json_string);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user