mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 12:18:12 +00:00
zebra: simplify reason code printing in show
Simplify the code for printing the reason codes via show command. Just remove the trailing comma last before printing. Signed-off-by: Stephen Worley <sworley@nvidia.com>
This commit is contained in:
parent
3db9f2db2b
commit
a3ea8493a8
@ -1852,49 +1852,31 @@ static void ifs_dump_brief_vty_json(json_object *json, struct vrf *vrf)
|
||||
const char *zebra_protodown_rc_str(uint32_t protodown_rc, char *pd_buf,
|
||||
uint32_t pd_buf_len)
|
||||
{
|
||||
bool first = true;
|
||||
|
||||
pd_buf[0] = '\0';
|
||||
size_t len;
|
||||
|
||||
strlcat(pd_buf, "(", pd_buf_len);
|
||||
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_EXTERNAL) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
strlcat(pd_buf, ",", pd_buf_len);
|
||||
strlcat(pd_buf, "external", pd_buf_len);
|
||||
}
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_EXTERNAL)
|
||||
strlcat(pd_buf, "external,", pd_buf_len);
|
||||
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
strlcat(pd_buf, ",", pd_buf_len);
|
||||
strlcat(pd_buf, "startup-delay", pd_buf_len);
|
||||
}
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY)
|
||||
strlcat(pd_buf, "startup-delay,", pd_buf_len);
|
||||
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
strlcat(pd_buf, ",", pd_buf_len);
|
||||
strlcat(pd_buf, "uplinks-down", pd_buf_len);
|
||||
}
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN)
|
||||
strlcat(pd_buf, "uplinks-down,", pd_buf_len);
|
||||
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_VRRP) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
strlcat(pd_buf, ",", pd_buf_len);
|
||||
strlcat(pd_buf, "vrrp", pd_buf_len);
|
||||
}
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_VRRP)
|
||||
strlcat(pd_buf, "vrrp,", pd_buf_len);
|
||||
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_SHARP) {
|
||||
if (!first)
|
||||
strlcat(pd_buf, ",", pd_buf_len);
|
||||
strlcat(pd_buf, "sharp", pd_buf_len);
|
||||
}
|
||||
if (protodown_rc & ZEBRA_PROTODOWN_SHARP)
|
||||
strlcat(pd_buf, "sharp,", pd_buf_len);
|
||||
|
||||
len = strnlen(pd_buf, pd_buf_len);
|
||||
|
||||
/* Remove trailing comma */
|
||||
if (pd_buf[len - 1] == ',')
|
||||
pd_buf[len - 1] = '\0';
|
||||
|
||||
strlcat(pd_buf, ")", pd_buf_len);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user