nfs-utils/nfs-utils-1.2.1-default-family.patch
Steve Dickson 9eb77489c1 - mount.nfs: Configuration file parser ignoring options
- mount.nfs: Set the default family for lookups based on defaultproto=
    setting
- Enabled ipv6
2010-01-21 10:57:40 +00:00

77 lines
2.2 KiB
Diff

diff -up nfs-utils-1.2.1/utils/mount/configfile.c.orig nfs-utils-1.2.1/utils/mount/configfile.c
--- nfs-utils-1.2.1/utils/mount/configfile.c.orig 2010-01-21 05:20:04.257284410 -0500
+++ nfs-utils-1.2.1/utils/mount/configfile.c 2010-01-21 05:20:49.616131234 -0500
@@ -222,6 +222,12 @@ int inline check_vers(char *mopt, char *
unsigned long config_default_vers;
unsigned long config_default_proto;
+#ifdef IPV6_SUPPORTED
+sa_family_t config_default_family = AF_UNSPEC;
+#else
+sa_family_t config_default_family = AF_INET;
+#endif
+
/*
* Check to see if a default value is being set.
* If so, set the appropriate global value which will
@@ -243,6 +249,12 @@ int inline default_value(char *mopt)
xlog_warn("Unable to set default protocol : %s",
strerror(errno));
}
+#ifdef IPV6_SUPPORTED
+ if (!nfs_nfs_proto_family(options, &config_default_family)) {
+ xlog_warn("Unable to set default family : %s",
+ strerror(errno));
+ }
+#endif
} else {
xlog_warn("Unable to alloc memory for default protocol");
}
diff -up nfs-utils-1.2.1/utils/mount/network.c.orig nfs-utils-1.2.1/utils/mount/network.c
--- nfs-utils-1.2.1/utils/mount/network.c.orig 2010-01-21 05:20:04.252304404 -0500
+++ nfs-utils-1.2.1/utils/mount/network.c 2010-01-21 05:20:49.617183039 -0500
@@ -54,6 +54,16 @@
#include "network.h"
#include "conffile.h"
+#ifdef MOUNT_CONFIG
+extern sa_family_t config_default_family;
+#else
+#ifdef IPV6_SUPPORTED
+sa_family_t config_default_family = AF_UNSPEC;
+#else
+sa_family_t config_default_family = AF_INET;
+#endif
+#endif
+
#define PMAP_TIMEOUT (10)
#define CONNECT_TIMEOUT (20)
#define MOUNT_TIMEOUT (30)
@@ -1342,12 +1352,7 @@ int nfs_nfs_proto_family(struct mount_op
unsigned long protocol;
char *option;
-#ifdef IPV6_SUPPORTED
- *family = AF_UNSPEC;
-#else
- *family = AF_INET;
-#endif
-
+ *family = config_default_family;
switch (po_rightmost(options, nfs_transport_opttbl)) {
case 0: /* udp */
return 1;
@@ -1489,11 +1494,7 @@ int nfs_mount_proto_family(struct mount_
unsigned long protocol;
char *option;
-#ifdef HAVE_LIBTIRPC
- *family = AF_UNSPEC;
-#else
- *family = AF_INET;
-#endif
+ *family = config_default_family;
option = po_get(options, "mountproto");
if (option != NULL)