|
Ian Kent |
3d12a7 |
autofs-5.0.6 - fix ipv6 name lookup check
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
From: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
The host address must be used when the host name has multiple
|
|
Ian Kent |
3d12a7 |
addresses since we need to mount the specific host and so that
|
|
Ian Kent |
3d12a7 |
it is known what host log entries refer to.
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
But the check for multiple addresses can be wrong because there
|
|
Ian Kent |
3d12a7 |
is no distinction between ipv4 and ipv6 addresses. Change the
|
|
Ian Kent |
3d12a7 |
check to use the host name when mounting if neither the ipv4
|
|
Ian Kent |
3d12a7 |
or the ipv6 addresses have more than one record.
|
|
Ian Kent |
3d12a7 |
---
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
CHANGELOG | 1 +
|
|
Ian Kent |
3d12a7 |
modules/replicated.c | 17 +++++++++++++++--
|
|
Ian Kent |
3d12a7 |
2 files changed, 16 insertions(+), 2 deletions(-)
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
--- autofs-5.0.6.orig/CHANGELOG
|
|
Ian Kent |
3d12a7 |
+++ autofs-5.0.6/CHANGELOG
|
|
Ian Kent |
3d12a7 |
@@ -13,6 +13,7 @@
|
|
Ian Kent |
3d12a7 |
- fix submount shutdown race.
|
|
Ian Kent |
3d12a7 |
- fix fix map source check in file lookup.
|
|
Ian Kent |
3d12a7 |
- add disable move mount configure option.
|
|
Ian Kent |
3d12a7 |
+- fix ipv6 name lookup check.
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
28/06/2011 autofs-5.0.6
|
|
Ian Kent |
3d12a7 |
-----------------------
|
|
Ian Kent |
3d12a7 |
--- autofs-5.0.6.orig/modules/replicated.c
|
|
Ian Kent |
3d12a7 |
+++ autofs-5.0.6/modules/replicated.c
|
|
Ian Kent |
3d12a7 |
@@ -1117,7 +1117,7 @@ static int add_host_addrs(struct host **
|
|
Ian Kent |
3d12a7 |
char *name = n_ptr = strdup(host);
|
|
Ian Kent |
3d12a7 |
int len;
|
|
Ian Kent |
3d12a7 |
char buf[MAX_ERR_BUF];
|
|
Ian Kent |
3d12a7 |
- int rr = 0;
|
|
Ian Kent |
3d12a7 |
+ int rr = 0, rr4 = 0, rr6 = 0;
|
|
Ian Kent |
3d12a7 |
int ret;
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
if (!name) {
|
|
Ian Kent |
3d12a7 |
@@ -1167,8 +1167,21 @@ try_name:
|
|
Ian Kent |
3d12a7 |
}
|
|
Ian Kent |
3d12a7 |
|
|
Ian Kent |
3d12a7 |
this = ni;
|
|
Ian Kent |
3d12a7 |
- if (this->ai_next)
|
|
Ian Kent |
3d12a7 |
+ while (this->ai_next) {
|
|
Ian Kent |
3d12a7 |
+ if (this->ai_family == AF_INET) {
|
|
Ian Kent |
3d12a7 |
+ struct sockaddr_in *addr = (struct sockaddr_in *) this->ai_addr;
|
|
Ian Kent |
3d12a7 |
+ if (addr->sin_addr.s_addr != INADDR_LOOPBACK)
|
|
Ian Kent |
3d12a7 |
+ rr4++;
|
|
Ian Kent |
3d12a7 |
+ } else if (this->ai_family == AF_INET6) {
|
|
Ian Kent |
3d12a7 |
+ struct sockaddr_in6 *addr = (struct sockaddr_in6 *) this->ai_addr;
|
|
Ian Kent |
3d12a7 |
+ if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.__in6_u.__u6_addr32))
|
|
Ian Kent |
3d12a7 |
+ rr6++;
|
|
Ian Kent |
3d12a7 |
+ }
|
|
Ian Kent |
3d12a7 |
+ this = this->ai_next;
|
|
Ian Kent |
3d12a7 |
+ }
|
|
Ian Kent |
3d12a7 |
+ if (rr4 > 1 || rr6 > 1)
|
|
Ian Kent |
3d12a7 |
rr++;
|
|
Ian Kent |
3d12a7 |
+ this = ni;
|
|
Ian Kent |
3d12a7 |
while (this) {
|
|
Ian Kent |
3d12a7 |
ret = add_new_host(list, host, weight, this, rr, options);
|
|
Ian Kent |
3d12a7 |
if (!ret)
|