.Nd LLDP daemon
.Sh SYNOPSIS
.Nm
-.Op Fl dvxcseik
+.Op Fl dvxcseikl
.Op Fl X Ar socket
.Op Fl m Ar management
.Op Fl M Ar class
using a TCP or UDP socket.
.It Fl c
Enable the support of CDP protocol to deal with Cisco routers that do
-not speak LLDP.
+not speak LLDP. If repeated, CDPv1 packets will be sent even when
+there is no CDP peer detected.
.It Fl f
Enable the support of FDP protocol to deal with Foundry routers that do
-not speak LLDP.
+not speak LLDP. If repeated, FDP packets will be sent even when there
+is no FDP peer detected.
.It Fl s
Enable the support of SONMP protocol to deal with Nortel routers and
-switches that do not speak LLDP.
+switches that do not speak LLDP. If repeated, SONMP packets will be
+sent even when there is no SONMP peer detected.
.It Fl e
Enable the support of EDP protocol to deal with Extreme routers and
-switches that do not speak LLDP.
+switches that do not speak LLDP. If repeated, EDP packets will be sent
+even when there is no EDP peer detected.
+.It Fl l
+Force to send LLDP packets even when there is no LLDP peer detected
+but there is a peer speaking another protocol detected. By default,
+LLDP packets are sent when there is a peer speaking LLDP detected or
+when there is no peer at all.
.It Fl m Ar management
Specify the management address of this system.
.Nm
static struct protocol protos[] =
{
- { LLDPD_MODE_LLDP, 1, "LLDP", ' ', lldp_send, lldp_decode, NULL,
+ { LLDPD_MODE_LLDP, 1, "LLDP", 'l', lldp_send, lldp_decode, NULL,
LLDP_MULTICAST_ADDR },
#ifdef ENABLE_CDP
{ LLDPD_MODE_CDPV1, 0, "CDPv1", 'c', cdpv1_send, cdp_decode, cdpv1_guess,
if (!cfg->g_protocols[i].enabled)
continue;
/* We send only if we have at least one remote system
- * speaking this protocol */
+ * speaking this protocol or if the protocol is forced */
+ if (cfg->g_protocols[i].enabled > 1) {
+ cfg->g_protocols[i].send(cfg, hardware);
+ sent++;
+ continue;
+ }
TAILQ_FOREACH(port, &hardware->h_rports, p_entries) {
if (port->p_protocol ==
cfg->g_protocols[i].mode) {
cfg->g_protocols[i].send(cfg,
hardware);
- sent = 1;
+ sent++;
break;
}
}
* Get and parse command line options
*/
popt = strchr(opts, '@');
- for (i=0; protos[i].mode != 0; i++) {
- if (protos[i].enabled == 1) continue;
+ for (i=0; protos[i].mode != 0; i++)
*(popt++) = protos[i].arg;
- }
*popt = '\0';
while ((ch = getopt(argc, argv, opts)) != -1) {
switch (ch) {
default:
found = 0;
for (i=0; protos[i].mode != 0; i++) {
- if (protos[i].enabled) continue;
if (ch == protos[i].arg) {
- protos[i].enabled = 1;
+ protos[i].enabled++;
+ /* When an argument enable
+ several protocols, only the
+ first one can be forced. */
+ if (found && protos[i].enabled > 1)
+ protos[i].enabled = 1;
found = 1;
}
}
cfg->g_protocols = protos;
for (i=0; protos[i].mode != 0; i++)
- if (protos[i].enabled) {
+ if (protos[i].enabled > 1)
+ LLOG_INFO("protocol %s enabled and forced", protos[i].name);
+ else if (protos[i].enabled)
LLOG_INFO("protocol %s enabled", protos[i].name);
- } else
+ else
LLOG_INFO("protocol %s disabled", protos[i].name);
TAILQ_INIT(&cfg->g_hardware);