]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Allow to specify interfaces to display on lldpctl command line
authorVincent Bernat <bernat@luffy.cx>
Fri, 12 Dec 2008 21:32:55 +0000 (22:32 +0100)
committerVincent Bernat <bernat@luffy.cx>
Fri, 12 Dec 2008 21:32:55 +0000 (22:32 +0100)
man/lldpctl.8
src/lldpctl.c

index 0179a690f4cbc7b222816e78aac2afeadf759ed2..60a0bb6f6cec28c2e74333830ab91225ac6a77e9 100644 (file)
 .Os
 .Sh NAME
 .Nm lldpctl
-.Nd control the LLDP daemon
+.Nd retrieve neighbors discovered by the LLDP daemon
 .Sh SYNOPSIS
 .Nm
 .Op Fl d
+.Op Ar interface ...
 .Sh DESCRIPTION
 The
 .Nm
@@ -39,6 +40,9 @@ The options are as follows:
 .It Fl d
 Enable more debugging information.
 .El
+.Pp
+Optionally, interfaces to display may be specified on the command
+line. By default, all interfaces are displayed.
 .Sh FILES
 .Bl -tag -width "/var/run/lldpd.socketXX" -compact
 .It /var/run/lldpd.socket
index 1e0eae0b5e47b971f837047ed556ca73a7de828f..7f9ea63cbc4177c5ea9e762444eb2566c3a525d4 100644 (file)
@@ -764,7 +764,7 @@ display_vlans(struct lldpd_port *port)
 int
 main(int argc, char *argv[])
 {
-       int s;
+       int s, i;
        int ch, debug = 1;
        struct interfaces ifs;
 #ifdef ENABLE_DOT1
@@ -786,7 +786,7 @@ main(int argc, char *argv[])
                default:
                        usage();
                }
-       }
+       }               
        
        log_init(debug);
        memset(sep, '-', 79);
@@ -800,6 +800,13 @@ main(int argc, char *argv[])
        printf("    LLDP neighbors\n");
        printf("%s\n", sep);    
        TAILQ_FOREACH(iff, &ifs, next) {
+               if (optind < argc) {
+                       for (i = optind; i < argc; i++)
+                               if (strncmp(argv[i], iff->name, IFNAMSIZ) == 0)
+                                       break;
+                       if (i == argc)
+                               continue;
+               }
                if ((get_chassis(s, &chassis, iff->name) != -1) &&
                    (get_port(s, &port, iff->name) != -1)) {
                        printf("Interface: %s\n", iff->name);