+ Add a new output (keyvalue) for lldpctl.
* Fixes:
- + Ignore interface with no queue. It should filter out interfaces
- like "vnet0" that would fail if we try to send something on them.
+ + Ignore interface with no queue.
+ + Ignore VMWare interfaces.
lldpd (0.5.0)
#include <linux/sockios.h>
#include <linux/filter.h>
#include <linux/if_packet.h>
+#include <regex.h>
#define SYSFS_PATH_MAX 256
#define MAX_PORTS 1024
}
}
+void
+lldpd_ifh_blacklist(struct lldpd *cfg, struct ifaddrs *ifap)
+{
+ struct ifaddrs *ifa;
+ const char* blacklisted[] = {
+ "vnet[0-9][0-9]*",
+ NULL
+ };
+ const char **f;
+ regex_t preg;
+
+ for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
+ if (!ifa->ifa_flags)
+ continue;
+
+ for (f=blacklisted; *f != NULL; f++) {
+ if (regcomp(&preg, *f, REG_NOSUB) != 0)
+ /* Should not happen */
+ fatal("unable to compile a regex");
+ if (regexec(&preg, ifa->ifa_name, 0, NULL, 0) == 0) {
+ regfree(&preg);
+ break;
+ }
+ regfree(&preg);
+ }
+ if (*f != NULL)
+ ifa->ifa_flags = 0; /* Blacklisted */
+ }
+}
static int
iface_eth_init(struct lldpd *cfg, struct lldpd_hardware *hardware)
struct ifaddrs *ifap;
struct lldpd_hardware *hardware;
lldpd_ifhandlers ifhs[] = {
+ lldpd_ifh_blacklist, /* Do not handle those interfaces */
lldpd_ifh_bond, /* Handle bond */
lldpd_ifh_eth, /* Handle classic ethernet interfaces */
#ifdef ENABLE_DOT1
int ctl_msg_unpack_structure(char *, void *, unsigned int, struct hmsg *, void **);
/* interfaces.c */
+void lldpd_ifh_blacklist(struct lldpd *, struct ifaddrs *);
void lldpd_ifh_bond(struct lldpd *, struct ifaddrs *);
void lldpd_ifh_eth(struct lldpd *, struct ifaddrs *);
#ifdef ENABLE_DOT1