A command line tool (example) showing AF_NETLINK data from the kernel
A very bare bones source code showing how it can be done. I used this to figure it out when implementing functionality for Firefox to detect when the network changes:
http://daniel.haxx.se/blog/2015/01/16/changing-networks-with-linux/
Code licensed under MIT. See header of source code.
Daniel Stenberg, January 2015