diff options
| author | Kevin Vigor <kvigor@fb.com> | 2016-03-29 14:08:38 -0700 |
|---|---|---|
| committer | Shreyas Siravara <sshreyas@fb.com> | 2016-12-18 08:04:24 -0800 |
| commit | 5d76cdeb00243ce11b97860339018b434bcf5d72 (patch) | |
| tree | 91f41a2e73f3d2b6f20f7428c3204b01e630ed39 | |
| parent | d870d4570b17c83147cc9ade23963fd76154048f (diff) | |
nfs: Fix compiler warning when calling svc_getcaller
Summary:
- The result needs to be cast to (struct sockaddr_in *)
- This diff is a cherry-pick of D3111554 to 3.8
Signed-off-by: Shreyas Siravara <sshreyas@fb.com>
Change-Id: If4c27dbe6c032f9e278ea08cd3c96a4d07bcc5f9
Reviewed-on: http://review.gluster.org/16179
Tested-by: Shreyas Siravara <sshreyas@fb.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kevin Vigor <kvigor@fb.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
| -rw-r--r-- | xlators/nfs/server/src/mount3udp_svc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/xlators/nfs/server/src/mount3udp_svc.c b/xlators/nfs/server/src/mount3udp_svc.c index e8e226e953e..536a45ede3d 100644 --- a/xlators/nfs/server/src/mount3udp_svc.c +++ b/xlators/nfs/server/src/mount3udp_svc.c @@ -133,7 +133,15 @@ mountudp_program_3(struct svc_req *rqstp, register SVCXPRT *transp) mountres3 *res = NULL; struct sockaddr_in *sin = NULL; - sin = svc_getcaller (transp); + sin = (struct sockaddr_in *)svc_getcaller (transp); + /* svc_getcaller returns a pointer to a sockaddr_in6, even though it + * might actually be an IPv4 address. It ought return a struct sockaddr + * and make the caller upcast it to the proper address family. Sigh. + * + * Let's make sure that it's actually an IPv4 address. + */ + GF_ASSERT (sin->sin_family == AF_INET); + inet_ntop (AF_INET, &sin->sin_addr, mnthost, INET_ADDRSTRLEN+1); switch (rqstp->rq_proc) { |
