提交 7774d5e0 编写于 作者: R Richard Guy Briggs 提交者: David S. Miller

netlink: implement unbind to netlink_setsockopt NETLINK_DROP_MEMBERSHIP

Call the per-protocol unbind function rather than bind function on
NETLINK_DROP_MEMBERSHIP in netlink_setsockopt().
Signed-off-by: NRichard Guy Briggs <rgb@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4f520900
...@@ -2129,7 +2129,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname, ...@@ -2129,7 +2129,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
return err; return err;
if (!val || val - 1 >= nlk->ngroups) if (!val || val - 1 >= nlk->ngroups)
return -EINVAL; return -EINVAL;
if (nlk->netlink_bind) { if (optname == NETLINK_ADD_MEMBERSHIP && nlk->netlink_bind) {
err = nlk->netlink_bind(val); err = nlk->netlink_bind(val);
if (err) if (err)
return err; return err;
...@@ -2138,6 +2138,8 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname, ...@@ -2138,6 +2138,8 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
netlink_update_socket_mc(nlk, val, netlink_update_socket_mc(nlk, val,
optname == NETLINK_ADD_MEMBERSHIP); optname == NETLINK_ADD_MEMBERSHIP);
netlink_table_ungrab(); netlink_table_ungrab();
if (optname == NETLINK_DROP_MEMBERSHIP && nlk->netlink_unbind)
nlk->netlink_unbind(val);
err = 0; err = 0;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册