Currently sm-notify does not use the mon_name and my_name strings
passed to smn_get_host(). Very soon we're going to need the mon_name
and my_name strings, so add code to store those strings in struct
nsm_host, and free them when each host is forgotten.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
struct nsm_host {
struct nsm_host * next;
char * name;
struct nsm_host {
struct nsm_host * next;
char * name;
+ char * mon_name;
+ char * my_name;
struct addrinfo *ai;
time_t last_used;
time_t send_next;
struct addrinfo *ai;
time_t last_used;
time_t send_next;
__attribute_malloc__
static struct nsm_host *
__attribute_malloc__
static struct nsm_host *
-smn_alloc_host(const char *hostname, const time_t timestamp)
+smn_alloc_host(const char *hostname, const char *mon_name,
+ const char *my_name, const time_t timestamp)
goto out_nomem;
host->name = strdup(hostname);
goto out_nomem;
host->name = strdup(hostname);
- if (host->name == NULL) {
+ host->mon_name = strdup(mon_name);
+ host->my_name = strdup(my_name);
+ if (host->name == NULL ||
+ host->mon_name == NULL ||
+ host->my_name == NULL) {
+ free(host->my_name);
+ free(host->mon_name);
+ free(host->name);
free(host);
goto out_nomem;
}
free(host);
goto out_nomem;
}
nsm_delete_notified_host(host->name);
nsm_delete_notified_host(host->name);
+ free(host->my_name);
+ free(host->mon_name);
free(host->name);
if (host->ai)
freeaddrinfo(host->ai);
free(host->name);
if (host->ai)
freeaddrinfo(host->ai);
static unsigned int
smn_get_host(const char *hostname,
__attribute__ ((unused)) const struct sockaddr *sap,
static unsigned int
smn_get_host(const char *hostname,
__attribute__ ((unused)) const struct sockaddr *sap,
- __attribute__ ((unused)) const struct mon *m,
- const time_t timestamp)
+ const struct mon *m, const time_t timestamp)
- host = smn_alloc_host(hostname, timestamp);
+ host = smn_alloc_host(hostname,
+ m->mon_id.mon_name, m->mon_id.my_id.my_name, timestamp);
if (host == NULL)
return 0;
if (host == NULL)
return 0;