From 5bbe5fd0bb33749ac8e26231fc42f48ca0643287 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 5 Dec 2009 11:44:11 +0100 Subject: [PATCH] Cope with Port VLAN ID but no VLAN names. This fix ticket #30. --- src/lldpctl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lldpctl.c b/src/lldpctl.c index 6ab7a56c..6e30c48f 100644 --- a/src/lldpctl.c +++ b/src/lldpctl.c @@ -816,6 +816,8 @@ display_vlans(struct lldpd_port *port) (i++ % 2) ? '\n' : ' '); if (i % 2) printf("\n"); + if (i == 0 && port->p_pvid) + printf(" *VLAN %4d\n", port->p_pvid); } #endif @@ -885,12 +887,11 @@ display_interfaces(int s, int argc, char *argv[]) printf("\n"); display_port(&port); #ifdef ENABLE_DOT1 - if (get_vlans(s, &vls, iff->name, i) != -1) { + if (get_vlans(s, &vls, iff->name, i) != -1) memcpy(&port.p_vlans, &vls, sizeof(struct vlans)); - if (!TAILQ_EMPTY(&port.p_vlans)) { - printf("\n"); - display_vlans(&port); - } + if (!TAILQ_EMPTY(&port.p_vlans) || port.p_pvid) { + printf("\n"); + display_vlans(&port); } #endif #ifdef ENABLE_LLDPMED -- 2.39.5