aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-06-29 02:15:21 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-29 19:46:02 -0400
commita31f2d17b331db970259e875b7223d3aba7e3821 (patch)
tree0d10021be81446ab360f4240b0d16729f518387f /net/ipv4
parentdd7f36ba3ce17d4fe85987d83efd5901b0935816 (diff)
netlink: add netlink_kernel_cfg parameter to netlink_kernel_create
This patch adds the following structure: struct netlink_kernel_cfg { unsigned int groups; void (*input)(struct sk_buff *skb); struct mutex *cb_mutex; }; That can be passed to netlink_kernel_create to set optional configurations for netlink kernel sockets. I've populated this structure by looking for NULL and zero parameters at the existing code. The remaining parameters that always need to be set are still left in the original interface. That includes optional parameters for the netlink socket creation. This allows easy extensibility of this interface in the future. This patch also adapts all callers to use this new interface. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_frontend.c7
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c8
2 files changed, 10 insertions, 5 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index ae528d1b293a..3e11ea225dad 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -976,8 +976,11 @@ static void nl_fib_input(struct sk_buff *skb)
976static int __net_init nl_fib_lookup_init(struct net *net) 976static int __net_init nl_fib_lookup_init(struct net *net)
977{ 977{
978 struct sock *sk; 978 struct sock *sk;
979 sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, 0, 979 struct netlink_kernel_cfg cfg = {
980 nl_fib_input, NULL, THIS_MODULE); 980 .input = nl_fib_input,
981 };
982
983 sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, THIS_MODULE, &cfg);
981 if (sk == NULL) 984 if (sk == NULL)
982 return -EAFNOSUPPORT; 985 return -EAFNOSUPPORT;
983 net->ipv4.fibnl = sk; 986 net->ipv4.fibnl = sk;
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 99b3f53f16a7..1109f7f6c254 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -381,6 +381,9 @@ static struct nf_logger ipt_ulog_logger __read_mostly = {
381static int __init ulog_tg_init(void) 381static int __init ulog_tg_init(void)
382{ 382{
383 int ret, i; 383 int ret, i;
384 struct netlink_kernel_cfg cfg = {
385 .groups = ULOG_MAXNLGROUPS,
386 };
384 387
385 pr_debug("init module\n"); 388 pr_debug("init module\n");
386 389
@@ -393,9 +396,8 @@ static int __init ulog_tg_init(void)
393 for (i = 0; i < ULOG_MAXNLGROUPS; i++) 396 for (i = 0; i < ULOG_MAXNLGROUPS; i++)
394 setup_timer(&ulog_buffers[i].timer, ulog_timer, i); 397 setup_timer(&ulog_buffers[i].timer, ulog_timer, i);
395 398
396 nflognl = netlink_kernel_create(&init_net, 399 nflognl = netlink_kernel_create(&init_net, NETLINK_NFLOG,
397 NETLINK_NFLOG, ULOG_MAXNLGROUPS, NULL, 400 THIS_MODULE, &cfg);
398 NULL, THIS_MODULE);
399 if (!nflognl) 401 if (!nflognl)
400 return -ENOMEM; 402 return -ENOMEM;
401 403