17 #include <linux/module.h>
18 #include <linux/types.h>
19 #include <linux/socket.h>
20 #include <linux/kernel.h>
21 #include <linux/string.h>
23 #include <linux/net.h>
25 #include <asm/uaccess.h>
30 #include <linux/netlink.h>
31 #include <linux/netfilter/nfnetlink.h>
105 return &ss->
cb[cb_id];
117 return nlmsg_notify(net->nfnl, skb, pid, group, echo, flags);
136 struct net *
net = sock_net(skb->
sk);
151 ss = nfnetlink_get_subsys(type);
153 #ifdef CONFIG_MODULES
157 ss = nfnetlink_get_subsys(type);
166 nc = nfnetlink_find_client(type, ss);
180 attr, attrlen, ss->
cb[cb_id].policy);
187 err = nc->
call_rcu(net->nfnl, skb, nlh,
195 lockdep_is_held(&nfnl_mutex)) != ss ||
196 nfnetlink_find_client(type, ss) != nc)
199 err = nc->
call(net->nfnl, skb, nlh,
211 static void nfnetlink_rcv(
struct sk_buff *skb)
216 #ifdef CONFIG_MODULES
217 static void nfnetlink_bind(
int group)
220 int type = nfnl_group2type[
group];
223 ss = nfnetlink_get_subsys(type);
226 request_module(
"nfnetlink-subsys-%d", type);
233 static int __net_init nfnetlink_net_init(
struct net *net)
238 .input = nfnetlink_rcv,
239 #ifdef CONFIG_MODULES
240 .bind = nfnetlink_bind,
247 net->nfnl_stash = nfnl;
264 .
init = nfnetlink_net_init,
265 .exit_batch = nfnetlink_net_exit_batch,
268 static int __init nfnetlink_init(
void)
270 pr_info(
"Netfilter messages via NETLINK v%s.\n", nfversion);
274 static void __exit nfnetlink_exit(
void)
276 pr_info(
"Removing netfilter NETLINK layer.\n");