summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-04-27 19:55:21 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-04-25 04:22:43 -0400
commitba5165ecccdbe1ff5aa1ca0203e389ef2c269df5 (patch)
tree4fb745732ade02971bcd3d709ac92fbdc948bd83 /zebra/interface.c
parente07daf5f999801a1f929b85b9354a0f126526159 (diff)
zebra: Modify how we display/store os description
The alias/description of an interface in linux was being used to override the internal description. As such let's fix the display to keep track of both if we have it. Config in FRR: ! interface docker0 description another combination ! interface enp3s0 description BAMBOOZLE ME WILL YOU ! Config in linux: sharpd@robot ~/f/zebra> ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 alias This is the loopback you cabbage 2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 74:d0:2b:9c:16:eb brd ff:ff:ff:ff:ff:ff alias HI HI HI Now the 'show int descr' command: robot# show int description Interface Status Protocol Description docker0 up down another combination enp3s0 up up BAMBOOZLE ME WILL YOU HI HI HI lo up up This is the loopback you cabbage Fixes: #4191 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 10f1f92100..b0ddcaf8bc 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -181,6 +181,7 @@ static int if_zebra_delete_hook(struct interface *ifp)
list_delete(&rtadv->AdvDNSSLList);
#endif /* HAVE_RTADV */
+ XFREE(MTYPE_TMP, zebra_if->desc);
THREAD_OFF(zebra_if->speed_update);
XFREE(MTYPE_ZINFO, zebra_if);
@@ -1303,6 +1304,9 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
if (ifp->desc)
vty_out(vty, " Description: %s\n", ifp->desc);
+ if (zebra_if->desc)
+ vty_out(vty, " OS Description: %s\n", zebra_if->desc);
+
if (ifp->ifindex == IFINDEX_INTERNAL) {
vty_out(vty, " pseudo interface\n");
return;
@@ -1696,6 +1700,10 @@ static void if_show_description(struct vty *vty, vrf_id_t vrf_id)
vty_out(vty, "Interface Status Protocol Description\n");
FOR_ALL_INTERFACES (vrf, ifp) {
int len;
+ struct zebra_if *zif;
+ bool intf_desc;
+
+ intf_desc = false;
len = vty_out(vty, "%s", ifp->name);
vty_out(vty, "%*s", (16 - len), " ");
@@ -1715,8 +1723,19 @@ static void if_show_description(struct vty *vty, vrf_id_t vrf_id)
vty_out(vty, "down down ");
}
- if (ifp->desc)
+ if (ifp->desc) {
+ intf_desc = true;
vty_out(vty, "%s", ifp->desc);
+ }
+ zif = ifp->info;
+ if (zif && zif->desc) {
+ vty_out(vty, "%s%s",
+ intf_desc
+ ? "\n "
+ : "",
+ zif->desc);
+ }
+
vty_out(vty, "\n");
}
}