From: Vincent Bernat Date: Mon, 20 Oct 2008 12:07:33 +0000 (+0200) Subject: Allow to receive frames on VLAN interfaces. X-Git-Tag: 0.2~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=766f32b380e47afde2581d118aabcdf1b531cf34;p=thirdparty%2Flldpd.git Allow to receive frames on VLAN interfaces. --- diff --git a/man/lldpd.8 b/man/lldpd.8 index 3f21fc93..962c1caa 100644 --- a/man/lldpd.8 +++ b/man/lldpd.8 @@ -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, diff --git a/src/lldpd.c b/src/lldpd.c index e4161b5f..05299b08 100644 --- a/src/lldpd.c +++ b/src/lldpd.c @@ -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) diff --git a/src/lldpd.h b/src/lldpd.h index 3051a900..bfb075d2 100644 --- a/src/lldpd.h +++ b/src/lldpd.h @@ -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;