From: Jeff Layton <jlayton@redhat.com>
To: nfs@lists.sourceforge.net
Subject: [PATCH] nfs-utils: add mountproto= mount option to force mount protocol
Date: Fri, 22 Jun 2007 10:27:33 -0400 [thread overview]
Message-ID: <20070622102733.2686b9ca.jlayton@redhat.com> (raw)
Recently some changes were made to mount.nfs to make mount.nfs use UDP
by default to talk to mountd. If someone specifies tcp or proto=tcp as
an option, then the communication with mountd is also done via TCP.
Most people can just remove these options to work around this since TCP
is the new default. If someone is using shared automount maps on a
network that hosts a mix of clients with different protocol defaults,
then they can't do this without making the old clients fall back to
using UDP.
This patch adds a new mount option "mountproto" that forces the client
to use a specific network protocol when talking to mountd, and updates
the nfs manpage to describe the new option. It should apply cleanly to
current nfs-utils git tree.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
index 673556c..bcc1a13 100644
--- a/utils/mount/nfs.man
+++ b/utils/mount/nfs.man
@@ -170,6 +170,20 @@ for hosts that can run multiple NFS servers.
The default value is 100005 which is the standard RPC
mount daemon program number.
.TP 1.5i
+.I mountproto=n
+Force the mount call to use a specific network protocol
+independent of the NFS protocol used.
+Valid protocol types are
+.IR udp
+and
+.IR tcp .
+The default is to use UDP and then fall back to TCP if the
+server doesn't respond. If the
+.IR proto=tcp
+or
+.IR tcp
+options are specified, then the default is to just use TCP.
+.TP 1.5i
.I mountvers=n
Use an alternate RPC version number to contact the
mount daemon on the remote host. This option is useful
diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c
index 815064a..ec54c99 100644
--- a/utils/mount/nfsmount.c
+++ b/utils/mount/nfsmount.c
@@ -547,6 +547,7 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
struct sockaddr_in *mnt_saddr = &mnt_server->saddr;
struct pmap *mnt_pmap = &mnt_server->pmap;
struct pmap *nfs_pmap = &nfs_server->pmap;
+ unsigned long mountproto = 0;
int len;
char *opt, *opteq, *p, *opt_b;
char *mounthost = NULL;
@@ -714,6 +715,18 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
else
strncpy(data->context, context,
NFS_MAX_CONTEXT_LEN);
+ } else if (!strcmp(opt, "mountproto")) {
+ if (!strcmp(opteq+1, "udp"))
+ mountproto = IPPROTO_UDP;
+#if NFS_MOUNT_VERSION >= 2
+ else if (!strcmp(opteq+1, "tcp") &&
+ nfs_mount_version > 2)
+ mountproto = IPPROTO_TCP;
+#endif
+ else if (sloppy)
+ continue;
+ else
+ goto bad_parameter;
} else if (sloppy)
continue;
else
@@ -822,6 +835,11 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
}
strcat(new_opts, cbuf);
}
+
+ /* override mount protocol if it was specified */
+ if (mountproto)
+ mnt_pmap->pm_prot = mountproto;
+
/* See if the nfs host = mount host. */
if (mounthost) {
if (!nfs_gethostbyname(mounthost, mnt_saddr))
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
reply other threads:[~2007-06-22 14:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070622102733.2686b9ca.jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.