}
}
+/*
+ * Construct a unique cookie to match this nsm_handle to this monitored
+ * host. It is passed to the local rpc.statd via NSMPROC_MON, and
+ * returned via NLMPROC_SM_NOTIFY, in the "priv" field of these
+ * requests.
+ *
+ * Linux provides the raw IP address of the monitored host,
+ * left in network byte order.
+ */
+static void nsm_init_private(struct nsm_handle *nsm)
+{
+ __be32 *p = (__be32 *)&nsm->sm_priv.data;
+ *p = nsm_addr_in(nsm)->sin_addr.s_addr;
+}
+
/**
* nsm_find - Find or create a cached nsm_handle
* @sap: pointer to socket address of handle to find
nsm->sm_name = (char *) (nsm + 1);
memcpy(nsm->sm_name, hostname, hostname_len);
nsm->sm_name[hostname_len] = '\0';
+ nsm_init_private(nsm);
nsm_display_address((struct sockaddr *)&nsm->sm_addr,
nsm->sm_addrbuf, sizeof(nsm->sm_addrbuf));
atomic_set(&nsm->sm_count, 1);
size_t sm_addrlen;
unsigned int sm_monitored : 1,
sm_sticky : 1; /* don't unmonitor */
+ struct nsm_private sm_priv;
char sm_addrbuf[NSM_ADDRBUF];
};