File autofs-5.0.6-fix-ipv6-name-lookup-check.patch of Package autofs.import5769
commit fd0d9f0355b181ff0e5fec8e93512642a2e9152e
Author: Ian Kent <raven@themaw.net>
Date: Thu Dec 1 18:34:49 2011 +0800
autofs-5.0.6 - fix ipv6 name lookup check
The host address must be used when the host name has multiple
addresses since we need to mount the specific host and so that
it is known what host log entries refer to.
But the check for multiple addresses can be wrong because there
is no distinction between ipv4 and ipv6 addresses. Change the
check to use the host name when mounting if neither the ipv4
or the ipv6 addresses have more than one record.
Index: autofs-5.0.5/modules/replicated.c
===================================================================
--- autofs-5.0.5.orig/modules/replicated.c
+++ autofs-5.0.5/modules/replicated.c
@@ -1115,7 +1115,7 @@ static int add_host_addrs(struct host **
char *name = n_ptr = strdup(host);
int len;
char buf[MAX_ERR_BUF];
- int rr = 0;
+ int rr = 0, rr4 = 0, rr6 = 0;
int ret;
if (!name) {
@@ -1165,8 +1165,21 @@ try_name:
}
this = ni;
- if (this->ai_next)
+ while (this->ai_next) {
+ if (this->ai_family == AF_INET) {
+ struct sockaddr_in *addr = (struct sockaddr_in *) this->ai_addr;
+ if (addr->sin_addr.s_addr != INADDR_LOOPBACK)
+ rr4++;
+ } else if (this->ai_family == AF_INET6) {
+ struct sockaddr_in6 *addr = (struct sockaddr_in6 *) this->ai_addr;
+ if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.__in6_u.__u6_addr32))
+ rr6++;
+ }
+ this = this->ai_next;
+ }
+ if (rr4 > 1 || rr6 > 1)
rr++;
+ this = ni;
while (this) {
ret = add_new_host(list, host, weight, this, rr, options);
if (!ret)
Index: autofs-5.0.5/CHANGELOG
===================================================================
--- autofs-5.0.5.orig/CHANGELOG
+++ autofs-5.0.5/CHANGELOG
@@ -89,6 +89,7 @@
- fix wait for master source mutex.
- fix submount shutdown race.
- fix fix map source check in file lookup.
+- fix ipv6 name lookup check.
03/09/2009 autofs-5.0.5
-----------------------