* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
- *
+ *
* Tue Jun 26 14:36:48 MEST 2001 Herbert "herp" Rosmanith
* added netlink_proto_exit
* Tue Jan 22 18:32:44 BRST 2002 Arnaldo C. de Melo <acme@conectiva.com.br>
};
atomic_notifier_call_chain(&netlink_chain,
NETLINK_URELEASE, &n);
- }
+ }
module_put(nlk->module);
return err;
}
-static inline int netlink_capable(struct socket *sock, unsigned int flag)
-{
+static inline int netlink_capable(struct socket *sock, unsigned int flag)
+{
return (nl_table[sock->sk->sk_protocol].nl_nonroot & flag) ||
capable(CAP_NET_ADMIN);
-}
+}
static void
netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
struct netlink_sock *nlk = nlk_sk(sk);
struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
int err;
-
+
if (nladdr->nl_family != AF_NETLINK)
return -EINVAL;
netlink_table_grab();
netlink_update_subscriptions(sk, nlk->subscriptions +
- hweight32(nladdr->nl_groups) -
- hweight32(nlk->groups[0]));
- nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | nladdr->nl_groups;
+ hweight32(nladdr->nl_groups) -
+ hweight32(nlk->groups[0]));
+ nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | nladdr->nl_groups;
netlink_update_listeners(sk);
netlink_table_ungrab();
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
struct sockaddr_nl *nladdr=(struct sockaddr_nl *)addr;
-
+
nladdr->nl_family = AF_NETLINK;
nladdr->nl_pad = 0;
*addr_len = sizeof(*nladdr);
}
static int netlink_setsockopt(struct socket *sock, int level, int optname,
- char __user *optval, int optlen)
+ char __user *optval, int optlen)
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
}
static int netlink_getsockopt(struct socket *sock, int level, int optname,
- char __user *optval, int __user *optlen)
+ char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
}
/*
- * We export these functions to other modules. They provide a
+ * We export these functions to other modules. They provide a
* complete set of kernel non-blocking support for message
* queueing.
*/
struct sock *
netlink_kernel_create(int unit, unsigned int groups,
- void (*input)(struct sock *sk, int len),
- struct module *module)
+ void (*input)(struct sock *sk, int len),
+ struct module *module)
{
struct socket *sock;
struct sock *sk;
}
void netlink_set_nonroot(int protocol, unsigned int flags)
-{
- if ((unsigned int)protocol < MAX_LINKS)
+{
+ if ((unsigned int)protocol < MAX_LINKS)
nl_table[protocol].nl_nonroot = flags;
-}
+}
static void netlink_destroy_callback(struct netlink_callback *cb)
{
struct sk_buff *skb;
struct nlmsghdr *nlh;
int len, err = -ENOBUFS;
-
+
skb = sock_rmalloc(sk, NLMSG_GOODSIZE, 0, GFP_KERNEL);
if (!skb)
goto errout;
if (v == SEQ_START_TOKEN)
return netlink_seq_socket_idx(seq, 0);
-
+
s = sk_next(v);
if (s)
return s;
{
return atomic_notifier_chain_unregister(&netlink_chain, nb);
}
-
+
static const struct proto_ops netlink_ops = {
.family = PF_NETLINK,
.owner = THIS_MODULE,
#ifdef CONFIG_PROC_FS
proc_net_fops_create("netlink", 0, &netlink_seq_fops);
#endif
- /* The netlink device handler may be needed early. */
+ /* The netlink device handler may be needed early. */
rtnetlink_init();
out:
return err;