From: Randy Dunlap <randy.dunlap@oracle.com>
To: Paul Moore <paul.moore@hp.com>
Cc: hadi@cyberus.ca, tgraf@suug.ch, netdev@vger.kernel.org
Subject: Re: Generic Netlink HOW-TO based on Jamal's original doc
Date: Fri, 10 Nov 2006 10:23:18 -0800 [thread overview]
Message-ID: <20061110102318.7b344d30.randy.dunlap@oracle.com> (raw)
In-Reply-To: <45541757.90800@hp.com>
[-- Attachment #1: Type: text/plain, Size: 885 bytes --]
On Fri, 10 Nov 2006 01:08:23 -0500 Paul Moore wrote:
> An Introduction To Using Generic Netlink
> ===============================================================================
> 3.1.2. The genl_family Structure
>
> Generic Netlink services are defined by the genl_family structure, which is
> shown below:
>
> struct genl_family
> {
> unsigned int id;
> unsigned int hdrsize;
> char name[GENL_NAMSIZ];
> unsigned int version;
> unsigned int maxattr;
> struct nlattr ** attrbuf;
> struct list_head ops_list;
> struct list_head family_list;
> };
Any alignment/packing concerns here? or that is already
handled, just not presented here?
and same questions for other structs below (deleted).
Typo patch attached.
---
~Randy
[-- Attachment #2: generic-netlink-howto.diff --]
[-- Type: text/x-patch, Size: 5033 bytes --]
--- generic-netlink-howto.txt.~1~ 2006-11-10 09:35:03.000000000 -0800
+++ generic-netlink-howto.txt 2006-11-10 10:21:10.000000000 -0800
@@ -40,7 +40,7 @@
kernel source code is your best friend here.
While this document talks briefly about Generic Netlink from a userspace point
-of view it's primary focus is on the kernel's Generic Netlink API. It is
+of view, its primary focus is on the kernel's Generic Netlink API. It is
recommended that application developers who are interested in using Generic
Netlink make use of the libnl library[1].
@@ -141,17 +141,17 @@
------------------------------------------------------------------------------
The Generic Netlink mechanism is based on a client-server model. The Generic
-Netlink servers register families, which are a collection of well defined
+Netlink servers register families, which are a collection of well-defined
services, with the controller and the clients communicate with the server
through these service registrations. This section explains how Generic Netlink
-families are defined, created and registered.
+families are defined, created, and registered.
3.1. Family Overview
------------------------------------------------------------------------------
Generic Netlink family service registrations are defined by two structures,
genl_family and genl_ops. The genl_family structure defines the family and
-it's associated communication channel. The genl_ops structure defines
+its associated communication channel. The genl_ops structure defines
an individual service or operation which the family provides to other Generic
Netlink users.
@@ -191,7 +191,7 @@
* unsigned int hdrsize
- If the family makes use of a family specific header, it's size is stored
+ If the family makes use of a family specific header, its size is stored
here. If there is no family specific header this value should be zero.
* char name[GENL_NAMSIZ]
@@ -278,19 +278,19 @@
o NLA_U8
- A 8 bit unsigned integer
+ A 8-bit unsigned integer
o NLA_U16
- A 16 bit unsigned integer
+ A 16-bit unsigned integer
o NLA_U32
- A 32 bit unsigned integer
+ A 32-bit unsigned integer
o NLA_U64
- A 64 bit unsigned integer
+ A 64-bit unsigned integer
o NLA_FLAG
@@ -298,7 +298,7 @@
o NLA_MSECS
- A 64 bit time value in msecs
+ A 64-bit time value in msecs
o NLA_STRING
@@ -319,7 +319,7 @@
NULL byte. If the attribute type is unknown or NLA_UNSPEC then this field
should be set to the exact length of the attribute's payload.
- Unless the attribute type is one of the fixed length types above, a value
+ Unless the attribute type is one of the fixed-length types above, a value
of zero indicates that no validation of the attribute should be performed.
* int (*doit)(struct skbuff *skb, struct genl_info *info)
@@ -331,7 +331,7 @@
which triggered the handler and the second is a Generic Netlink genl_info
structure which is defined in figure #5.
- struct genl_ops
+ struct genl_info
{
u32 snd_seq;
u32 snd_pid;
@@ -449,7 +449,7 @@
The second step is to define the operations for the family, which we do by
creating at least one instance of the genl_ops structure which we explained in
-section 3.1.2.. In this example we are only going to define one operation but
+section 3.1.2. In this example we are only going to define one operation but
you can define up to 255 unique operations for each family.
/* handler */
@@ -659,19 +659,19 @@
* scalar values
- Most scalar values already have well defined attribute types, see section 3
- for details
+ Most scalar values already have well-defined attribute types; see section 3
+ for details.
* structures
Structures can be represented using a nested attribute with the structure
- fields represented as attributes in the payload of the container attribute
+ fields represented as attributes in the payload of the container attribute.
* arrays
Arrays can be represented by using a single nested attribute as a container
with several of the same attribute type inside each representing a spot in
- the array
+ the array.
It is also important to use unique attributes as much as possible. This helps
make the most of the Netlink attribute mechanisms and provides for easy changes
@@ -681,7 +681,7 @@
------------------------------------------------------------------------------
While it may be tempting to register a single operation for a Generic Netlink
-family and multiplex multiple sub-commands on the single operation this
+family and multiplex multiple sub-commands on the single operation, this
is strongly discouraged for security reasons. Combining multiple behaviors
into one operation makes it difficult to restrict the operations using the
existing Linux kernel security mechanisms.
next prev parent reply other threads:[~2006-11-10 18:25 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-10 6:08 Generic Netlink HOW-TO based on Jamal's original doc Paul Moore
2006-11-10 6:37 ` James Morris
2006-11-10 6:45 ` Paul Moore
2006-11-10 14:34 ` jamal
2006-11-10 16:17 ` Paul Moore
2006-11-10 16:59 ` Randy Dunlap
2006-11-10 9:48 ` Thomas Graf
2006-11-10 16:08 ` Paul Moore
2006-11-10 13:24 ` Jarek Poplawski
2006-11-10 16:10 ` Paul Moore
2006-11-10 17:36 ` Thomas Graf
2006-11-13 7:05 ` Jarek Poplawski
2006-11-13 7:23 ` Jarek Poplawski
2006-11-13 14:08 ` Paul Moore
2006-11-13 14:17 ` jamal
2006-11-13 20:06 ` Paul Moore
2006-11-17 13:05 ` jamal
2006-11-17 19:47 ` jamal
2006-11-17 23:53 ` Paul Moore
2006-11-18 17:06 ` jamal
2006-11-20 7:39 ` Jarek Poplawski
2006-11-21 22:24 ` Paul Moore
2006-11-22 12:27 ` Jarek Poplawski
2006-11-22 21:38 ` Paul Moore
2006-11-20 7:26 ` Jarek Poplawski
2006-11-13 19:58 ` Paul Moore
2006-11-14 6:53 ` Jarek Poplawski
2006-11-10 15:49 ` Stephen Hemminger
2006-11-10 16:20 ` Paul Moore
2006-11-10 18:23 ` Randy Dunlap [this message]
2006-11-10 19:50 ` Paul Moore
2006-11-10 22:12 ` Thomas Graf
2006-11-10 22:49 ` Randy Dunlap
2006-11-10 22:56 ` Thomas Graf
2006-11-10 23:17 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061110102318.7b344d30.randy.dunlap@oracle.com \
--to=randy.dunlap@oracle.com \
--cc=hadi@cyberus.ca \
--cc=netdev@vger.kernel.org \
--cc=paul.moore@hp.com \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).