Is it possible to communicate between two linux kernel module via netlink?
Asked Answered
A

1

6

As all know, netlink it's user/kernel space communication mechanism.

I want to communicate from my kernel module to an another. Another kernel module already has the netlink interface.

Is it possible to make connection from kernel module to netlink, as we do it in user space?

Amuck answered 13/6, 2012 at 12:49 Comment(1)
Exporting symbols - it's good idea, but I can't modify another module. It doesn't export needed function.Amuck
B
6

Short answer: No.

If you want to communicate between two kernel modules you should use symbols (global variables or functions) which are exported by the other kernel module.

netlink Sockets are used to communicate between kernel and userland. AFAIR there is no way to use netlink (at least it is not the preferred way) to communicate within the kernel.

example for exporting a symbol:

module1.c:

  int foo(int a)
  {
      /* do some stuff here */
  }
  EXPORT_SYMBOL(foo);

module2.c

  extern int foo(int);
  int bla(int b)
  {
      /* call foo(a) */
      int ret = foo(b);
  }
Buckish answered 13/6, 2012 at 13:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.