I was trying to reproduce the example from a previous SO post on a kernel above 4 (4.1):
#include
#include
#inc
You forgot to bind the socket. :-)
I'm not very fluent with Python, so use this only as a starting point (between the socket
and the setsockopt
):
sock.bind((0, 0))
That prints me a bunch of garbage, among which I can see
Hello from kernel
By the way: When nlmsg_multicast()
throws ESRCH
, it's usually (or maybe always) because there were no clients listening.
First open the client, then try to send the message from the kernel.
Otherwise you can always ignore that error code it that makes sense for your use case.