]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
statd: Remove NL_ADDR() macro
authorChuck Lever <chuck.lever@oracle.com>
Thu, 14 Jan 2010 17:24:30 +0000 (12:24 -0500)
committerSteve Dickson <steved@redhat.com>
Fri, 15 Jan 2010 19:55:52 +0000 (14:55 -0500)
Clean up: The contents of NL_ADDR are fixed: they are always the IPv4
loopback address.  Some time ago, the use of NL_ADDR() was stubbed out
of the NLM downcall forward path, replaced with a constant IPv4
loopback address.

Stub it out of the reply path as well, and then remove NL_ADDR
entirely.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
utils/statd/monitor.c
utils/statd/notlist.c
utils/statd/notlist.h
utils/statd/rmtcall.c

index 11afe0839e9a991037e6788e0b22efbd84b0a482..325dfd3ac8bb3c12b7b6ab07b6b97923d46bd615 100644 (file)
@@ -173,7 +173,6 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
                goto failure;
        }
 
                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;
        NL_MY_PROG(clnt) = id->my_prog;
        NL_MY_VERS(clnt) = id->my_vers;
        NL_MY_PROC(clnt) = id->my_proc;
@@ -214,11 +213,11 @@ failure:
 }
 
 static unsigned int
 }
 
 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 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,
        notify_list *clnt;
 
        clnt = nlist_new(m->mon_id.my_id.my_name,
@@ -235,7 +234,6 @@ load_one_host(const char *hostname, const struct sockaddr *sap,
        xlog(D_GENERAL, "Adding record for %s to the monitor list...",
                        hostname);
 
        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;
        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;
index de7d0465e60877300ba2cbf30a40516a6484f154..0341c159167836661e2d3027279bc7e3a4a86dba 100644 (file)
@@ -189,7 +189,6 @@ nlist_clone(notify_list *entry)
        NL_MY_PROG(new) = NL_MY_PROG(entry);
        NL_MY_VERS(new) = NL_MY_VERS(entry);
        NL_MY_PROC(new) = NL_MY_PROC(entry);
        NL_MY_PROG(new) = NL_MY_PROG(entry);
        NL_MY_VERS(new) = NL_MY_VERS(entry);
        NL_MY_PROC(new) = NL_MY_PROC(entry);
-       NL_ADDR(new)    = NL_ADDR(entry);
        memcpy(NL_PRIV(new), NL_PRIV(entry), SM_PRIV_SIZE);
 
        return new;
        memcpy(NL_PRIV(new), NL_PRIV(entry), SM_PRIV_SIZE);
 
        return new;
index f915ae1a88e80b62dd087cde6b3ba4e98b04eb31..6ed0da80cdca1e72d01d380c8b8b83acf05acb90 100644 (file)
@@ -12,7 +12,6 @@
  */
 struct notify_list {
   mon                  mon;    /* Big honkin' NSM structure. */
  */
 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. */
   in_port_t            port;   /* port number for callback */
   short int            times;  /* Counter used for various things. */
   int                  state;  /* For storing notified state for callbacks. */
@@ -53,7 +52,6 @@ extern notify_list *  nlist_gethost(notify_list *, char *, int);
 #define NL_FIRST       NL_NEXT
 #define NL_PREV(L)     ((L)->prev)
 #define NL_DATA(L)     ((L)->mon)
 #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)
 #define NL_STATE(L)    ((L)->state)
 #define NL_TIMES(L)    ((L)->times)
 #define NL_MON_ID(L)   (NL_DATA((L)).mon_id)
index 1a97684a21a5887721a55bb69d5e6bb3c6a55eae..0e52fe2b81b1f357637b0e824fe1d4da0cc3827f 100644 (file)
@@ -125,6 +125,15 @@ recv_rply(u_long *portp)
        xid = nsm_parse_reply(&xdr);
        if (xid == 0)
                goto done;
        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
 
        for (lp = notify; lp != NULL; lp = lp->next) {
                /* LH - this was a bug... it should have been checking
@@ -132,15 +141,6 @@ recv_rply(u_long *portp)
                 * not the static, internal xid */
                if (lp->xid != xid)
                        continue;
                 * 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;
                if (lp->port == 0)
                        *portp = nsm_recv_getport(&xdr);
                break;
@@ -160,8 +160,8 @@ process_entry(notify_list *lp)
        struct sockaddr_in      sin;
 
        if (NL_TIMES(lp) == 0) {
        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;
        }
 
                return 0;
        }
 
@@ -226,8 +226,8 @@ process_reply(FD_SET_TYPE *rfds)
                        nlist_insert_timer(&notify, lp);
                        return 1;
                }
                        nlist_insert_timer(&notify, 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));
        } else {
                xlog(D_GENERAL, "%s: Callback to %s (for %d) succeeded",
                        __func__, NL_MY_NAME(lp), NL_MON_NAME(lp));