Skip to content

Commit

Permalink
bgpd: Print the communities as a string if the attribute really exists
Browse files Browse the repository at this point in the history
We didn't print communities for `advertised detail` routes because they was never
converted to ->str.

Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 committed Dec 19, 2024
1 parent fa98a5b commit 9df7500
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -11290,13 +11290,18 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
json_path, "community",
bgp_attr_get_community(attr)->json);
} else {
if (!bgp_attr_get_community(attr)->str)
community_str(bgp_attr_get_community(attr), true, true);
vty_out(vty, " Community: %s\n",
bgp_attr_get_community(attr)->str);
}
}

/* Line 5 display Extended-community */
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES))) {
if (!bgp_attr_get_ecommunity(attr)->str)
ecommunity_str(bgp_attr_get_ecommunity(attr));

if (json_paths) {
json_ext_community = json_object_new_object();
json_object_string_add(
Expand All @@ -11311,6 +11316,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
}

if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_IPV6_EXT_COMMUNITIES))) {
if (!bgp_attr_get_ipv6_ecommunity(attr)->str)
ecommunity_str(bgp_attr_get_ipv6_ecommunity(attr));

if (json_paths) {
json_ext_ipv6_community = json_object_new_object();
json_object_string_add(json_ext_ipv6_community, "string",
Expand All @@ -11336,6 +11344,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
json_path, "largeCommunity",
bgp_attr_get_lcommunity(attr)->json);
} else {
if (!bgp_attr_get_lcommunity(attr)->str)
lcommunity_str(bgp_attr_get_lcommunity(attr), true, true);
vty_out(vty, " Large Community: %s\n",
bgp_attr_get_lcommunity(attr)->str);
}
Expand Down

0 comments on commit 9df7500

Please sign in to comment.