From: Vincent Bernat Date: Sat, 5 Dec 2009 10:49:30 +0000 (+0100) Subject: Display PVID even when we don't know its name. X-Git-Tag: 0.5.0~27^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be1f74526a8fda0491c7d7fb1b1c08ed59e209b8;p=thirdparty%2Flldpd.git 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. --- 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