From: neilbrown Date: Mon, 6 Dec 2004 01:05:53 +0000 (+0000) Subject: statd fixes X-Git-Tag: nfs-utils-1-0-7-pre2~4 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=8d926d3defedf7bb82c2f3f9fd1746fb0d0b968a;p=nfs-utils.git statd fixes --- diff --git a/ChangeLog b/ChangeLog index b981f63..0def56f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-12-07 Marc Eshel + * utils/statd/svc_run.c(my_svc_run): allow loop to exit when in + MODE_NOTIFY_ONLY + *utils/statd/rmtcall.c(statd_get_socket): if a hostname is given + to statd with -n, prefer it's IP address to the default for + listening on. + 2004-12-06 Bruce Allan * utils/mountd/auth.c(auth_reload) Clear the "my_client" cache on an auth_reload to avoid old data getting used. 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"); diff --git a/utils/statd/svc_run.c b/utils/statd/svc_run.c index e2d7c97..7b69dc8 100644 --- a/utils/statd/svc_run.c +++ b/utils/statd/svc_run.c @@ -107,7 +107,9 @@ my_svc_run(void) tv.tv_sec); selret = select(FD_SETSIZE, &readfds, (void *) 0, (void *) 0, &tv); - } else { + } else if (run_mode & MODE_NOTIFY_ONLY) + return; + else { dprintf(N_DEBUG, "Waiting for client connections."); selret = select(FD_SETSIZE, &readfds, (void *) 0, (void *) 0, (struct timeval *) 0);