From 3193c56b7e3d0be9713138784b1a6477136add9e Mon Sep 17 00:00:00 2001 From: krishna Date: Fri, 9 Mar 2012 09:43:18 +0530 Subject: nlm: support ipv4 only Change-Id: I0d8381b7d4da0e961677cca63d6d2c82836c1632 BUG: 800735 Signed-off-by: krishna Reviewed-on: http://review.gluster.com/2909 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/nfs/server/src/nlm4.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'xlators/nfs/server/src') diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index bc55cfff1..170c994d5 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -840,10 +840,16 @@ nlm4_establish_callback (void *csarg) sockaddr = (struct sockaddr*) &sa; switch (sockaddr->sa_family) { case AF_INET6: + /* can not come here as NLM listens on IPv4 */ + gf_log (GF_NLM, GF_LOG_ERROR, "NLM is not supported on IPv6 in" + " this release"); + goto err; +/* inet_ntop (AF_INET6, &((struct sockaddr_in6 *)sockaddr)->sin6_addr, peerip, INET6_ADDRSTRLEN+1); break; +*/ case AF_INET: inet_ntop (AF_INET, &((struct sockaddr_in *)sockaddr)->sin_addr, @@ -858,6 +864,12 @@ nlm4_establish_callback (void *csarg) port = pmap_getport ((struct sockaddr_in*)sockaddr, NLM_PROGRAM, NLM_V4, IPPROTO_TCP); + if (port == 0) { + gf_log (GF_NLM, GF_LOG_ERROR, "Unable to get NLM port of the " + "client. Is the firewall running on client?"); + goto err; + } + options = dict_new(); ret = dict_set_str (options, "transport-type", "socket"); if (ret == -1) { @@ -915,7 +927,9 @@ nlm4_establish_callback (void *csarg) } nlm4svc_send_granted (cs); err: - rpc_clnt_unref (rpc_clnt); + if (rpc_clnt) { + rpc_clnt_unref (rpc_clnt); + } return NULL; } @@ -1741,6 +1755,12 @@ nlm4svc_init(xlator_t *nfsx) } } + ret = dict_set_str (options, "transport.address-family", "inet"); + if (ret == -1) { + gf_log (GF_NLM, GF_LOG_ERROR, "dict_set_str error"); + goto err; + } + rpcsvc_create_listeners (nfs->rpcsvc, options, "NLM"); if (ret == -1) { gf_log (GF_NLM, GF_LOG_ERROR, "Unable to create listeners"); -- cgit