From 26ba45e33dafab0cf0f7fc83f747cff8ab32c3b6 Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Sun, 14 Jun 2020 07:31:45 -0700 Subject: [PATCH] zebra: update protodown display protodown state is a combination of the dplane and zebra states. protodown reason is maintained exclusively by zebra. Display this information on two separate lines to make that ownership clearer. Also display n/a for bonds as the dplane doesn't support protodowning the bond device. Sample output - ============== root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"|grep -i protodown protodown: off (n/a) protodown reasons: (uplinks-down) root@torm-11:mgmt:~# vtysh -c "show interface swp5"|grep -i protodown protodown: on protodown reasons: (uplinks-down) root@torm-11:mgmt:~# PS: Cosmetic changes only, no functional change. Signed-off-by: Anuradha Karuppiah --- zebra/interface.c | 17 ++++++++++++----- zebra/zebra_evpn_mh.c | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index ddad9c9e56..4072eb1568 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1428,6 +1428,14 @@ const char *zebra_protodown_rc_str(enum protodown_reasons protodown_rc, return pd_buf; } +static inline bool if_is_protodown_applicable(struct interface *ifp) +{ + if (IS_ZEBRA_IF_BOND(ifp)) + return false; + + return true; +} + /* Interface's information print out to vty interface. */ static void if_dump_vty(struct vty *vty, struct interface *ifp) { @@ -1592,14 +1600,13 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp) } zebra_evpn_if_es_print(vty, zebra_if); - vty_out(vty, " protodown: %s", - (zebra_if->flags & ZIF_FLAG_PROTODOWN) ? "on" : "off"); + vty_out(vty, " protodown: %s %s\n", + (zebra_if->flags & ZIF_FLAG_PROTODOWN) ? "on" : "off", + if_is_protodown_applicable(ifp) ? "" : "(n/a)"); if (zebra_if->protodown_rc) - vty_out(vty, " rc: %s\n", + vty_out(vty, " protodown reasons: %s\n", zebra_protodown_rc_str(zebra_if->protodown_rc, pd_buf, sizeof(pd_buf))); - else - vty_out(vty, "\n"); if (zebra_if->link_ifindex != IFINDEX_INTERNAL) { if (zebra_if->link) diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index b1b01ba75e..436eb9ea8f 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -3029,7 +3029,7 @@ void zebra_evpn_mh_print(struct vty *vty) vty_out(vty, " uplink-cfg-cnt: %u, uplink-active-cnt: %u\n", zmh_info->uplink_cfg_cnt, zmh_info->uplink_oper_up_cnt); if (zmh_info->protodown_rc) - vty_out(vty, " protodown: %s\n", + vty_out(vty, " protodown reasons: %s\n", zebra_protodown_rc_str(zmh_info->protodown_rc, pd_buf, sizeof(pd_buf))); }