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

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