mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
NSM: Use sockaddr_storage for sm_addr field
To store larger addresses in the nsm_handle structure, make sm_addr a sockaddr_storage. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
This commit is contained in:
parent
90151e6e4d
commit
7e9d7746bf
3 changed files with 16 additions and 4 deletions
|
@ -551,7 +551,7 @@ __nsm_find(const struct sockaddr_in *sin,
|
||||||
if (strlen(pos->sm_name) != hostname_len
|
if (strlen(pos->sm_name) != hostname_len
|
||||||
|| memcmp(pos->sm_name, hostname, hostname_len))
|
|| memcmp(pos->sm_name, hostname, hostname_len))
|
||||||
continue;
|
continue;
|
||||||
} else if (!nlm_cmp_addr(&pos->sm_addr, sin))
|
} else if (!nlm_cmp_addr(nsm_addr_in(pos), sin))
|
||||||
continue;
|
continue;
|
||||||
atomic_inc(&pos->sm_count);
|
atomic_inc(&pos->sm_count);
|
||||||
kfree(nsm);
|
kfree(nsm);
|
||||||
|
@ -571,7 +571,8 @@ __nsm_find(const struct sockaddr_in *sin,
|
||||||
if (nsm == NULL)
|
if (nsm == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
nsm->sm_addr = *sin;
|
memcpy(nsm_addr(nsm), sin, sizeof(*sin));
|
||||||
|
nsm->sm_addrlen = sizeof(*sin);
|
||||||
nsm->sm_name = (char *) (nsm + 1);
|
nsm->sm_name = (char *) (nsm + 1);
|
||||||
memcpy(nsm->sm_name, hostname, hostname_len);
|
memcpy(nsm->sm_name, hostname, hostname_len);
|
||||||
nsm->sm_name[hostname_len] = '\0';
|
nsm->sm_name[hostname_len] = '\0';
|
||||||
|
|
|
@ -51,7 +51,7 @@ nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
|
||||||
|
|
||||||
memset(&args, 0, sizeof(args));
|
memset(&args, 0, sizeof(args));
|
||||||
args.mon_name = nsm->sm_name;
|
args.mon_name = nsm->sm_name;
|
||||||
args.addr = nsm->sm_addr.sin_addr.s_addr;
|
args.addr = nsm_addr_in(nsm)->sin_addr.s_addr;
|
||||||
args.prog = NLM_PROGRAM;
|
args.prog = NLM_PROGRAM;
|
||||||
args.vers = 3;
|
args.vers = 3;
|
||||||
args.proc = NLMPROC_NSM_NOTIFY;
|
args.proc = NLMPROC_NSM_NOTIFY;
|
||||||
|
|
|
@ -71,7 +71,8 @@ struct nsm_handle {
|
||||||
struct list_head sm_link;
|
struct list_head sm_link;
|
||||||
atomic_t sm_count;
|
atomic_t sm_count;
|
||||||
char * sm_name;
|
char * sm_name;
|
||||||
struct sockaddr_in sm_addr;
|
struct sockaddr_storage sm_addr;
|
||||||
|
size_t sm_addrlen;
|
||||||
unsigned int sm_monitored : 1,
|
unsigned int sm_monitored : 1,
|
||||||
sm_sticky : 1; /* don't unmonitor */
|
sm_sticky : 1; /* don't unmonitor */
|
||||||
char sm_addrbuf[48]; /* address eyecatcher */
|
char sm_addrbuf[48]; /* address eyecatcher */
|
||||||
|
@ -100,6 +101,16 @@ static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host)
|
||||||
return (struct sockaddr *)&host->h_srcaddr;
|
return (struct sockaddr *)&host->h_srcaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle)
|
||||||
|
{
|
||||||
|
return (struct sockaddr_in *)&handle->sm_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle)
|
||||||
|
{
|
||||||
|
return (struct sockaddr *)&handle->sm_addr;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map an fl_owner_t into a unique 32-bit "pid"
|
* Map an fl_owner_t into a unique 32-bit "pid"
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue