2 * Copyright (C) 1995, 1997-1999 Jeffrey A. Uphoff
3 * Modified by Olaf Kirch, Oct. 1996.
4 * Modified by Lon Hohberger, Oct. 2000.
15 #include <arpa/inet.h>
17 /* Callback notify list. */
18 /* notify_list *cbnl = NULL; ... never used */
22 * Services SM_NOTIFY requests.
23 * Any clients that have asked us to monitor that host are put on
24 * the global callback list, which is processed as soon as statd
28 sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp)
30 notify_list *lp, *call;
31 static char *result = NULL;
32 char *ip_addr = xstrdup(inet_ntoa(svc_getcaller(rqstp->rq_xprt)
35 dprintf(N_DEBUG, "Received SM_NOTIFY from %s, state: %d",
36 argp->mon_name, argp->state);
38 /* quick check - don't bother if we're not monitoring anyone */
39 /* LH - this was != MULL, meaning that if anyone _was_ in our RTNL,
40 * we'd never pass this point. */
42 note(N_WARNING, "SM_NOTIFY from %s while not monitoring any hosts.",
43 argp->mon_name, argp->state);
44 return ((void *) &result);
47 /* okir change: statd doesn't remove the remote host from its
48 * internal monitor list when receiving an SM_NOTIFY call from
49 * it. Lockd will want to continue monitoring the remote host
50 * until it issues an SM_UNMON call.
52 for (lp = rtnl ; lp ; lp = lp->next)
53 if (NL_STATE(lp) != argp->state &&
54 (matchhostname(argp->mon_name, lp->dns_name) ||
55 matchhostname(ip_addr, lp->dns_name))) {
56 NL_STATE(lp) = argp->state;
57 call = nlist_clone(lp);
58 nlist_insert(¬ify, call);
62 return ((void *) &result);