From be1f74526a8fda0491c7d7fb1b1c08ed59e209b8 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 5 Dec 2009 11:49:30 +0100 Subject: [PATCH] Display PVID even when we don't know its name. We also display it if we have names for some VLANs but not for the PVID one. --- src/lldpctl.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lldpctl.c b/src/lldpctl.c index 6e30c48f..f4ec58ca 100644 --- a/src/lldpctl.c +++ b/src/lldpctl.c @@ -808,16 +808,20 @@ static void display_vlans(struct lldpd_port *port) { int i = 0; + int foundpvid = 0; struct lldpd_vlan *vlan; - TAILQ_FOREACH(vlan, &port->p_vlans, v_entries) + TAILQ_FOREACH(vlan, &port->p_vlans, v_entries) { + if (port->p_pvid == vlan->v_vid) + foundpvid = 1; printf(" %cVLAN %4d: %-20s%c", (port->p_pvid == vlan->v_vid)?'*':' ', vlan->v_vid, vlan->v_name, (i++ % 2) ? '\n' : ' '); - if (i % 2) - printf("\n"); - if (i == 0 && port->p_pvid) + } + if (!foundpvid && port->p_pvid) printf(" *VLAN %4d\n", port->p_pvid); + else if (i % 2) + printf("\n"); } #endif -- 2.39.5