aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2014-04-23 17:25:48 -0400
committerDavid S. Miller <davem@davemloft.net>2014-04-24 13:44:53 -0400
commit5187cd055b6e81fc6526109456f8b20623148d5f (patch)
tree4433e1f5544b5b52e739607acb4ac330ccb1c4dc /net
parent98a46d46d1bc983125b6ff9a0e831050a7011713 (diff)
netlink: Rename netlink_capable netlink_allowed
netlink_capable is a static internal function in af_netlink.c and we have better uses for the name netlink_capable. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/af_netlink.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 894cda0206bb..7f931fe4d187 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1360,7 +1360,7 @@ retry:
1360 return err; 1360 return err;
1361} 1361}
1362 1362
1363static inline int netlink_capable(const struct socket *sock, unsigned int flag) 1363static inline int netlink_allowed(const struct socket *sock, unsigned int flag)
1364{ 1364{
1365 return (nl_table[sock->sk->sk_protocol].flags & flag) || 1365 return (nl_table[sock->sk->sk_protocol].flags & flag) ||
1366 ns_capable(sock_net(sock->sk)->user_ns, CAP_NET_ADMIN); 1366 ns_capable(sock_net(sock->sk)->user_ns, CAP_NET_ADMIN);
@@ -1428,7 +1428,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
1428 1428
1429 /* Only superuser is allowed to listen multicasts */ 1429 /* Only superuser is allowed to listen multicasts */
1430 if (nladdr->nl_groups) { 1430 if (nladdr->nl_groups) {
1431 if (!netlink_capable(sock, NL_CFG_F_NONROOT_RECV)) 1431 if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV))
1432 return -EPERM; 1432 return -EPERM;
1433 err = netlink_realloc_groups(sk); 1433 err = netlink_realloc_groups(sk);
1434 if (err) 1434 if (err)
@@ -1490,7 +1490,7 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,
1490 return -EINVAL; 1490 return -EINVAL;
1491 1491
1492 if ((nladdr->nl_groups || nladdr->nl_pid) && 1492 if ((nladdr->nl_groups || nladdr->nl_pid) &&
1493 !netlink_capable(sock, NL_CFG_F_NONROOT_SEND)) 1493 !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND))
1494 return -EPERM; 1494 return -EPERM;
1495 1495
1496 if (!nlk->portid) 1496 if (!nlk->portid)
@@ -2096,7 +2096,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
2096 break; 2096 break;
2097 case NETLINK_ADD_MEMBERSHIP: 2097 case NETLINK_ADD_MEMBERSHIP:
2098 case NETLINK_DROP_MEMBERSHIP: { 2098 case NETLINK_DROP_MEMBERSHIP: {
2099 if (!netlink_capable(sock, NL_CFG_F_NONROOT_RECV)) 2099 if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV))
2100 return -EPERM; 2100 return -EPERM;
2101 err = netlink_realloc_groups(sk); 2101 err = netlink_realloc_groups(sk);
2102 if (err) 2102 if (err)
@@ -2247,7 +2247,7 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
2247 dst_group = ffs(addr->nl_groups); 2247 dst_group = ffs(addr->nl_groups);
2248 err = -EPERM; 2248 err = -EPERM;
2249 if ((dst_group || dst_portid) && 2249 if ((dst_group || dst_portid) &&
2250 !netlink_capable(sock, NL_CFG_F_NONROOT_SEND)) 2250 !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND))
2251 goto out; 2251 goto out;
2252 } else { 2252 } else {
2253 dst_portid = nlk->dst_portid; 2253 dst_portid = nlk->dst_portid;