|
|
4d476f |
autofs-5.1.1 - add configuration option to use fqdn in mounts
|
|
|
4d476f |
|
|
|
4d476f |
From: Ian Kent <raven@themaw.net>
|
|
|
4d476f |
|
|
|
4d476f |
When a server name returns multiple IP addresses autofs uses the IP
|
|
|
4d476f |
address when performing the mount to ensure that the the host proximity
|
|
|
4d476f |
order is respected, and that servers that aren't responding aren't
|
|
|
4d476f |
tried.
|
|
|
4d476f |
|
|
|
4d476f |
But sometimes people need to use the server name for the mount so
|
|
|
4d476f |
add a configuration option to enable that.
|
|
|
4d476f |
|
|
|
4d476f |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
4d476f |
---
|
|
|
4d476f |
CHANGELOG | 1 +
|
|
|
4d476f |
include/defaults.h | 3 +++
|
|
|
4d476f |
lib/defaults.c | 18 ++++++++++++++++++
|
|
|
4d476f |
man/autofs.conf.5.in | 18 ++++++++++++++++++
|
|
|
4d476f |
modules/mount_nfs.c | 3 ++-
|
|
|
4d476f |
modules/replicated.c | 6 ++++++
|
|
|
4d476f |
redhat/autofs.conf.default.in | 8 ++++++++
|
|
|
4d476f |
samples/autofs.conf.default.in | 8 ++++++++
|
|
|
4d476f |
8 files changed, 64 insertions(+), 1 deletion(-)
|
|
|
4d476f |
|
|
|
4d476f |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
4d476f |
+++ autofs-5.0.7/CHANGELOG
|
|
|
4d476f |
@@ -203,6 +203,7 @@
|
|
|
4d476f |
- fix use after free in sun parser parse_init().
|
|
|
4d476f |
- fix use after free in open_lookup().
|
|
|
4d476f |
- fix typo in autofs_sasl_bind().
|
|
|
4d476f |
+- add configuration option to use fqdn in mounts.
|
|
|
4d476f |
|
|
|
4d476f |
25/07/2012 autofs-5.0.7
|
|
|
4d476f |
=======================
|
|
|
4d476f |
--- autofs-5.0.7.orig/include/defaults.h
|
|
|
4d476f |
+++ autofs-5.0.7/include/defaults.h
|
|
|
4d476f |
@@ -47,6 +47,8 @@
|
|
|
4d476f |
|
|
|
4d476f |
#define DEFAULT_MAP_HASH_TABLE_SIZE "1024"
|
|
|
4d476f |
|
|
|
4d476f |
+#define DEFAULT_USE_HOSTNAME_FOR_MOUNTS "0"
|
|
|
4d476f |
+
|
|
|
4d476f |
/* Config entry flags */
|
|
|
4d476f |
#define CONF_NONE 0x00000000
|
|
|
4d476f |
#define CONF_ENV 0x00000001
|
|
|
4d476f |
@@ -162,6 +164,7 @@ unsigned int defaults_get_mount_wait(voi
|
|
|
4d476f |
unsigned int defaults_get_umount_wait(void);
|
|
|
4d476f |
const char *defaults_get_auth_conf_file(void);
|
|
|
4d476f |
unsigned int defaults_get_map_hash_table_size(void);
|
|
|
4d476f |
+unsigned int defaults_use_hostname_for_mounts(void);
|
|
|
4d476f |
|
|
|
4d476f |
unsigned int conf_amd_mount_section_exists(const char *);
|
|
|
4d476f |
char *conf_amd_get_arch(void);
|
|
|
4d476f |
--- autofs-5.0.7.orig/lib/defaults.c
|
|
|
4d476f |
+++ autofs-5.0.7/lib/defaults.c
|
|
|
4d476f |
@@ -72,6 +72,8 @@
|
|
|
4d476f |
|
|
|
4d476f |
#define NAME_MAP_HASH_TABLE_SIZE "map_hash_table_size"
|
|
|
4d476f |
|
|
|
4d476f |
+#define NAME_USE_HOSTNAME_FOR_MOUNTS "use_hostname_for_mounts"
|
|
|
4d476f |
+
|
|
|
4d476f |
#define NAME_AMD_ARCH "arch"
|
|
|
4d476f |
#define NAME_AMD_AUTO_ATTRCACHE "auto_attrcache"
|
|
|
4d476f |
#define NAME_AMD_AUTO_DIR "auto_dir"
|
|
|
4d476f |
@@ -334,6 +336,11 @@ static int conf_load_autofs_defaults(voi
|
|
|
4d476f |
if (ret == CFG_FAIL)
|
|
|
4d476f |
goto error;
|
|
|
4d476f |
|
|
|
4d476f |
+ ret = conf_update(sec, NAME_USE_HOSTNAME_FOR_MOUNTS,
|
|
|
4d476f |
+ DEFAULT_USE_HOSTNAME_FOR_MOUNTS, CONF_ENV);
|
|
|
4d476f |
+ if (ret == CFG_FAIL)
|
|
|
4d476f |
+ goto error;
|
|
|
4d476f |
+
|
|
|
4d476f |
/* LDAP_URI and SEARCH_BASE can occur multiple times */
|
|
|
4d476f |
while ((co = conf_lookup(sec, NAME_LDAP_URI)))
|
|
|
4d476f |
conf_delete(co->section, co->name);
|
|
|
4d476f |
@@ -1700,6 +1707,17 @@ unsigned int defaults_get_map_hash_table
|
|
|
4d476f |
return (unsigned int) size;
|
|
|
4d476f |
}
|
|
|
4d476f |
|
|
|
4d476f |
+unsigned int defaults_use_hostname_for_mounts(void)
|
|
|
4d476f |
+{
|
|
|
4d476f |
+ int res;
|
|
|
4d476f |
+
|
|
|
4d476f |
+ res = conf_get_yesno(autofs_gbl_sec, NAME_USE_HOSTNAME_FOR_MOUNTS);
|
|
|
4d476f |
+ if (res < 0)
|
|
|
4d476f |
+ res = atoi(DEFAULT_USE_HOSTNAME_FOR_MOUNTS);
|
|
|
4d476f |
+
|
|
|
4d476f |
+ return res;
|
|
|
4d476f |
+}
|
|
|
4d476f |
+
|
|
|
4d476f |
unsigned int conf_amd_mount_section_exists(const char *section)
|
|
|
4d476f |
{
|
|
|
4d476f |
return conf_section_exists(section);
|
|
|
4d476f |
--- autofs-5.0.7.orig/man/autofs.conf.5.in
|
|
|
4d476f |
+++ autofs-5.0.7/man/autofs.conf.5.in
|
|
|
4d476f |
@@ -111,6 +111,24 @@ entries, in this case, is usually much l
|
|
|
4d476f |
in the map. In this last case it would be unusual for the map entry
|
|
|
4d476f |
cache to grow large enough to warrant increasing the default before
|
|
|
4d476f |
an event that cleans stale entries, a map re-read for example.
|
|
|
4d476f |
+.TP
|
|
|
4d476f |
+.B use_hostname_for_mounts
|
|
|
4d476f |
+.br
|
|
|
4d476f |
+NFS mounts where the host name resolves to more than one IP address
|
|
|
4d476f |
+are probed for availability and to establish the order in which mounts
|
|
|
4d476f |
+to them should be tried. To ensure that mount attempts are made only
|
|
|
4d476f |
+to hosts that are responding and are tried in the order of hosts with
|
|
|
4d476f |
+the quickest response the IP address of the host needs to be used for
|
|
|
4d476f |
+the mount.
|
|
|
4d476f |
+
|
|
|
4d476f |
+If it is necessary to use the hostname given in the map entry for the
|
|
|
4d476f |
+mount regardless, then set this option to "yes".
|
|
|
4d476f |
+
|
|
|
4d476f |
+Be aware that if this is done there is no defense against the host
|
|
|
4d476f |
+name resolving to one that isn't responding and while the number
|
|
|
4d476f |
+of attempts at a successful mount will correspond to the number of
|
|
|
4d476f |
+addresses the host name resolves to the order will also not correspond
|
|
|
4d476f |
+to fastest responding hosts.
|
|
|
4d476f |
.SS LDAP Configuration
|
|
|
4d476f |
.P
|
|
|
4d476f |
Configuration settings available are:
|
|
|
4d476f |
--- autofs-5.0.7.orig/modules/mount_nfs.c
|
|
|
4d476f |
+++ autofs-5.0.7/modules/mount_nfs.c
|
|
|
4d476f |
@@ -316,7 +316,8 @@ dont_probe:
|
|
|
4d476f |
|
|
|
4d476f |
/* Not a local host - do an NFS mount */
|
|
|
4d476f |
|
|
|
4d476f |
- if (this->rr && this->addr) {
|
|
|
4d476f |
+ if (this->rr && this->addr &&
|
|
|
4d476f |
+ !defaults_use_hostname_for_mounts()) {
|
|
|
4d476f |
socklen_t len = INET6_ADDRSTRLEN;
|
|
|
4d476f |
char n_buf[len + 1];
|
|
|
4d476f |
const char *n_addr;
|
|
|
4d476f |
--- autofs-5.0.7.orig/modules/replicated.c
|
|
|
4d476f |
+++ autofs-5.0.7/modules/replicated.c
|
|
|
4d476f |
@@ -667,6 +667,12 @@ int prune_host_list(unsigned logopt, str
|
|
|
4d476f |
if (!*list)
|
|
|
4d476f |
return 0;
|
|
|
4d476f |
|
|
|
4d476f |
+ /* If we're using the host name then there's no point probing
|
|
|
4d476f |
+ * avialability and respose time.
|
|
|
4d476f |
+ */
|
|
|
4d476f |
+ if (defaults_use_hostname_for_mounts())
|
|
|
4d476f |
+ return 1;
|
|
|
4d476f |
+
|
|
|
4d476f |
/* Use closest hosts to choose NFS version */
|
|
|
4d476f |
|
|
|
4d476f |
first = *list;
|
|
|
4d476f |
--- autofs-5.0.7.orig/redhat/autofs.conf.default.in
|
|
|
4d476f |
+++ autofs-5.0.7/redhat/autofs.conf.default.in
|
|
|
4d476f |
@@ -142,6 +142,14 @@ mount_nfs_default_protocol = 4
|
|
|
4d476f |
#
|
|
|
4d476f |
#map_hash_table_size = 1024
|
|
|
4d476f |
#
|
|
|
4d476f |
+# use_hostname_for_mounts - nfs mounts where the host name resolves
|
|
|
4d476f |
+# to more than one IP address normally need
|
|
|
4d476f |
+# to use the IP address to esure a mount to
|
|
|
4d476f |
+# a host that isn't responding isn't done.
|
|
|
4d476f |
+# If that behaviour is not wanted then set
|
|
|
4d476f |
+# ths to "yes", default is "no".
|
|
|
4d476f |
+#
|
|
|
4d476f |
+#use_hostname_for_mounts = "no"
|
|
|
4d476f |
#
|
|
|
4d476f |
# Otions for the amd parser within autofs.
|
|
|
4d476f |
#
|
|
|
4d476f |
--- autofs-5.0.7.orig/samples/autofs.conf.default.in
|
|
|
4d476f |
+++ autofs-5.0.7/samples/autofs.conf.default.in
|
|
|
4d476f |
@@ -141,6 +141,14 @@ browse_mode = no
|
|
|
4d476f |
#
|
|
|
4d476f |
#map_hash_table_size = 1024
|
|
|
4d476f |
#
|
|
|
4d476f |
+# use_hostname_for_mounts - nfs mounts where the host name resolves
|
|
|
4d476f |
+# to more than one IP address normally need
|
|
|
4d476f |
+# to use the IP address to esure a mount to
|
|
|
4d476f |
+# a host that isn't responding isn't done.
|
|
|
4d476f |
+# If that behaviour is not wanted then set
|
|
|
4d476f |
+# ths to "yes", default is "no".
|
|
|
4d476f |
+#
|
|
|
4d476f |
+#use_hostname_for_mounts = "no"
|
|
|
4d476f |
#
|
|
|
4d476f |
# Otions for the amd parser within autofs.
|
|
|
4d476f |
#
|