mount.nfs support for netids
Subsystems (2)
PATCH 3/10 mount.nfs: support netids in v2/v3 version/transport negotiation
In reply to a message not in the archiveWhen rewriting mount options during v2/v3 negotiation, restore the correct netids, rather than protocol names, in the rewritten protocol options. If TI-RPC is not available, the traditional behavior is preserved.
This patch assumes the kernel can recognize a netid, instead of a protocol name, as the value of the proto= options.
---
utils/mount/stropts.c | 51 +++++++++++++++++++++---------------------------- 1 files changed, 22 insertions(+), 29 deletions(-)
utils/mount/stropts.c +22 -29
@@ -38,6 +38,7 @@#include "xcommon.h" #include "mount.h" #include "nls.h" +#include "nfsrpc.h" #include "mount_constants.h" #include "stropts.h" #include "error.h"
@@ -371,10 +372,13 @@ static int nfs_extract_server_addresses(struct mount_options *options, }static int nfs_construct_new_options (struct mount_options *options, +struct sockaddr *nfs_saddr,struct pmap *nfs_pmap, +struct sockaddr *mnt_saddr,struct pmap *mnt_pmap) {char new_option[64 ]; +char *netid;po_remove_all (options,"nfsprog" );po_remove_all (options,"mountprog" );
@@ -391,20 +395,14 @@ static int nfs_construct_new_options(struct mount_options *options,po_remove_all (options,"proto" );po_remove_all (options,"udp" );po_remove_all (options,"tcp" ); -switch (nfs_pmap->pm_prot) { -case IPPROTO_TCP : -snprintf (new_option,sizeof (new_option) -1 , -"proto=tcp" ); -if (po_append (options, new_option) ==PO_FAILED ) -return 0 ; -break ; -case IPPROTO_UDP : -snprintf (new_option,sizeof (new_option) -1 , -"proto=udp" ); -if (po_append (options, new_option) ==PO_FAILED ) -return 0 ; -break ; - } + netid =nfs_get_netid (nfs_saddr->sa_family, nfs_pmap->pm_prot); +if (netid ==NULL ) +return 0 ; +snprintf (new_option,sizeof (new_option) -1 , +"proto=%s" , netid); +free (netid); +if (po_append (options, new_option) ==PO_FAILED ) +return 0 ;po_remove_all (options,"port" );if (nfs_pmap->pm_port !=NFS_PORT ) {
@@ -421,20 +419,14 @@ static int nfs_construct_new_options(struct mount_options *options,return 0 ;po_remove_all (options,"mountproto" ); -switch (mnt_pmap->pm_prot) { -case IPPROTO_TCP : -snprintf (new_option,sizeof (new_option) -1 , -"mountproto=tcp" ); -if (po_append (options, new_option) ==PO_FAILED ) -return 0 ; -break ; -case IPPROTO_UDP : -snprintf (new_option,sizeof (new_option) -1 , -"mountproto=udp" ); -if (po_append (options, new_option) ==PO_FAILED ) -return 0 ; -break ; - } + netid =nfs_get_netid (mnt_saddr->sa_family, mnt_pmap->pm_prot); +if (netid ==NULL ) +return 0 ; +snprintf (new_option,sizeof (new_option) -1 , +"mountproto=%s" , netid); +free (netid); +if (po_append (options, new_option) ==PO_FAILED ) +return 0 ;po_remove_all (options,"mountport" ); snprintf(new_option, sizeof(new_option) - 1,
@@ -510,7 +502,8 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options)return 0 ; } -if (!nfs_construct_new_options (options, &nfs_pmap, &mnt_pmap)) { +if (!nfs_construct_new_options (options, nfs_saddr, &nfs_pmap, + mnt_saddr, &mnt_pmap)) { errno =EINVAL ;return 0 ; }
PATCH 4/10 mount.nfs: make nfs_lookup() global
In reply to a message not in the archiveExpose a DNS query API that allows callers to request DNS results from a specific address family.
---
utils/mount/network.c | 14 ++++++++++++-- utils/mount/network.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-)
utils/mount/network.c +12 -2
@@ -193,8 +193,18 @@ static const unsigned int *nfs_default_proto() }#endif /* MOUNT_CONFIG */ -static int nfs_lookup (const char *hostname,const sa_family_t family, -struct sockaddr *sap,socklen_t *salen) +/** +* nfs_lookup - resolve hostname to an IPv4 or IPv6 socket address +* @hostname: pointer to C string containing DNS hostname to resolve +* @family: address family hint +* @sap: pointer to buffer to fill with socket address +* @len: IN: size of buffer to fill; OUT: size of socket address +* +* Returns 1 and places a socket address at @sap if successful; +* otherwise zero. +*/ +int nfs_lookup (const char *hostname,const sa_family_t family, +struct sockaddr *sap,socklen_t *salen) {struct addrinfo *gai_results;struct addrinfo gai_hint = {
utils/mount/network.h +2 -0
@@ -45,6 +45,8 @@ int nfs_probe_bothports(const struct sockaddr *, const socklen_t, const socklen_t, struct pmap *);int nfs_gethostbyname (const char *,struct sockaddr_in *);int nfs_name_to_address (const char *,struct sockaddr *,socklen_t *); +int nfs_lookup (const char *hostname,const sa_family_t family, +struct sockaddr *sap,socklen_t *salen);int nfs_string_to_sockaddr (const char *,struct sockaddr *,socklen_t *);int nfs_present_sockaddr (const struct sockaddr *,const socklen_t ,char *,const size_t );
cover mount.nfs support for netids
Hi Steve-
For 2.6.33, Trond has included Jeff's patch that adds support to the kernel NFS client for "proto=netid." Here are the user space changes we think are necessary to complete this support. See:
https://bugzilla.redhat.com/show_bug.cgi?id=479350
This series has seen some light testing here, and Jeff is planning to do more of his own independent testing.
Note that last patch in the series has a rather full set of updates to nfs(5) that document NFS client side support for NFS over IPv6, including support for "proto=netid."
Please have a look and let me know what you think.
---
Chuck Lever (10):
NFS man page: update nfs(5) with details about IPv6 support mount.nfs: Remove nfs_name_to_address()
mount.nfs: Teach umount.nfs to recognize netids in /etc/mtab mount.nfs: proto=netid forces address family when resolving server names mount.nfs: Fix sockaddr pointer aliasing in stropts.c mount.nfs: Add new API for getting protocol family from netids mount.nfs: make nfs_lookup() global
mount.nfs: support netids in v2/v3 version/transport negotiation mount.nfs: support netids in nfs_options2pmap()
libnfs.a: Provide shared helpers for managing netids
support/include/nfsrpc.h | 12 ++++ support/nfs/getport.c | 92 +++++++++++++++++++++++++++++++-- utils/mount/network.c | 128 ++++++++++++++++++++++++++++++---------------- utils/mount/network.h | 5 +- utils/mount/nfs.man | 104 ++++++++++++++++++++++++++----------- utils/mount/nfsumount.c | 15 ++++- utils/mount/stropts.c | 114 +++++++++++++++++++++++------------------ 7 files changed, 331 insertions(+), 139 deletions(-)
Signature · 1 line
Chuck Lever <[email protected]>
PATCH 5/10 mount.nfs: Add new API for getting protocol family from netids
In reply to a message not in the archiveIntroduce a couple of new functions that extract the protocol family from the value of the proto= and mountproto= mount options.
---
utils/mount/network.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ utils/mount/network.h | 2 ++ 2 files changed, 65 insertions(+), 0 deletions(-)
utils/mount/network.c +63 -0
@@ -1354,6 +1354,40 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port) }/* +* 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. +*/ +int nfs_nfs_proto_family (struct mount_options *options, +sa_family_t *family) +{ +unsigned long protocol; +char *option; + +#ifdef HAVE_LIBTIRPC + *family =AF_UNSPEC ; +#else + *family =AF_INET ; +#endif + +switch (po_rightmost (options, nfs_transport_opttbl)) { +case 0 :/* udp */ +return 1 ; +case 1 :/* tcp */ +return 1 ; +case 2 :/* proto */ + option =po_get (options,"proto" ); +if (option !=NULL ) +return nfs_get_proto (option, family, &protocol); + } + +/* +* NFS transport protocol wasn't specified. Return the +* default address family. +*/ +return 1 ; +} + +/* * "mountprog" is supported only by the legacy mount command. The * kernel mount client does not support this option. *
@@ -1466,6 +1500,35 @@ nfs_mount_port(struct mount_options *options, unsigned long *port)return 1 ; } +/* +* Returns TRUE and fills in @family if a valid MNT protocol option +* is found, or FALSE if the option was specified with an invalid value. +*/ +int nfs_mount_proto_family (struct mount_options *options, +sa_family_t *family) +{ +unsigned long protocol; +char *option; + +#ifdef HAVE_LIBTIRPC + *family =AF_UNSPEC ; +#else + *family =AF_INET ; +#endif + + option =po_get (options,"mountproto" ); +if (option !=NULL ) +return nfs_get_proto (option, family, &protocol); + +/* +* MNT transport protocol wasn't specified. If the NFS +* transport protocol was specified, derive the family +* from that; otherwise, return the default family for +* NFS. +*/ +return nfs_nfs_proto_family (options, family); +} +/** * nfs_options2pmap - set up pmap structs based on mount options * @options: pointer to mount options
utils/mount/network.h +2 -0
@@ -58,6 +58,8 @@ int clnt_ping(struct sockaddr_in *, const unsigned long,struct mount_options ; +int nfs_nfs_proto_family (struct mount_options *options,sa_family_t *family); +int nfs_mount_proto_family (struct mount_options *options,sa_family_t *family);int nfs_nfs_version (struct mount_options *options,unsigned long *version);int nfs_nfs_protocol (struct mount_options *options,unsigned long *protocol);
PATCH 6/10 mount.nfs: Fix sockaddr pointer aliasing in stropts.c
In reply to a message not in the archiveUsing a sockaddr_storage and casting a sockaddr pointer to it breaks C's aliasing rules.
See:
https://bugzilla.redhat.com/show_bug.cgi?id=448743
Replacing sockaddr_storage makes this code less likely to break when optimized by gcc. It also saves a significant amount of stack space by replacing a 130 byte structure with a union that is less than 32 bytes.
---
utils/mount/stropts.c | 32 +++++++++++++++++++------------- 1 files changed, 19 insertions(+), 13 deletions(-)
utils/mount/stropts.c +19 -13
@@ -77,12 +77,18 @@ extern char *progname;extern int verbose;extern int sloppy; +union nfs_sockaddr { +struct sockaddr sa; +struct sockaddr_in s4; +struct sockaddr_in6 s6; +}; +struct nfsmount_info {const char *spec,/* server:/path */ *node,/* mounted-on dir */ *type;/* "nfs" or "nfs4" */ char *hostname;/* server's hostname */ -struct sockaddr_storage address;/* server's address */ +union nfs_sockaddr address;socklen_t salen;/* size of server's address */ struct mount_options *options;/* parsed mount options */
@@ -205,9 +211,9 @@ static int nfs_append_clientaddr_option(const struct sockaddr *sap,socklen_t salen, struct mount_options *options) { - struct sockaddr_storage dummy; -struct sockaddr *my_addr = (struct sockaddr *)&dummy; -socklen_t my_len =sizeof (dummy); + union nfs_sockaddr address; +struct sockaddr *my_addr = &address.sa; +socklen_t my_len =sizeof (address);if (po_contains (options,"clientaddr" ) ==PO_FOUND )return 1 ;
@@ -224,9 +230,9 @@ static int nfs_append_clientaddr_option(const struct sockaddr *sap,*/ static int nfs_fix_mounthost_option (struct mount_options *options) { -struct sockaddr_storage dummy; -struct sockaddr *sap = (struct sockaddr *)&dummy; -socklen_t salen =sizeof (dummy); +union nfs_sockaddr address; +struct sockaddr *sap = &address.sa; +socklen_t salen =sizeof (address);char *mounthost; mounthost =po_get (options,"mounthost" );
@@ -320,7 +326,7 @@ static int nfs_set_version(struct nfsmount_info *mi)*/ static int nfs_validate_options (struct nfsmount_info *mi) { -struct sockaddr *sap = (struct sockaddr *)&mi->address; +struct sockaddr *sap = &mi->address.sa;if (!nfs_parse_devname (mi->spec, &mi->hostname,NULL ))return 0 ;
@@ -453,12 +459,12 @@ static int nfs_construct_new_options(struct mount_options *options,static int nfs_rewrite_pmap_mount_options (struct mount_options *options) { -struct sockaddr_storage nfs_address; -struct sockaddr *nfs_saddr = (struct sockaddr *)&nfs_address; +union nfs_sockaddr nfs_address; +struct sockaddr *nfs_saddr = &nfs_address.sa;socklen_t nfs_salen =sizeof (nfs_address);struct pmap nfs_pmap; -struct sockaddr_storage mnt_address; -struct sockaddr *mnt_saddr = (struct sockaddr *)&mnt_address; +union nfs_sockaddr mnt_address; +struct sockaddr *mnt_saddr = &mnt_address.sa;socklen_t mnt_salen =sizeof (mnt_address);struct pmap mnt_pmap;char *option;
@@ -594,7 +600,7 @@ out_fail:*/ static int nfs_try_mount_v4 (struct nfsmount_info *mi) { -struct sockaddr *sap = (struct sockaddr *)&mi->address; +struct sockaddr *sap = &mi->address.sa;struct mount_options *options =po_dup (mi->options);int result =0 ;
PATCH 1/10 libnfs.a: Provide shared helpers for managing netids
In reply to a message not in the archiveIntroduce a couple of shared functions that can convert netids to protocol numbers and families, and back.
---
support/include/nfsrpc.h | 12 ++++++ support/nfs/getport.c | 92 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 97 insertions(+), 7 deletions(-)
support/include/nfsrpc.h +12 -0
@@ -90,6 +90,18 @@ extern CLIENT *nfs_get_priv_rpcclient( const struct sockaddr *, struct timeval *);/* +* Convert a netid to a protocol number and protocol family +*/ +extern int nfs_get_proto (const char *netid,sa_family_t *family, +unsigned long *protocol); + +/* +* Convert a protocol family and protocol name to a netid +*/ +extern char *nfs_get_netid (const sa_family_t family, +const unsigned long protocol); + +/* * Convert a socket address to a universal address */ extern char *nfs_sockaddr2universal (const struct sockaddr *);
support/nfs/getport.c +85 -7
126 lines not on this page · raw message
PATCH 2/10 mount.nfs: support netids in nfs_options2pmap()
In reply to a message not in the archiveWhen parsing mount options in nfs_options2pmap(), treat the value of proto= (and mountproto=) as a netid by looking it up in local netconfig and protocol databases to convert it to a protocol number. If TI-RPC is not available, the traditional behavior is preserved.
The meaning of the "udp" and "tcp" mount options is not affected by this change.
---
utils/mount/network.c | 28 ++++++---------------------- 1 files changed, 6 insertions(+), 22 deletions(-)
utils/mount/network.c +6 -22
@@ -1289,6 +1289,7 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)int nfs_nfs_protocol (struct mount_options *options,unsigned long *protocol) { +sa_family_t family;char *option;switch (po_rightmost (options, nfs_transport_opttbl)) {
@@ -1300,17 +1301,8 @@ nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol)return 1 ;case 2 :/* proto */ option =po_get (options,"proto" ); -if (option) { -if (strcmp (option,"tcp" ) ==0 ) { - *protocol =IPPROTO_TCP ; -return 1 ; - } -if (strcmp (option,"udp" ) ==0 ) { - *protocol =IPPROTO_UDP ; -return 1 ; - } -return 0 ; - } +if (option !=NULL ) +return nfs_get_proto (option, &family, protocol); }/*
@@ -1419,20 +1411,12 @@ nfs_mount_version(struct mount_options *options, unsigned long *version)static int nfs_mount_protocol (struct mount_options *options,unsigned long *protocol) { +sa_family_t family;char *option; option =po_get (options,"mountproto" ); -if (option) { -if (strcmp (option,"tcp" ) ==0 ) { - *protocol =IPPROTO_TCP ; -return 1 ; - } -if (strcmp (option,"udp" ) ==0 ) { - *protocol =IPPROTO_UDP ; -return 1 ; - } -return 0 ; - } +if (option !=NULL ) +return nfs_get_proto (option, &family, protocol);/* * MNT transport protocol wasn't specified. If the NFS
PATCH 8/10 mount.nfs: Teach umount.nfs to recognize netids in /etc/mtab
In reply to a message not in the archiveumount.nfs has to detect the correct address family to use when looking up the server.
---
utils/mount/nfsumount.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
utils/mount/nfsumount.c +11 -4
@@ -169,10 +169,15 @@ out:static int nfs_umount_do_umnt (struct mount_options *options,char **hostname,char **dirname) { -struct sockaddr_storage address; -struct sockaddr *sap = (struct sockaddr *)&address; +union { +struct sockaddr sa; +struct sockaddr_in s4; +struct sockaddr_in6 s6; + } address; +struct sockaddr *sap = &address.sa;socklen_t salen =sizeof (address);struct pmap nfs_pmap, mnt_pmap; +sa_family_t family;if (!nfs_options2pmap (options, &nfs_pmap, &mnt_pmap)) {nfs_error (_ ("%s: bad mount options" ), progname);
@@ -189,8 +194,10 @@ static int nfs_umount_do_umnt(struct mount_options *options,return EX_FAIL ; } -if (nfs_name_to_address (*hostname, sap, &salen) ==0 ) -/* nfs_name_to_address reports any errors */ +if (!nfs_mount_proto_family (options, &family)) +return 0 ; +if (!nfs_lookup (*hostname, family, sap, &salen)) +/* nfs_lookup reports any errors */ return EX_FAIL ;if (nfs_advise_umount (sap, salen, &mnt_pmap, dirname) ==0 )
PATCH 7/10 mount.nfs: proto=netid forces address family when resolving server names
In reply to a message not in the archiveUsing the netid settings, determine the correct address family to use for NFS and MNT server name resolution. Use this family when resolving the server name for the addr= and mountaddr= options.
This patch assumes the kernel can recognize a netid, instead of a protocol name, as the value of the proto= options.
---
utils/mount/stropts.c | 31 +++++++++++++++++++++++-------- 1 files changed, 23 insertions(+), 8 deletions(-)
utils/mount/stropts.c +23 -8
@@ -225,21 +225,33 @@ static int nfs_append_clientaddr_option(const struct sockaddr *sap, }/* -* Resolve the 'mounthost=' hostname and append a new option using -* the resulting address. +* Determine whether to append a 'mountaddr=' option. The option is needed if: +* +* 1. "mounthost=" was specified, or +* 2. The address families for proto= and mountproto= are different. */ -static int nfs_fix_mounthost_option (struct mount_options *options) +static int nfs_fix_mounthost_option (struct mount_options *options, +const char *nfs_hostname) {union nfs_sockaddr address;struct sockaddr *sap = &address.sa;socklen_t salen =sizeof (address); +sa_family_t nfs_family, mnt_family;char *mounthost; +if (!nfs_nfs_proto_family (options, &nfs_family)) +return 0 ; +if (!nfs_mount_proto_family (options, &mnt_family)) +return 0 ; + mounthost =po_get (options,"mounthost" ); -if (!mounthost) -return 1 ; +if (mounthost ==NULL ) { +if (nfs_family == mnt_family) +return 1 ; + mounthost = (char *)nfs_hostname; + } -if (!nfs_name_to_address (mounthost, sap, &salen)) { +if (!nfs_lookup (mounthost, mnt_family, sap, &salen)) {nfs_error (_ ("%s: unable to determine mount server's address" ), progname);return 0 ;
@@ -327,12 +339,15 @@ static int nfs_set_version(struct nfsmount_info *mi)static int nfs_validate_options (struct nfsmount_info *mi) {struct sockaddr *sap = &mi->address.sa; +sa_family_t family;if (!nfs_parse_devname (mi->spec, &mi->hostname,NULL ))return 0 ; +if (!nfs_nfs_proto_family (mi->options, &family)) +return 0 ; mi->salen =sizeof (mi->address); -if (!nfs_name_to_address (mi->hostname, sap, &mi->salen)) +if (!nfs_lookup (mi->hostname, family, sap, &mi->salen))return 0 ;if (!nfs_set_version (mi))
@@ -565,7 +580,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)return result; } -if (!nfs_fix_mounthost_option (options)) { +if (!nfs_fix_mounthost_option (options, mi->hostname)) { errno =EINVAL ; goto out_fail; }
PATCH 9/10 mount.nfs: Remove nfs_name_to_address()
In reply to a message not in the archiveClean up: nfs_name_to_address() has no more callers.
---
utils/mount/network.c | 23 ++--------------------- utils/mount/network.h | 1 - 2 files changed, 2 insertions(+), 22 deletions(-)
utils/mount/network.c +2 -21
@@ -253,25 +253,6 @@ int nfs_lookup(const char *hostname, const sa_family_t family, }/** -* nfs_name_to_address - resolve hostname to an IPv4 or IPv6 socket address -* @hostname: pointer to C string containing DNS hostname to resolve -* @sap: pointer to buffer to fill with socket address -* @len: IN: size of buffer to fill; OUT: size of socket address -* -* Returns 1 and places a socket address at @sap if successful; -* otherwise zero. -*/ -int nfs_name_to_address (const char *hostname, -struct sockaddr *sap,socklen_t *salen) -{ -#ifdef IPV6_SUPPORTED -return nfs_lookup (hostname,AF_UNSPEC , sap, salen); -#else /* !IPV6_SUPPORTED */ -return nfs_lookup (hostname,AF_INET , sap, salen); -#endif /* !IPV6_SUPPORTED */ -} - -/** * nfs_gethostbyname - resolve a hostname to an IPv4 address * @hostname: pointer to a C string containing a DNS hostname * @sin: returns an IPv4 address
@@ -293,8 +274,8 @@ int nfs_gethostbyname(const char *hostname, struct sockaddr_in *sin)* OUT: length of converted socket address * * Convert a presentation format address string to a socket address. -* Similar to nfs_name_to_address(), but the DNS query is squelched, -* and won't make any noise if the getaddrinfo() call fails. +* Similar to nfs_lookup(), but the DNS query is squelched, and it +* won't make any noise if the getaddrinfo() call fails. * * Returns 1 and fills in @sap and @salen if successful; otherwise zero. *
utils/mount/network.h +0 -1
@@ -44,7 +44,6 @@ int nfs_probe_bothports(const struct sockaddr *, const socklen_t, struct pmap *, const struct sockaddr *, const socklen_t, struct pmap *);int nfs_gethostbyname (const char *,struct sockaddr_in *); -int nfs_name_to_address (const char *,struct sockaddr *,socklen_t *);int nfs_lookup (const char *hostname,const sa_family_t family,struct sockaddr *sap,socklen_t *salen);int nfs_string_to_sockaddr (const char *,struct sockaddr *,socklen_t *);
PATCH 10/10 NFS man page: update nfs(5) with details about IPv6 support
In reply to a message not in the archiveAdd details to nfs(5) about how to specify raw IPv6 addresses when mounting an NFS server. Mounting via an IPv6 NFS server via hostname should work as it does with IPv4.
---
utils/mount/nfs.man | 104 +++++++++++++++++++++++++++++++++++---------------- 1 files changed, 72 insertions(+), 32 deletions(-)
utils/mount/nfs.man +72 -32
@@ -58,9 +58,17 @@ The server's hostname and export pathname are separated by a colon, while the mount options are separated by commas. The remaining fields are separated by blanks or tabs. +.P The server's hostname can be an unqualified hostname, a fully qualified domain name, -or a dotted quad IPv4 address. +a dotted quad IPv4 address, or +an IPv6 address enclosed in square brackets. +Link-local and site-local IPv6 addresses must be accompanied by an +interface identifier. +See +.BR ipv6 (7) +for details on specifying raw IPv6 addresses. +.P The .I fstype field contains either "nfs" (for version 2 or version 3 NFS mounts)
@@ -470,32 +478,38 @@ for mounting the .B nfs file system type. .TP 1.5i -.BI proto= transport -The transport the NFS client uses +.BI proto= netid +The transport protocol name and protocol family the NFS client uses to transmit requests to the NFS server for this mount point. -.I transport -can be either -.B udp -or -.BR tcp . -Each transport uses different default +If an NFS server has both an IPv4 and an IPv6 address, using a specific +netid will force the use of IPv4 or IPv6 networking to communicate +with that server. +.IP +If support for TI-RPC is built into the +.B mount.nfs +command, +.I netid +is a valid netid listed in +.IR /etc/netconfig . +Otherwise, +.I netid +is one of "tcp," "udp," or "rdma," and only IPv4 may be used. +.IP +Each transport protocol uses different default .B retrans and .B timeo -settings; refer to the description of these two mount options for details. +settings. +Refer to the description of these two mount options for details. .IP In addition to controlling how the NFS client transmits requests to the server, this mount option also controls how the .BR mount (8) command communicates with the server's rpcbind and mountd services. -Specifying -.B proto=tcp -forces all traffic from the +Specifying a netid that uses TCP forces all traffic from the .BR mount (8) command and the NFS client to use TCP. -Specifying -.B proto=udp -forces all traffic types to use UDP. +Specifying a netid that uses UDP forces all traffic types to use UDP. .IP If the .B proto
@@ -548,15 +562,20 @@ or the server's mountd service is not available on the advertised port. This option can be used when mounting an NFS server through a firewall that blocks the rpcbind protocol. .TP 1.5i -.BI mountproto= transport -The transport the NFS client uses +.BI mountproto= netid +The transport protocol name and protocol family the NFS client uses to transmit requests to the NFS server's mountd service when performing this mount request, and when later unmounting this mount point. -.I transport -can be either -.B udp -or -.BR tcp . +.IP +If support for TI-RPC is built into the +.B mount.nfs +command, +.I netid +is a valid netid listed in +.IR /etc/netconfig . +Otherwise, +.I netid +is one of "tcp" or "udp," and only IPv4 may be used. .IP This option can be used when mounting an NFS server through a firewall that blocks a particular transport.
@@ -566,6 +585,7 @@ option, different transports for mountd requests and NFS requests can be specified. If the server's mountd service is not available via the specified transport, the mount request fails. +.IP Refer to the TRANSPORT METHODS section for more on how the .B mountproto mount option interacts with the
@@ -709,17 +729,26 @@ for mounting the .B nfs4 file system type. .TP 1.5i -.BI proto= transport -The transport the NFS client uses +.BI proto= netid +The transport protocol name and protocol family the NFS client uses to transmit requests to the NFS server for this mount point. -.I transport -can be either -.B udp -or -.BR tcp . +If an NFS server has both an IPv4 and an IPv6 address, using a specific +netid will force the use of IPv4 or IPv6 networking to communicate +with that server. +.IP +If support for TI-RPC is built into the +.B mount.nfs +command, +.I netid +is a valid netid listed in +.IR /etc/netconfig . +Otherwise, +.I netid +is one of "tcp" or "udp," and only IPv4 may be used. +.IP All NFS version 4 servers are required to support TCP, so if this mount option is not specified, the NFS version 4 client -uses the TCP transport protocol. +uses the TCP protocol. Refer to the TRANSPORT METHODS section for more details. .TP 1.5i .BI port= n
@@ -779,7 +808,8 @@ The DATA AND METADATA COHERENCE section discusses the behavior of this option in more detail. .TP 1.5i .BI clientaddr= n.n.n.n -Specifies a single IPv4 address (in dotted-quad form) +Specifies a single IPv4 address (in dotted-quad form), +or a non-link-local IPv6 address, that the NFS client advertises to allow servers to perform NFS version 4 callback requests against files on this mount point. If the server is unable to
@@ -855,6 +885,14 @@ This example can be used to mount /usr over NFS. .TA 2.5i +0.7i +0.7i +.7i server:/export /usr nfs ro,nolock,nocto,actimeo=3600 0 0 .FI +.P +This example shows how to mount an NFS server +using a raw IPv6 link-local address. +.P +.NF +.TA 2.5i +0.7i +0.7i +.7i + [fe80::215:c5ff:fb3e:e2b1%eth0]:/export /mnt nfs defaults 0 0 +.FI .SH "TRANSPORT METHODS" NFS clients send requests to NFS servers via Remote Procedure Calls, or
@@ -1498,6 +1536,8 @@ such as security negotiation, server referrals, and named attributes. .BR mount.nfs (5), .BR umount.nfs (5), .BR exports (5), +.BR netconfig (5), +.BR ipv6 (7), .BR nfsd (8), .BR sm-notify (8), .BR rpc.statd (8),
Quoted 8 lines · Chuck Lever
Hi Steve-
For 2.6.33, Trond has included Jeff's patch that adds support to the kernel NFS client for "proto=netid." Here are the user space changes we think are necessary to complete this support. See:
Quoted 8 lines
This series has seen some light testing here, and Jeff is planning to do more of his own independent testing.
Note that last patch in the series has a rather full set of updates to nfs(5) that document NFS client side support for NFS over IPv6, including support for "proto=netid."
Please have a look and let me know what you think.
Committed...
I did some regression testing and didn't find any problems...
steved.