* Features:
+ Get OS information from /etc/os-release if available. Patch from
Michael Tremer.
+ + Add a flag to specify which interfaces lldpd should listen to.
lldpd (0.5.3)
* Fixes:
.Op Fl S Ar description
.Op Fl X Ar socket
.Op Fl m Ar management
+.Op Fl I Ar interfaces
.Op Fl M Ar class
.Op Fl H Ar hide
.Sh DESCRIPTION
only sends one management address. It will use the first one that it
finds or the one that you specify with this option. This option can
use wildcards.
+.It Fl I Ar interfaces
+Specify which interface to listen to. Without this option,
+.Nm
+will listen on all available interfaces. This option can use
+wildcards. Several interfaces can be specified separated by commas.
.It Fl M Ar class
Enable emission of LLDP-MED frame. The class should be one of the
following value:
}
}
+void
+lldpd_ifh_whitelist(struct lldpd *cfg, struct ifaddrs *ifap)
+{
+ struct ifaddrs *ifa;
+ char *interfaces = NULL;
+ char *pattern;
+
+ if (!cfg->g_interfaces)
+ return;
+ if ((interfaces = strdup(cfg->g_interfaces)) == NULL) {
+ LLOG_WARNX("unable to allocate memory");
+ return;
+ }
+
+ for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
+ if (ifa->ifa_flags == 0) continue; /* Already handled by someone else */
+ strcpy(interfaces, cfg->g_interfaces); /* Restore our list of interfaces */
+ pattern = strtok(interfaces, ",");
+ while (pattern != NULL) {
+ if (fnmatch(pattern, ifa->ifa_name, 0) == 0) {
+ /* This interface is whitelisted */
+ break;
+ }
+ pattern = strtok(NULL, ",");
+ }
+ if (pattern == NULL) {
+ /* This interface was not found. We flag it. */
+ LLOG_DEBUG("blacklist %s", ifa->ifa_name);
+ ifa->ifa_flags = 0;
+ }
+ }
+
+ free(interfaces);
+}
+
static int
iface_bond_init(struct lldpd *cfg, struct lldpd_hardware *hardware)
{
struct ifaddrs *ifap;
struct lldpd_hardware *hardware;
lldpd_ifhandlers ifhs[] = {
+ lldpd_ifh_whitelist, /* Is the interface whitelisted? */
lldpd_ifh_bond, /* Handle bond */
lldpd_ifh_eth, /* Handle classic ethernet interfaces */
#ifdef ENABLE_DOT1
char *agentx = NULL; /* AgentX socket */
#endif
char *mgmtp = NULL;
+ char *interfaces = NULL;
char *popt, opts[] =
- "H:hkrdxX:m:p:M:S:i@ ";
+ "H:hkrdxX:m:I:p:M:S:i@ ";
int i, found, advertise_version = 1;
#ifdef ENABLE_LLDPMED
int lldpmed = 0, noinventory = 0;
case 'm':
mgmtp = optarg;
break;
+ case 'I':
+ interfaces = optarg;
+ break;
case 'k':
advertise_version = 0;
break;
fatal(NULL);
cfg->g_mgmt_pattern = mgmtp;
+ cfg->g_interfaces = interfaces;
cfg->g_smart = smart;
cfg->g_receiveonly = receiveonly;
TAILQ_HEAD(, lldpd_callback) g_callbacks;
char *g_mgmt_pattern;
+ char *g_interfaces;
char *g_descr_override;
char *g_lsb_release;
int ctl_msg_unpack_structure(char *, void *, unsigned int, struct hmsg *, void **);
/* interfaces.c */
+void lldpd_ifh_whitelist(struct lldpd *, struct ifaddrs *);
void lldpd_ifh_bond(struct lldpd *, struct ifaddrs *);
void lldpd_ifh_eth(struct lldpd *, struct ifaddrs *);
#ifdef ENABLE_DOT1