autofs-5.0.7 - fix interface address null check From: Doug Nazar Since commit aa6f7793 [autofs-5.0.7 - fix ipv6 proximity calculation] get_proximity() uses getifaddrs however it crashes on interfaces with no addresses. Fix the NULL check to ignore interfaces with no addresses. Also skip interfaces which are not currently running. --- CHANGELOG | 1 + modules/replicated.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 66c11de..50e83d7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,7 @@ - make dump maps check for duplicate indirect mounts. - document allowed map sources in auto.master. - add enable sloppy mount option to configure. +- fix interface address null check. 25/07/2012 autofs-5.0.7 ======================= diff --git a/modules/replicated.c b/modules/replicated.c index 26f64b8..6dbdade 100644 --- a/modules/replicated.c +++ b/modules/replicated.c @@ -165,8 +165,9 @@ static unsigned int get_proximity(struct sockaddr *host_addr) this = ifa; while (this) { - if (this->ifa_flags & IFF_POINTOPOINT || - this->ifa_addr->sa_data == NULL) { + if (!(this->ifa_flags & IFF_UP) || + this->ifa_flags & IFF_POINTOPOINT || + this->ifa_addr == NULL) { this = this->ifa_next; continue; } @@ -202,8 +203,9 @@ static unsigned int get_proximity(struct sockaddr *host_addr) this = ifa; while (this) { - if (this->ifa_flags & IFF_POINTOPOINT || - this->ifa_addr->sa_data == NULL) { + if (!(this->ifa_flags & IFF_UP) || + this->ifa_flags & IFF_POINTOPOINT || + this->ifa_addr == NULL) { this = this->ifa_next; continue; }