Frank Maker | ed6b39c | 2011-05-23 21:14:58 -0700 | [diff] [blame^] | 1 | Netlink Protocol Format (RFC3549) |
| 2 | +-----------------+-+-------------------+-+ |
| 3 | |Netlink Message |P| Generic Netlink |P| |
| 4 | | Header |A| Message Header |A| |
| 5 | |(struct nlmsghdr)|D|(struct genlmsghdr)|D| |
| 6 | +-----------------+-+-------------------+-+ |
| 7 | +-----------------+-+-----------------+-+-----------------+-+-----------------+-+---+ |
| 8 | |Netlink Attribute|P|Netlink Attribute|P|Netlink Attribute|P|Netlink Attribute|P|...| |
| 9 | | #0 Header |A| #0 Payload |A| #1 Header |A| #1 Payload |A| | |
| 10 | | (struct nlattr) |D| (void) |D| (struct nlattr) |D| (void) |D| | |
| 11 | +-----------------+-+-----------------+-+-----------------+-+-----------------+-+---+ |
| 12 | |
| 13 | * Each netlink message consists of a bitstream with a netlink header. |
| 14 | * After this header a second header *can* be used specific to the netlink |
| 15 | family in use. This library was tested using the generic netlink |
| 16 | protocol defined by struct genlmsghdr to support nl80211. |
| 17 | * After the header(s) netlink attributes can be appended to the message |
| 18 | which hold can hold basic types such as unsigned integers and strings. |
| 19 | * All data structures in this implementation are byte-aligned (Currently 4 bytes). |
| 20 | * Acknowledgements (ACKs) are sent as NLMSG_ERROR netlink message types (0x2) and |
| 21 | have an error value of 0. |
| 22 | |
| 23 | KNOWN BUGS |
| 24 | * NOT THREAD SAFE!!! |
| 25 | * nla_parse - does not use nla_policy argument |
| 26 | * nl_recvmsgs - does not support nl_cb_overwrite_recv() |
| 27 | * nl_recv - sets/unsets async. flag |
| 28 | * genl_ctrl_alloc_cache - netlink send/recv funcs should be used |
| 29 | |
| 30 | REFERENCES |
| 31 | * nl80211.h |
| 32 | * netlink_types.h |
| 33 | * $LINUX_KERNEL/net/wireless/nl80211.c |
| 34 | * http://www.infradead.org/~tgr/libnl/doc-3.0/index.html |
| 35 | * http://www.netfilter.org/projects/libmnl/doxygen/index.html |