netlink_kernel_create is not working with latest linux kernel

c, kernel, netlink

Solution

Just replace

nl_sk = netlink_kernel_create(&init_net, 17, 0, recv_cmd, NULL, THIS_MODULE);

with the following

struct netlink_kernel_cfg cfg = {
    .input = recv_cmd,
};

nl_sk = netlink_kernel_create(&init_net, 17, &cfg);

and it should work. I ran into the same problems.

Problem

I am getting compiler error while compiling my old `kernel` module which is using netlink functions. ``` int init_module() { /* Initialize the Netlink kernel interface */ nl_sk = netlink_kernel_create(&init_net, 17, 0, recv_cmd, NULL, THIS_MODULE); if(!nl_sk) { printk(KERN_INFO "failed to initialize system (error: 1001)\n"); return -ENOMEM; } .... ``` Previously it works fine but now I am getting this error. ``` error: too many arguments to function 'netlink_kernel_create' ``` OS Information ``` uname -a Linux ibrar-ahmed 3.8.0-17-generic #27-Ubuntu SMP Sun Apr 7 19:39:35 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux ```

Original source