]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Display PVID even when we don't know its name.
authorVincent Bernat <bernat@luffy.cx>
Sat, 5 Dec 2009 10:49:30 +0000 (11:49 +0100)
committerVincent Bernat <bernat@luffy.cx>
Sat, 5 Dec 2009 10:50:26 +0000 (11:50 +0100)
We also display it if we have names for some VLANs but not for the
PVID one.

src/lldpctl.c

index 6e30c48fda20f28bb89cfb7b05b6712842b6a2c3..f4ec58ca8d1fe406d910d28f4054ee714c1ee088 100644 (file)
@@ -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