User Tools

Site Tools


networking:generic_netlink_howto

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking:generic_netlink_howto [2016/11/07 17:49]
KąMykolas Fix broken internal links. (No other way to build index?)
networking:generic_netlink_howto [2017/05/18 15:45] (current)
Yaron_Shragai genl_register_ops is deprecated - provided appropriate replacement information.
Line 14: Line 14:
 =====Contents===== =====Contents=====
  
-  * [[#Generic_Netlink_By_Example|1 Generic Netlink By Example]] +  * [[#Generic Netlink By Example|1 Generic Netlink By Example]] 
-    * [[#Registering_A_Family|1.1 Registering A Family]] +    * [[#Registering A Family|1.1 Registering A Family]] 
-    * [[#Kernel_Communication|1.2 Kernel Communication]] +    * [[#Kernel Communication|1.2 Kernel Communication]] 
-      * [[#Sending_Messages|1.2.1 Sending Messages]] +      * [[#Sending Messages|1.2.1 Sending Messages]] 
-      * [[#Receiving_Messages|1.2.2 Receiving Messages]] +      * [[#Receiving Messages|1.2.2 Receiving Messages]] 
-    * [[#Userspace_Communication|1.3 Userspace Communication]] +    * [[#Userspace Communication|1.3 Userspace Communication]] 
-  * [[#Architectural_Overview|2 Architectural Overview]] +  * [[#Architectural Overview|2 Architectural Overview]] 
-  * [[#Implementation_Details|3 Implementation Details]] +  * [[#Implementation Details|3 Implementation Details]] 
-    * [[#Message_Format|3.1 Message Format]] +    * [[#Message Format|3.1 Message Format]] 
-    * [[#Data_Structures|3.2 Data Structures]] +    * [[#Data Structures|3.2 Data Structures]] 
-      * [[#The_genl_family_Structure|3.2.1 The genl_family Structure]] +      * [[#The genl_family Structure|3.2.1 The genl_family Structure]] 
-      * [[#The_genl_ops_Structure|3.2.2 The genl_ops Structure]] +      * [[#The genl_ops Structure|3.2.2 The genl_ops Structure]] 
-      * [[#The_genl_info_Structure|3.2.3 The genl_info Structure]] +      * [[#The genl_info Structure|3.2.3 The genl_info Structure]] 
-      * [[#The_nla_policy_Structure|3.2.4 The nla_policy Structure]]+      * [[#The nla_policy Structure|3.2.4 The nla_policy Structure]]
   * [[#​Recommendations|4 Recommendations]]   * [[#​Recommendations|4 Recommendations]]
-    * [[#Attributes_And_Message_Payloads|4.1 Attributes And Message Payloads]] +    * [[#Attributes And Message Payloads|4.1 Attributes And Message Payloads]] 
-    * [[#Operation_Granularity|4.2 Operation Granularity]] +    * [[#Operation Granularity|4.2 Operation Granularity]] 
-    * [[#Acknowledgment_and_Error_Reporting|4.3 Acknowledgment and Error Reporting]]+    * [[#Acknowledgment and Error Reporting|4.3 Acknowledgment and Error Reporting]]
   * [[#​References|5 References]]   * [[#​References|5 References]]
  
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. ​ Try [[http://​www.infradead.org/​~tgr/​libnl|http://​www.infradead.org/​~tgr/​libnl]]
networking/generic_netlink_howto.1478540986.txt.gz · Last modified: 2016/11/07 17:49 by KąMykolas