Debugging Netlink Sockets
Tips to debug netlink messages
Debugging libnl
If you are using libnl the easiest way to debug netlink messages is using the build-in debugging capabilities.
NLDBG=4 ./myprog
see here for complete reference of debug levels
using NLMON
Since kernel version 3.11 there is support for generic netlink message monitoring available. To check if your current kernel configuration supports netlink monitoring you can use
zgrep CONFIG_NLMON /proc/config.gz
To use nlmon
one has to load the module if necessay, and add a new interface
modprobe nlmon
ip link add type nlmon
ip link set nlmon0 up
Now you can use wireshark
, tcpdump
, or any other network-sniffer to analyze netlink messages.