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

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