mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 06:01:23 +00:00
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>
This commit is contained in:
parent
dd7f36ba3c
commit
a31f2d17b3
20 changed files with 117 additions and 51 deletions
|
@ -962,14 +962,17 @@ static void audit_receive(struct sk_buff *skb)
|
|||
static int __init audit_init(void)
|
||||
{
|
||||
int i;
|
||||
struct netlink_kernel_cfg cfg = {
|
||||
.input = audit_receive,
|
||||
};
|
||||
|
||||
if (audit_initialized == AUDIT_DISABLED)
|
||||
return 0;
|
||||
|
||||
printk(KERN_INFO "audit: initializing netlink socket (%s)\n",
|
||||
audit_default ? "enabled" : "disabled");
|
||||
audit_sock = netlink_kernel_create(&init_net, NETLINK_AUDIT, 0,
|
||||
audit_receive, NULL, THIS_MODULE);
|
||||
audit_sock = netlink_kernel_create(&init_net, NETLINK_AUDIT,
|
||||
THIS_MODULE, &cfg);
|
||||
if (!audit_sock)
|
||||
audit_panic("cannot initialize netlink socket");
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue