This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
networking:generic_netlink_howto [2016/12/01 20:20] mgssnr [References] |
networking:generic_netlink_howto [2017/05/18 15:45] (current) Yaron_Shragai genl_register_ops is deprecated - provided appropriate replacement information. |
||
---|---|---|---|
Line 38: | Line 38: | ||
This section deals with the Generic Netlink subsystem in the Linux kernel and | This section deals with the Generic Netlink subsystem in the Linux kernel and | ||
provides a simple example of how in-kernel users can make use of the Generic | provides a simple example of how in-kernel users can make use of the Generic | ||
- | Netlink API. Don't forget to review section #4, "Recommendations", before | + | Netlink API. Don't forget to review section #4, "Recommendations", before writing any code as it can save you, and the people who review your code, |
- | [[https://twitter.com/redgage | writing]] any code as it can save you, and the people who review your code, | + | |
lots of time! | lots of time! | ||
Line 119: | Line 118: | ||
if (rc != 0) | if (rc != 0) | ||
goto failure;</code> | goto failure;</code> | ||
+ | |||
This call registers the new family name with the Generic Netlink mechanism and | This call registers the new family name with the Generic Netlink mechanism and | ||
requests a new channel number which is stored in the genl_family struct, | requests a new channel number which is stored in the genl_family struct, | ||
Line 132: | Line 131: | ||
if (rc != 0) | if (rc != 0) | ||
goto failure;</code> | goto failure;</code> | ||
+ | |||
+ | NOTE: This function doesn't exist past linux 3.12. | ||
+ | Up to linux 4.10, use genl_register_family_with_ops(). | ||
+ | On 4.10 and later, include a reference to your genl_ops struct as an element | ||
+ | in the genl_family struct (element .ops), as well as the number of commands | ||
+ | (element .n_ops). | ||
This call registers the DOC_EXMPL_C_ECHO operation in association with the | This call registers the DOC_EXMPL_C_ECHO operation in association with the | ||
Line 441: | Line 446: | ||
- [[http://people.suug.ch/~tgr/libnl|http://people.suug.ch/~tgr/libnl]] | - [[http://people.suug.ch/~tgr/libnl|http://people.suug.ch/~tgr/libnl]] | ||
- | NOTE: This link is no longer valid. | + | NOTE: This link is no longer valid. Try [[http://www.infradead.org/~tgr/libnl|http://www.infradead.org/~tgr/libnl]] |