Python Netlink Multicast Communication in Kernels above 4

前端 未结 1 986
予麋鹿
予麋鹿 2020-12-16 08:50

I was trying to reproduce the example from a previous SO post on a kernel above 4 (4.1):

#include 
#include 
#inc         


        
相关标签:
1条回答
  • 2020-12-16 09:24

    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.

    0 讨论(0)
提交回复
热议问题