From: Steve Dickson Date: Sat, 17 Oct 2009 13:26:18 +0000 (-0400) Subject: Use the default protocol and version values, when they X-Git-Tag: nfs-utils-1-2-1-rc7~1 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=a8b90e8f64a7d53b20c0980f2a6d9a8d5945bcc4;hp=2f61f62ac777cc03e30513f6fd3699f9e2f04e27 Use the default protocol and version values, when they are set in the configuration file, to start the negation with the server Signed-off-by: Steve Dickson --- diff --git a/utils/mount/network.c b/utils/mount/network.c index 1a05351..e651167 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -50,6 +50,7 @@ #include "nfsrpc.h" #include "parse_opt.h" #include "network.h" +#include "conffile.h" #define PMAP_TIMEOUT (10) #define CONNECT_TIMEOUT (20) @@ -609,10 +610,19 @@ static int nfs_probe_nfsport(const struct sockaddr *sap, const socklen_t salen, if (pmap->pm_vers && pmap->pm_prot && pmap->pm_port) return 1; - if (nfs_mount_data_version >= 4) + if (nfs_mount_data_version >= 4) { + const unsigned int *probe_proto = probe_tcp_first; + + /* + * If the default proto has been set and + * its not TCP, start with UDP + */ + if (config_default_proto && config_default_proto != IPPROTO_TCP) + probe_proto = probe_udp_first; + return nfs_probe_port(sap, salen, pmap, - probe_nfs3_first, probe_tcp_first); - else + probe_nfs3_first, probe_proto); + } else return nfs_probe_port(sap, salen, pmap, probe_nfs2_only, probe_udp_only); } diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 069bdc1..ceefdb0 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -45,6 +45,7 @@ #include "parse_opt.h" #include "version.h" #include "parse_dev.h" +#include "conffile.h" #ifndef NFS_PROGRAM #define NFS_PROGRAM (100003) @@ -283,6 +284,14 @@ static int nfs_validate_options(struct nfsmount_info *mi) if (option && strcmp(option, "rdma") == 0) mi->version = 3; } + /* + * Use the default value set in the config file when + * the version has not been explicitly set. + */ + if (mi->version == 0 && config_default_vers) { + if (config_default_vers < 4) + mi->version = config_default_vers; + } if (!nfs_append_sloppy_option(mi->options)) return 0;