aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink
diff options
context:
space:
mode:
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/af_netlink.c44
-rw-r--r--net/netlink/genetlink.c2
2 files changed, 23 insertions, 23 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 383dd4e82ee1..f6ee9b47428b 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -8,7 +8,7 @@
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * Tue Jun 26 14:36:48 MEST 2001 Herbert "herp" Rosmanith 12 * Tue Jun 26 14:36:48 MEST 2001 Herbert "herp" Rosmanith
13 * added netlink_proto_exit 13 * added netlink_proto_exit
14 * Tue Jan 22 18:32:44 BRST 2002 Arnaldo C. de Melo <acme@conectiva.com.br> 14 * Tue Jan 22 18:32:44 BRST 2002 Arnaldo C. de Melo <acme@conectiva.com.br>
@@ -470,7 +470,7 @@ static int netlink_release(struct socket *sock)
470 }; 470 };
471 atomic_notifier_call_chain(&netlink_chain, 471 atomic_notifier_call_chain(&netlink_chain,
472 NETLINK_URELEASE, &n); 472 NETLINK_URELEASE, &n);
473 } 473 }
474 474
475 module_put(nlk->module); 475 module_put(nlk->module);
476 476
@@ -528,11 +528,11 @@ retry:
528 return err; 528 return err;
529} 529}
530 530
531static inline int netlink_capable(struct socket *sock, unsigned int flag) 531static inline int netlink_capable(struct socket *sock, unsigned int flag)
532{ 532{
533 return (nl_table[sock->sk->sk_protocol].nl_nonroot & flag) || 533 return (nl_table[sock->sk->sk_protocol].nl_nonroot & flag) ||
534 capable(CAP_NET_ADMIN); 534 capable(CAP_NET_ADMIN);
535} 535}
536 536
537static void 537static void
538netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions) 538netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
@@ -574,7 +574,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len
574 struct netlink_sock *nlk = nlk_sk(sk); 574 struct netlink_sock *nlk = nlk_sk(sk);
575 struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; 575 struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
576 int err; 576 int err;
577 577
578 if (nladdr->nl_family != AF_NETLINK) 578 if (nladdr->nl_family != AF_NETLINK)
579 return -EINVAL; 579 return -EINVAL;
580 580
@@ -605,9 +605,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len
605 605
606 netlink_table_grab(); 606 netlink_table_grab();
607 netlink_update_subscriptions(sk, nlk->subscriptions + 607 netlink_update_subscriptions(sk, nlk->subscriptions +
608 hweight32(nladdr->nl_groups) - 608 hweight32(nladdr->nl_groups) -
609 hweight32(nlk->groups[0])); 609 hweight32(nlk->groups[0]));
610 nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | nladdr->nl_groups; 610 nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | nladdr->nl_groups;
611 netlink_update_listeners(sk); 611 netlink_update_listeners(sk);
612 netlink_table_ungrab(); 612 netlink_table_ungrab();
613 613
@@ -652,7 +652,7 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr, int *addr
652 struct sock *sk = sock->sk; 652 struct sock *sk = sock->sk;
653 struct netlink_sock *nlk = nlk_sk(sk); 653 struct netlink_sock *nlk = nlk_sk(sk);
654 struct sockaddr_nl *nladdr=(struct sockaddr_nl *)addr; 654 struct sockaddr_nl *nladdr=(struct sockaddr_nl *)addr;
655 655
656 nladdr->nl_family = AF_NETLINK; 656 nladdr->nl_family = AF_NETLINK;
657 nladdr->nl_pad = 0; 657 nladdr->nl_pad = 0;
658 *addr_len = sizeof(*nladdr); 658 *addr_len = sizeof(*nladdr);
@@ -999,7 +999,7 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
999} 999}
1000 1000
1001static int netlink_setsockopt(struct socket *sock, int level, int optname, 1001static int netlink_setsockopt(struct socket *sock, int level, int optname,
1002 char __user *optval, int optlen) 1002 char __user *optval, int optlen)
1003{ 1003{
1004 struct sock *sk = sock->sk; 1004 struct sock *sk = sock->sk;
1005 struct netlink_sock *nlk = nlk_sk(sk); 1005 struct netlink_sock *nlk = nlk_sk(sk);
@@ -1054,7 +1054,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
1054} 1054}
1055 1055
1056static int netlink_getsockopt(struct socket *sock, int level, int optname, 1056static int netlink_getsockopt(struct socket *sock, int level, int optname,
1057 char __user *optval, int __user *optlen) 1057 char __user *optval, int __user *optlen)
1058{ 1058{
1059 struct sock *sk = sock->sk; 1059 struct sock *sk = sock->sk;
1060 struct netlink_sock *nlk = nlk_sk(sk); 1060 struct netlink_sock *nlk = nlk_sk(sk);
@@ -1257,15 +1257,15 @@ static void netlink_data_ready(struct sock *sk, int len)
1257} 1257}
1258 1258
1259/* 1259/*
1260 * We export these functions to other modules. They provide a 1260 * We export these functions to other modules. They provide a
1261 * complete set of kernel non-blocking support for message 1261 * complete set of kernel non-blocking support for message
1262 * queueing. 1262 * queueing.
1263 */ 1263 */
1264 1264
1265struct sock * 1265struct sock *
1266netlink_kernel_create(int unit, unsigned int groups, 1266netlink_kernel_create(int unit, unsigned int groups,
1267 void (*input)(struct sock *sk, int len), 1267 void (*input)(struct sock *sk, int len),
1268 struct module *module) 1268 struct module *module)
1269{ 1269{
1270 struct socket *sock; 1270 struct socket *sock;
1271 struct sock *sk; 1271 struct sock *sk;
@@ -1317,10 +1317,10 @@ out_sock_release:
1317} 1317}
1318 1318
1319void netlink_set_nonroot(int protocol, unsigned int flags) 1319void netlink_set_nonroot(int protocol, unsigned int flags)
1320{ 1320{
1321 if ((unsigned int)protocol < MAX_LINKS) 1321 if ((unsigned int)protocol < MAX_LINKS)
1322 nl_table[protocol].nl_nonroot = flags; 1322 nl_table[protocol].nl_nonroot = flags;
1323} 1323}
1324 1324
1325static void netlink_destroy_callback(struct netlink_callback *cb) 1325static void netlink_destroy_callback(struct netlink_callback *cb)
1326{ 1326{
@@ -1341,7 +1341,7 @@ static int netlink_dump(struct sock *sk)
1341 struct sk_buff *skb; 1341 struct sk_buff *skb;
1342 struct nlmsghdr *nlh; 1342 struct nlmsghdr *nlh;
1343 int len, err = -ENOBUFS; 1343 int len, err = -ENOBUFS;
1344 1344
1345 skb = sock_rmalloc(sk, NLMSG_GOODSIZE, 0, GFP_KERNEL); 1345 skb = sock_rmalloc(sk, NLMSG_GOODSIZE, 0, GFP_KERNEL);
1346 if (!skb) 1346 if (!skb)
1347 goto errout; 1347 goto errout;
@@ -1626,7 +1626,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1626 1626
1627 if (v == SEQ_START_TOKEN) 1627 if (v == SEQ_START_TOKEN)
1628 return netlink_seq_socket_idx(seq, 0); 1628 return netlink_seq_socket_idx(seq, 0);
1629 1629
1630 s = sk_next(v); 1630 s = sk_next(v);
1631 if (s) 1631 if (s)
1632 return s; 1632 return s;
@@ -1732,7 +1732,7 @@ int netlink_unregister_notifier(struct notifier_block *nb)
1732{ 1732{
1733 return atomic_notifier_chain_unregister(&netlink_chain, nb); 1733 return atomic_notifier_chain_unregister(&netlink_chain, nb);
1734} 1734}
1735 1735
1736static const struct proto_ops netlink_ops = { 1736static const struct proto_ops netlink_ops = {
1737 .family = PF_NETLINK, 1737 .family = PF_NETLINK,
1738 .owner = THIS_MODULE, 1738 .owner = THIS_MODULE,
@@ -1808,7 +1808,7 @@ static int __init netlink_proto_init(void)
1808#ifdef CONFIG_PROC_FS 1808#ifdef CONFIG_PROC_FS
1809 proc_net_fops_create("netlink", 0, &netlink_seq_fops); 1809 proc_net_fops_create("netlink", 0, &netlink_seq_fops);
1810#endif 1810#endif
1811 /* The netlink device handler may be needed early. */ 1811 /* The netlink device handler may be needed early. */
1812 rtnetlink_init(); 1812 rtnetlink_init();
1813out: 1813out:
1814 return err; 1814 return err;
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 548e4e6e698f..c2996794eb25 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -310,7 +310,7 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
310 if (nlh->nlmsg_type < NLMSG_MIN_TYPE) 310 if (nlh->nlmsg_type < NLMSG_MIN_TYPE)
311 goto ignore; 311 goto ignore;
312 312
313 family = genl_family_find_byid(nlh->nlmsg_type); 313 family = genl_family_find_byid(nlh->nlmsg_type);
314 if (family == NULL) { 314 if (family == NULL) {
315 err = -ENOENT; 315 err = -ENOENT;
316 goto errout; 316 goto errout;