From: Vincent Bernat Date: Fri, 13 Feb 2015 17:06:49 +0000 (+0100) Subject: interfaces: exclude IPv4 link local addresses from management addresses X-Git-Tag: 0.7.14~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b67a7b2829f08bdc483379aec3ef8e4604f4539;p=thirdparty%2Flldpd.git interfaces: exclude IPv4 link local addresses from management addresses Link-local IPv4 addresses (169.254.0.0/16) are not an acceptable management address. Closes #96. --- diff --git a/src/daemon/interfaces.c b/src/daemon/interfaces.c index e2f8c6e9..4f48fde1 100644 --- a/src/daemon/interfaces.c +++ b/src/daemon/interfaces.c @@ -344,8 +344,10 @@ interfaces_helper_chassis(struct lldpd *cfg, #define IN_IS_ADDR_LOOPBACK(a) ((a)->s_addr == htonl(INADDR_LOOPBACK)) #undef IN_IS_ADDR_ANY #define IN_IS_ADDR_ANY(a) ((a)->s_addr == htonl(INADDR_ANY)) +#undef IN_IS_ADDR_LINKLOCAL +#define IN_IS_ADDR_LINKLOCAL(a) (((a)->s_addr & htonl(0xffff0000)) == htonl(0xa9fe0000)) #undef IN_IS_ADDR_GLOBAL -#define IN_IS_ADDR_GLOBAL(a) (!IN_IS_ADDR_LOOPBACK(a) && !IN_IS_ADDR_ANY(a)) +#define IN_IS_ADDR_GLOBAL(a) (!IN_IS_ADDR_LOOPBACK(a) && !IN_IS_ADDR_ANY(a) && !IN_IS_ADDR_LINKLOCAL(a)) #undef IN6_IS_ADDR_GLOBAL #define IN6_IS_ADDR_GLOBAL(a) \ (!IN6_IS_ADDR_LOOPBACK(a) && !IN6_IS_ADDR_LINKLOCAL(a))