diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-05-08 12:44:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-08 12:44:56 +0200 |
commit | 32a2f283d1fa4e7d5acb3acab96a4bd2e36f189b (patch) | |
tree | a74af9d22ba0d4ba400ef41cb0c1edd6ba3f88af /bgpd | |
parent | Merge pull request #13440 from zice312963205/bgpfix (diff) | |
parent | bgpd: fix show running of nt extcommunity (diff) | |
download | frr-32a2f283d1fa4e7d5acb3acab96a4bd2e36f189b.tar.xz frr-32a2f283d1fa4e7d5acb3acab96a4bd2e36f189b.zip |
Merge pull request #13446 from louis-6wind/fix-ext-comm
bgpd: fix show running of nt extcommunity
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_ecommunity.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 7bf260901..a55593013 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -445,7 +445,8 @@ bool ecommunity_node_target_match(struct ecommunity *ecom, return match; } -static void ecommunity_node_target_str(char *buf, size_t bufsz, uint8_t *ptr) +static void ecommunity_node_target_str(char *buf, size_t bufsz, uint8_t *ptr, + int format) { /* * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -458,7 +459,11 @@ static void ecommunity_node_target_str(char *buf, size_t bufsz, uint8_t *ptr) IPV4_ADDR_COPY(&node_id, (struct in_addr *)ptr); - snprintfrr(buf, bufsz, "NT:%pI4", &node_id); + + snprintfrr(buf, bufsz, "%s%pI4%s", + format == ECOMMUNITY_FORMAT_COMMUNITY_LIST ? "nt " : "NT:", + &node_id, + format == ECOMMUNITY_FORMAT_COMMUNITY_LIST ? ":0" : ""); (void)ptr; /* consume value */ } @@ -1059,7 +1064,8 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter) } else if (sub_type == ECOMMUNITY_NODE_TARGET && type == ECOMMUNITY_ENCODE_IP) { ecommunity_node_target_str( - encbuf, sizeof(encbuf), pnt); + encbuf, sizeof(encbuf), pnt, + format); } else unk_ecom = 1; } else { @@ -1272,8 +1278,8 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter) } else if (type == ECOMMUNITY_ENCODE_IP_NON_TRANS) { sub_type = *pnt++; if (sub_type == ECOMMUNITY_NODE_TARGET) - ecommunity_node_target_str(encbuf, - sizeof(encbuf), pnt); + ecommunity_node_target_str( + encbuf, sizeof(encbuf), pnt, format); else unk_ecom = 1; } else if (type == ECOMMUNITY_ENCODE_OPAQUE_NON_TRANS) { |