summaryrefslogtreecommitdiffstats
path: root/utils/statd/rmtcall.c
diff options
context:
space:
mode:
authorneilbrown <neilbrown>2004-12-06 01:05:53 +0000
committerneilbrown <neilbrown>2004-12-06 01:05:53 +0000
commit8d926d3defedf7bb82c2f3f9fd1746fb0d0b968a (patch)
treeb35acce680b13d1937081bf057aebabcfbba5ff4 /utils/statd/rmtcall.c
parentc499db6ad1a084901a971cb24946f0ab51454d99 (diff)
downloadnfs-utils-8d926d3defedf7bb82c2f3f9fd1746fb0d0b968a.tar.gz
nfs-utils-8d926d3defedf7bb82c2f3f9fd1746fb0d0b968a.tar.xz
nfs-utils-8d926d3defedf7bb82c2f3f9fd1746fb0d0b968a.zip
statd fixes
Diffstat (limited to 'utils/statd/rmtcall.c')
-rw-r--r--utils/statd/rmtcall.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c
index 911a932..f6798f9 100644
--- a/utils/statd/rmtcall.c
+++ b/utils/statd/rmtcall.c
@@ -66,6 +66,16 @@ statd_get_socket(int port)
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = port;
+ /*
+ * If a local hostname is given (-n option to statd), bind to the address
+ * specified. This is required to support clients that ignore the mon_name in
+ * the statd protocol but use the source address from the request packet.
+ */
+ if (MY_NAME) {
+ struct hostent *hp = gethostbyname(MY_NAME);
+ if (hp)
+ sin.sin_addr = *(struct in_addr *) hp->h_addr;
+ }
if (bindresvport(sockfd, &sin) < 0) {
dprintf(N_WARNING,
"process_hosts: can't bind to reserved port\n");