mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02: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,
|
const char *zebra_protodown_rc_str(uint32_t protodown_rc, char *pd_buf,
|
||||||
uint32_t pd_buf_len)
|
uint32_t pd_buf_len)
|
||||||
{
|
{
|
||||||
bool first = true;
|
|
||||||
|
|
||||||
pd_buf[0] = '\0';
|
pd_buf[0] = '\0';
|
||||||
|
size_t len;
|
||||||
|
|
||||||
strlcat(pd_buf, "(", pd_buf_len);
|
strlcat(pd_buf, "(", pd_buf_len);
|
||||||
|
|
||||||
if (protodown_rc & ZEBRA_PROTODOWN_EXTERNAL) {
|
if (protodown_rc & ZEBRA_PROTODOWN_EXTERNAL)
|
||||||
if (first)
|
strlcat(pd_buf, "external,", pd_buf_len);
|
||||||
first = false;
|
|
||||||
else
|
|
||||||
strlcat(pd_buf, ",", pd_buf_len);
|
|
||||||
strlcat(pd_buf, "external", pd_buf_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY) {
|
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY)
|
||||||
if (first)
|
strlcat(pd_buf, "startup-delay,", pd_buf_len);
|
||||||
first = false;
|
|
||||||
else
|
|
||||||
strlcat(pd_buf, ",", pd_buf_len);
|
|
||||||
strlcat(pd_buf, "startup-delay", pd_buf_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN) {
|
if (protodown_rc & ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN)
|
||||||
if (first)
|
strlcat(pd_buf, "uplinks-down,", pd_buf_len);
|
||||||
first = false;
|
|
||||||
else
|
|
||||||
strlcat(pd_buf, ",", pd_buf_len);
|
|
||||||
strlcat(pd_buf, "uplinks-down", pd_buf_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protodown_rc & ZEBRA_PROTODOWN_VRRP) {
|
if (protodown_rc & ZEBRA_PROTODOWN_VRRP)
|
||||||
if (first)
|
strlcat(pd_buf, "vrrp,", pd_buf_len);
|
||||||
first = false;
|
|
||||||
else
|
|
||||||
strlcat(pd_buf, ",", pd_buf_len);
|
|
||||||
strlcat(pd_buf, "vrrp", pd_buf_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protodown_rc & ZEBRA_PROTODOWN_SHARP) {
|
if (protodown_rc & ZEBRA_PROTODOWN_SHARP)
|
||||||
if (!first)
|
strlcat(pd_buf, "sharp,", pd_buf_len);
|
||||||
strlcat(pd_buf, ",", pd_buf_len);
|
|
||||||
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);
|
strlcat(pd_buf, ")", pd_buf_len);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue