X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fstatd%2Frmtcall.c;h=b70e5bb701e829a391ff6fda47abd10239fab4cb;hp=a08c4b1b04e064bbb632a0a4f2fb6de747e9283b;hb=b63400dcb05eee79666bade57558279fd15f0318;hpb=8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9 diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c index a08c4b1..b70e5bb 100644 --- a/utils/statd/rmtcall.c +++ b/utils/statd/rmtcall.c @@ -2,6 +2,9 @@ * Copyright (C) 1996, 1999 Olaf Kirch * Modified by Jeffrey A. Uphoff, 1997-1999. * Modified by H.J. Lu, 1998. + * Modified by Lon Hohberger, Oct. 2000 + * - Bugfix handling client responses. + * - Paranoia on NOTIFY_CALLBACK case * * NSM for Linux. */ @@ -27,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -238,7 +242,10 @@ recv_rply(int sockfd, struct sockaddr_in *sin, u_long *portp) } for (lp = notify; lp != NULL; lp = lp->next) { - if (lp->xid != xid) + /* LH - this was a bug... it should have been checking + * the xid from the response message from the client, + * not the static, internal xid */ + if (lp->xid != mesg.rm_xid) continue; if (lp->addr.s_addr != sin->sin_addr.s_addr) { char addr [18]; @@ -290,13 +297,17 @@ process_entry(int sockfd, notify_list *lp) memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = lp->port; - sin.sin_addr = lp->addr; + /* LH - moved address into switch */ switch (NL_TYPE(lp)) { case NOTIFY_REBOOT: prog = SM_PROG; vers = SM_VERS; proc = SM_NOTIFY; + + /* Use source address for notify replies */ + sin.sin_addr = lp->addr; + func = (xdrproc_t) xdr_stat_chge; objp = &SM_stat_chge; break; @@ -304,6 +315,11 @@ process_entry(int sockfd, notify_list *lp) prog = NL_MY_PROG(lp); vers = NL_MY_VERS(lp); proc = NL_MY_PROC(lp); + + /* __FORCE__ loopback for callbacks to lockd ... */ + /* Just in case we somehow ignored it thus far */ + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + func = (xdrproc_t) xdr_status; objp = &new_status; new_status.mon_name = NL_MON_NAME(lp);