Skip to content

Instantly share code, notes, and snippets.

@supermartian
Created March 12, 2013 07:27
Show Gist options
  • Save supermartian/5140929 to your computer and use it in GitHub Desktop.
Save supermartian/5140929 to your computer and use it in GitHub Desktop.
Netlink programming demo.
@igaw
Copy link

igaw commented May 23, 2022

The raw RTNL interface is tricky. I would recomand to use libmnl & co. If you want/have to use the Kernel API check the examples in the man pages. Basically you want a buffer and use 'the position macros' (e.g. NLMSG_DATA) to place the write/read head. These macros get the alignment and padding right.

https://man7.org/linux/man-pages/man7/netlink.7.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment