From: Chuck Lever Date: Wed, 8 Sep 2010 17:25:56 +0000 (-0400) Subject: getport: Recognize "rdma" and "rdma6" netid X-Git-Tag: nfs-utils-1-2-3-rc6~21 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=a77ca5c6a79486dc8c5a4c327fe5310f5d497766;p=nfs-utils.git getport: Recognize "rdma" and "rdma6" netid The mount.nfs command must recognize the values of "rdma" and "rdma6" with the "proto=" mount option. Typically the mount.nfs command relies on libtirpc or getprotobyname(3) to recognize netids and translate them to protocol numbers. RFCs 5665 and 5666 define the "rdma" and "rdma6" netids. IANA defines a specific port number for NFS over RDMA (20049), but has not provided a protocol name and number for RDMA transports, and is not expected to. The best we can do is translate these by hand, as needed, to get RDMA mount requests to the kernel without erroring out. Only the forward translation is needed until such time that "rdma" and "rdma6" start to appear in rpcbind registries. For now, the version and transport negotiation logic is skipped, avoiding rpcbind queries for RDMA mounts. Note: As of kernel 2.6.36, the kernel's NFS over RDMA transport capability does not support IPv6. Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson --- diff --git a/support/include/nfsrpc.h b/support/include/nfsrpc.h index 6ebefca..d50fe94 100644 --- a/support/include/nfsrpc.h +++ b/support/include/nfsrpc.h @@ -26,6 +26,12 @@ #include #include +/* + * IANA does not define an IP protocol number for RDMA transports. + * Choose an arbitrary value we can use locally. + */ +#define NFSPROTO_RDMA (3939) + /* * Conventional RPC program numbers */ diff --git a/support/nfs/getport.c b/support/nfs/getport.c index c930539..d74400b 100644 --- a/support/nfs/getport.c +++ b/support/nfs/getport.c @@ -216,6 +216,21 @@ nfs_get_proto(const char *netid, sa_family_t *family, unsigned long *protocol) struct netconfig *nconf; struct protoent *proto; + /* + * IANA does not define a protocol number for rdma netids, + * since "rdma" is not an IP protocol. + */ + if (strcmp(netid, "rdma") == 0) { + *family = AF_INET; + *protocol = NFSPROTO_RDMA; + return 1; + } + if (strcmp(netid, "rdma6") == 0) { + *family = AF_INET6; + *protocol = NFSPROTO_RDMA; + return 1; + } + nconf = getnetconfigent(netid); if (nconf == NULL) return 0; @@ -242,6 +257,16 @@ nfs_get_proto(const char *netid, sa_family_t *family, unsigned long *protocol) { struct protoent *proto; + /* + * IANA does not define a protocol number for rdma netids, + * since "rdma" is not an IP protocol. + */ + if (strcmp(netid, "rdma") == 0) { + *family = AF_INET; + *protocol = NFSPROTO_RDMA; + return 1; + } + proto = getprotobyname(netid); if (proto == NULL) return 0;