0

I need a IPC between kernel and user-space communication. The kernel module should first initiate the communication to user-space module.

I looked into various methods of kernel to user-space communication like IOCTL, char device, Netlink sockets. Because I need kernel to initiate the communication I dropped IOCTL and char device because the control starts from user-space. I only found Netlink sockets with full duplex communication.

But I was not able to find a simple example program in which the kernel originates the call to user-space first. I was only able to find example for User-space originating the call. Can you please point me to books or examples that shows how kernel can initiate a Netlink socket communication to user-space. Thanks!

  • Find an existing k-module that does this and download the source? – Déjà vu Mar 28 '19 at 21:24
  • Did you see your application or some other code in kernel can subscribe to netlink groups and corresponding event in kernel is broadcasted to all the subscribers. – Zzz0_o Apr 03 '19 at 13:07
  • @user7718036 see rtnl_notify() usage in linux kernel source. – Zzz0_o Apr 03 '19 at 13:13
  • Thanks guys. I was able to establish a communication between kernel and userspace with kernel initiating the process. I used a char device to send the pid of the userspace module and then create a kernel netlink socket and send unicast message. – user7718036 Apr 05 '19 at 20:56
  • Just curious to know that if there is way to receive netlink message in kernel without specifying the .input target function in netlink_kernel_cfg structure. – user7718036 Apr 05 '19 at 20:58

0 Answers0