goto failure;
}
- NL_ADDR(clnt) = my_addr.sin_addr;
NL_MY_PROG(clnt) = id->my_prog;
NL_MY_VERS(clnt) = id->my_vers;
NL_MY_PROC(clnt) = id->my_proc;
}
static unsigned int
-load_one_host(const char *hostname, const struct sockaddr *sap,
+load_one_host(const char *hostname,
+ __attribute__ ((unused)) const struct sockaddr *sap,
const struct mon *m,
__attribute__ ((unused)) const time_t timestamp)
{
- const struct sockaddr_in *sin = (const struct sockaddr_in *)sap;
notify_list *clnt;
clnt = nlist_new(m->mon_id.my_id.my_name,
xlog(D_GENERAL, "Adding record for %s to the monitor list...",
hostname);
- NL_ADDR(clnt) = sin->sin_addr;
NL_MY_PROG(clnt) = m->mon_id.my_id.my_prog;
NL_MY_VERS(clnt) = m->mon_id.my_id.my_vers;
NL_MY_PROC(clnt) = m->mon_id.my_id.my_proc;
*/
struct notify_list {
mon mon; /* Big honkin' NSM structure. */
- struct in_addr addr; /* IP address for callback. */
in_port_t port; /* port number for callback */
short int times; /* Counter used for various things. */
int state; /* For storing notified state for callbacks. */
#define NL_FIRST NL_NEXT
#define NL_PREV(L) ((L)->prev)
#define NL_DATA(L) ((L)->mon)
-#define NL_ADDR(L) ((L)->addr)
#define NL_STATE(L) ((L)->state)
#define NL_TIMES(L) ((L)->times)
#define NL_MON_ID(L) (NL_DATA((L)).mon_id)
xid = nsm_parse_reply(&xdr);
if (xid == 0)
goto done;
+ if (sin.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) {
+ struct in_addr addr = sin.sin_addr;
+ char buf[INET_ADDRSTRLEN];
+
+ xlog_warn("%s: Unrecognized reply from %s", __func__,
+ inet_ntop(AF_INET, &addr, buf,
+ (socklen_t)sizeof(buf)));
+ goto done;
+ }
for (lp = notify; lp != NULL; lp = lp->next) {
/* LH - this was a bug... it should have been checking
* not the static, internal xid */
if (lp->xid != xid)
continue;
- if (lp->addr.s_addr != sin.sin_addr.s_addr) {
- char addr [18];
- strncpy (addr, inet_ntoa(lp->addr),
- sizeof (addr) - 1);
- addr [sizeof (addr) - 1] = '\0';
- xlog_warn("%s: address mismatch: "
- "expected %s, got %s", __func__,
- addr, inet_ntoa(sin.sin_addr));
- }
if (lp->port == 0)
*portp = nsm_recv_getport(&xdr);
break;
struct sockaddr_in sin;
if (NL_TIMES(lp) == 0) {
- xlog(D_GENERAL, "%s: Cannot notify %s, giving up",
- __func__, inet_ntoa(NL_ADDR(lp)));
+ xlog(D_GENERAL, "%s: Cannot notify localhost, giving up",
+ __func__);
return 0;
}
nlist_insert_timer(¬ify, lp);
return 1;
}
- xlog_warn("%s: [%s] service %d not registered",
- __func__, inet_ntoa(lp->addr), NL_MY_PROG(lp));
+ xlog_warn("%s: service %d not registered on localhost",
+ __func__, NL_MY_PROG(lp));
} else {
xlog(D_GENERAL, "%s: Callback to %s (for %d) succeeded",
__func__, NL_MY_NAME(lp), NL_MON_NAME(lp));