- mount.nfs: Configuration file parser ignoring options

- mount.nfs: Set the default family for lookups based on defaultproto=
    setting
- Enabled ipv6
This commit is contained in:
Steve Dickson 2010-01-21 10:57:40 +00:00
parent 257636d5d7
commit 9eb77489c1
3 changed files with 141 additions and 1 deletions

View File

@ -0,0 +1,76 @@
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)

View File

@ -0,0 +1,53 @@
commit d63f9e0ccb836d592593a9816ccc00a51c903328
Author: Steve Dickson <steved@redhat.com>
Date: Wed Jan 20 15:05:46 2010 -0500
mount.nfs: Configuration file parser ignoring options
When the protocol version is set on the command line,
none of the variables set in the configuration file
are passed down to the kernel due to a bug in the
parsing routine.
Tested-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index 28b722c..1dd4159 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -194,13 +194,29 @@ void free_all(void)
static char *versions[] = {"v2", "v3", "v4", "vers", "nfsvers", NULL};
int inline check_vers(char *mopt, char *field)
{
- int i;
+ int i, found=0;
- if (strncmp("mountvers", field, strlen("mountvers")) != 0) {
- for (i=0; versions[i]; i++)
- if (strcasestr(mopt, versions[i]) != NULL)
- return 1;
+ /*
+ * First check to see if the config setting is one
+ * of the many version settings
+ */
+ for (i=0; versions[i]; i++) {
+ if (strcasestr(field, versions[i]) != NULL) {
+ found++;
+ break;
+ }
}
+ if (!found)
+ return 0;
+ /*
+ * It appears the version is being set, now see
+ * if the version appears on the command
+ */
+ for (i=0; versions[i]; i++) {
+ if (strcasestr(mopt, versions[i]) != NULL)
+ return 1;
+ }
+
return 0;
}

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils
URL: http://sourceforge.net/projects/nfs
Version: 1.2.1
Release: 12%{?dist}
Release: 13%{?dist}
Epoch: 1
# group all 32bit related archs
@ -21,6 +21,8 @@ Source15: nfs.sysconfig
Patch000: nfs-utils-1.2.2-rc8.patch
Patch001: nfs-utils-1.2.1-compile.patch
Patch002: nfs-utils-1.2.1-statdpath.patch
Patch003: nfs-utils-1.2.1-mount-config.patch
Patch004: nfs-utils-1.2.1-default-family.patch
Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
@ -75,6 +77,8 @@ This package also contains the mount.nfs and umount.nfs program.
%patch000 -p1
%patch001 -p1
%patch002 -p1
%patch003 -p1
%patch004 -p1
%patch100 -p1
%patch101 -p1
@ -100,6 +104,7 @@ CFLAGS="`echo $RPM_OPT_FLAGS $ARCH_OPT_FLAGS $PIE -D_FILE_OFFSET_BITS=64`"
LDFLAGS="-pie" \
--enable-mount \
--enable-mountconfig \
--enable-ipv6 \
--with-statdpath=/var/lib/nfs/statd
make all
@ -250,6 +255,12 @@ fi
%attr(4755,root,root) /sbin/umount.nfs4
%changelog
* Thu Jan 21 2010 Steve Dickson <steved@redhat.com> 1.2.1-13
- mount.nfs: Configuration file parser ignoring options
- mount.nfs: Set the default family for lookups based on
defaultproto= setting
- Enabled ipv6
* Sun Jan 17 2010 Steve Dickson <steved@redhat.com> 1.2.1-12
- Updated to latest upstream RC release: nfs-utils-1-2-2-rc7
which includes Ipv6 support for tcpwrapper (disabled by default).