]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Cope with Port VLAN ID but no VLAN names.
authorVincent Bernat <bernat@luffy.cx>
Sat, 5 Dec 2009 10:44:11 +0000 (11:44 +0100)
committerVincent Bernat <bernat@luffy.cx>
Sat, 5 Dec 2009 10:44:11 +0000 (11:44 +0100)
This fix ticket #30.

src/lldpctl.c

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