]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Allow to receive frames on VLAN interfaces.
authorVincent Bernat <vbernat@wanadooportails.com>
Mon, 20 Oct 2008 12:07:33 +0000 (14:07 +0200)
committerVincent Bernat <vbernat@wanadooportails.com>
Mon, 20 Oct 2008 12:07:33 +0000 (14:07 +0200)
man/lldpd.8
src/lldpd.c
src/lldpd.h

index 3f21fc93acc60002fcc56210541f385526c065f6..962c1caaf6b1eb765a93104c09f3821e0e8a4dcf 100644 (file)
@@ -21,7 +21,7 @@
 .Nd LLDP daemon
 .Sh SYNOPSIS
 .Nm
-.Op Fl dxcse
+.Op Fl dvxcse
 .Op Fl m Ar management
 .Op Fl p Ar probe time
 .Sh DESCRIPTION
@@ -54,6 +54,12 @@ If this option is specified,
 will run in the foreground and log to
 .Em stderr .
 This option can be specified many times to increase verbosity.
+.It Fl v
+Listen on VLAN as well. This option might be needed if your equipment
+send frames on VLAN instead of physical interface. This option enables
+.Nm
+to receive frames on VLAN interfaces as well. If you don't need this
+option, do not set it.
 .It Fl x
 Enable SNMP subagent
 With this option,
index e4161b5f37f5f9ee0bc53f31e2bf75ceac7c806d..05299b08d6917ad476da22278965cd3bcdfadcbe 100644 (file)
@@ -171,9 +171,9 @@ usage(void)
 {
        extern const char       *__progname;
 #ifndef USE_SNMP
-       fprintf(stderr, "usage: %s [-d] [-c] [-s] [-e] [-p|-P] [-m ip]\n", __progname);
+       fprintf(stderr, "usage: %s [-d] [-v] [-c] [-s] [-e] [-p|-P] [-m ip]\n", __progname);
 #else /* USE_SNMP */
-       fprintf(stderr, "usage: %s [-d] [-c] [-s] [-e] [-p|-P] [-m ip] [-x]\n", __progname);
+       fprintf(stderr, "usage: %s [-d] [-v] [-c] [-s] [-e] [-p|-P] [-m ip] [-x]\n", __progname);
 #endif /* USE_SNMP */
        exit(1);
 }
@@ -1279,7 +1279,8 @@ lldpd_loop(struct lldpd *cfg)
                        continue;
                }
 
-               if ((iface_is_vlan(cfg, ifa->ifa_name)) ||
+               if (((!cfg->g_listen_vlans) &&
+                       (iface_is_vlan(cfg, ifa->ifa_name))) ||
                    (iface_is_bond(cfg, ifa->ifa_name)))
                        continue;
 
@@ -1351,8 +1352,8 @@ main(int argc, char *argv[])
        struct lldpd *cfg;
        int ch, snmp = 0, debug = 0;
        char *mgmtp = NULL;
-       char *popt, opts[] = "dxm:p:@                    ";
-       int probe = 0, i, found;
+       char *popt, opts[] = "vdxm:p:@                    ";
+       int probe = 0, i, found, vlan = 0;
 
        saved_argv = argv;
 
@@ -1367,6 +1368,9 @@ main(int argc, char *argv[])
        *popt = '\0';
        while ((ch = getopt(argc, argv, opts)) != -1) {
                switch (ch) {
+               case 'v':
+                       vlan = 1;
+                       break;
                case 'd':
                        debug++;
                        break;
@@ -1401,8 +1405,8 @@ main(int argc, char *argv[])
            calloc(1, sizeof(struct lldpd))) == NULL)
                fatal(NULL);
 
-       if (mgmtp != NULL)
-               cfg->g_mgmt_pattern = mgmtp;
+       cfg->g_mgmt_pattern = mgmtp;
+       cfg->g_listen_vlans = vlan;
 
        /* Get ioctl socket */
        if ((cfg->g_sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
index 3051a9008b5ff2d1d7df2273a72624af687eb2bd..bfb075d2853c504b4ff0f9310bbefe1e788f24af 100644 (file)
@@ -174,6 +174,7 @@ struct lldpd {
        struct protocol         *g_protocols;
        int                      g_multi; /* Set to 1 if multiple protocols */
        int                      g_probe_time;
+       int                      g_listen_vlans;
 
        time_t                   g_lastsent;
        int                      g_lastrid;