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:

committed by
David S. Miller

parent
dd7f36ba3c
commit
a31f2d17b3
@@ -174,11 +174,16 @@ struct netlink_skb_parms {
|
||||
extern void netlink_table_grab(void);
|
||||
extern void netlink_table_ungrab(void);
|
||||
|
||||
extern struct sock *netlink_kernel_create(struct net *net,
|
||||
int unit,unsigned int groups,
|
||||
void (*input)(struct sk_buff *skb),
|
||||
struct mutex *cb_mutex,
|
||||
struct module *module);
|
||||
/* optional Netlink kernel configuration parameters */
|
||||
struct netlink_kernel_cfg {
|
||||
unsigned int groups;
|
||||
void (*input)(struct sk_buff *skb);
|
||||
struct mutex *cb_mutex;
|
||||
};
|
||||
|
||||
extern struct sock *netlink_kernel_create(struct net *net, int unit,
|
||||
struct module *module,
|
||||
struct netlink_kernel_cfg *cfg);
|
||||
extern void netlink_kernel_release(struct sock *sk);
|
||||
extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
|
||||
extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
|
||||
|
Reference in New Issue
Block a user