Blame SOURCES/autofs-5.0.7-fix-interface-address-null-check.patch

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