]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
This is the second iteration of this patch. The only difference here
authorJeff Layton <jlayton@redhat.com>
Fri, 12 Feb 2010 19:23:16 +0000 (14:23 -0500)
committerSteve Dickson <steved@redhat.com>
Fri, 12 Feb 2010 19:23:16 +0000 (14:23 -0500)
is that this one has default_value call nfs_nfs_proto_family regardless
of whether IPV6_SUPPORTED is set.

When IPv6 is enabled, the Proto= config file option is treated as a
netid, and the address family for lookups is selected based on that
setting. The Defaultproto= option however still only affects the
protocol setting for the sockets (IPPROTO_*) and not the address family.

This patch makes it so that if someone sets the "Defaultproto=" option
in the nfsmount.conf, it's used to determine the default address family
for lookups as well as the protocol type.

This gives users a way to force a particular address family to be used
universally for mounts and brings the behavior of the Defaultproto=
option in line with the Proto= option.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/configfile.c
utils/mount/network.c

index 1dd4159a74b97d1ef48a762c7c9143cb07216f82..5cff00928b637a37e3c71a32b9e60d3b59594e9e 100644 (file)
@@ -222,6 +222,8 @@ int inline check_vers(char *mopt, char *field)
 
 unsigned long config_default_vers;
 unsigned long config_default_proto;
 
 unsigned long config_default_vers;
 unsigned long config_default_proto;
+extern sa_family_t config_default_family;
+
 /*
  * Check to see if a default value is being set.
  * If so, set the appropriate global value which will 
 /*
  * Check to see if a default value is being set.
  * If so, set the appropriate global value which will 
@@ -243,6 +245,10 @@ int inline default_value(char *mopt)
                                xlog_warn("Unable to set default protocol : %s", 
                                        strerror(errno));
                        }
                                xlog_warn("Unable to set default protocol : %s", 
                                        strerror(errno));
                        }
+                       if (!nfs_nfs_proto_family(options, &config_default_family)) {
+                               xlog_warn("Unable to set default family : %s", 
+                                       strerror(errno));
+                       }
                } else {
                        xlog_warn("Unable to alloc memory for default protocol");
                }
                } else {
                        xlog_warn("Unable to alloc memory for default protocol");
                }
index 06cab6a4884497f378fcb9577b5180cffcfeab7e..c400dd8beec3ecec07f674be8bc9a864ea6af4bf 100644 (file)
@@ -1332,6 +1332,12 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
        return 1;
 }
 
        return 1;
 }
 
+#ifdef IPV6_SUPPORTED
+sa_family_t    config_default_family = AF_UNSPEC;
+#else
+sa_family_t    config_default_family = AF_INET;
+#endif
+
 /*
  * Returns TRUE and fills in @family if a valid NFS protocol option
  * is found, or FALSE if the option was specified with an invalid value.
 /*
  * Returns TRUE and fills in @family if a valid NFS protocol option
  * is found, or FALSE if the option was specified with an invalid value.
@@ -1342,11 +1348,7 @@ int nfs_nfs_proto_family(struct mount_options *options,
        unsigned long protocol;
        char *option;
 
        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 */
 
        switch (po_rightmost(options, nfs_transport_opttbl)) {
        case 0: /* udp */
@@ -1489,11 +1491,7 @@ int nfs_mount_proto_family(struct mount_options *options,
        unsigned long protocol;
        char *option;
 
        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)
 
        option = po_get(options, "mountproto");
        if (option != NULL)