[PATCH 2/3] Ensure the corrrect address family is used on RDMA mounts

Steve Dickson
2010-09-07T20:22:30Z

Due to the lack of RDMA netid support and no IANA protocol
number defined just make sure the correct address
family is used on RDMA mounts.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
support/nfs/getport.c | 21 +++++++++++++++++++++
utils/mount/stropts.c | 4 +++-
2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/support/nfs/getport.c b/support/nfs/getport.c
index c930539..8f788d2 100644
--- a/support/nfs/getport.c
+++ b/support/nfs/getport.c
@@ -216,6 +216,17 @@ nfs_get_proto(const char *netid, sa_family_t *family, unsigned long *protocol)
struct netconfig *nconf;
struct protoent *proto;

+ /*
+ * Special Case for RDMA mounts. Since
+ * there is no RDMA netid support, just
+ * ensure the correct address family
+ * is used.
+ */
+ if (strcasecmp(netid, "rdma") == 0) {
+ *family = AF_INET;
+ return 1;
+ }
+
nconf = getnetconfigent(netid);
if (nconf == NULL)
return 0;
@@ -242,6 +253,16 @@ nfs_get_proto(const char *netid, sa_family_t *family, unsigned long *protocol)
{
struct protoent *proto;

+ /*
+ * Special Case for RDMA mounts. Since
+ * there is not a protocol number define
+ * for RDMA, just ensure the correct
+ * address family is used.
+ */
+ if (strcasecmp(netid, "rdma") == 0) {
+ *family = AF_INET;
+ return 1;
+ }
proto = getprotobyname(netid);
if (proto == NULL)
return 0;
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index eb6ecc5..3f53ade 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -359,7 +359,9 @@ static int nfs_validate_options(struct nfsmount_info *mi)
if (!nfs_parse_devname(mi->spec, &mi->hostname, NULL))
return 0;

- if (!nfs_nfs_proto_family(mi->options, &family))
+ if (nfs_rdma_option(mi->options))
+ family = AF_INET;
+ else if (!nfs_nfs_proto_family(mi->options, &family))
return 0;

hint.ai_family = (int)family;
--
1.7.2.1