diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-06-29 02:15:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-29 19:46:02 -0400 |
commit | a31f2d17b331db970259e875b7223d3aba7e3821 (patch) | |
tree | 0d10021be81446ab360f4240b0d16729f518387f /net/netlink/genetlink.c | |
parent | dd7f36ba3ce17d4fe85987d83efd5901b0935816 (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/netlink/genetlink.c')
-rw-r--r-- | net/netlink/genetlink.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 2cc7c1ee7690..32761b53015e 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -915,10 +915,14 @@ static struct genl_multicast_group notify_grp = { | |||
915 | 915 | ||
916 | static int __net_init genl_pernet_init(struct net *net) | 916 | static int __net_init genl_pernet_init(struct net *net) |
917 | { | 917 | { |
918 | struct netlink_kernel_cfg cfg = { | ||
919 | .input = genl_rcv, | ||
920 | .cb_mutex = &genl_mutex, | ||
921 | }; | ||
922 | |||
918 | /* we'll bump the group number right afterwards */ | 923 | /* we'll bump the group number right afterwards */ |
919 | net->genl_sock = netlink_kernel_create(net, NETLINK_GENERIC, 0, | 924 | net->genl_sock = netlink_kernel_create(net, NETLINK_GENERIC, |
920 | genl_rcv, &genl_mutex, | 925 | THIS_MODULE, &cfg); |
921 | THIS_MODULE); | ||
922 | 926 | ||
923 | if (!net->genl_sock && net_eq(net, &init_net)) | 927 | if (!net->genl_sock && net_eq(net, &init_net)) |
924 | panic("GENL: Cannot initialize generic netlink\n"); | 928 | panic("GENL: Cannot initialize generic netlink\n"); |