Skip to contentSkip to conversation

introduce command names

RFC In review jamal 2 participants 5 messages Dec 2, 2006 – Dec 4, 2006

Subsystems (2)
lore
Share & tools
lore

jamal

author
#0 lore raw

RFC 1/1 introduce command names

Dave,
Same as before:
If there is no objections on this approach, please apply this patch. Against net-2.6.20

cheers,
jamal

[GENETLINK] introduce command names

Introduce optional command names.
While command names can be put in user space by the author of the command, this alleviates things for the discovery process without requiring any user space code written.
In a recent tutorial that i gave, the desire for this feature was the highest.

---
commit c3b92488bea3f11a6cc7c1c59101444c26ad12ce
tree 52166fb1ea684e989fef16de89c85fb9bf551bb8
parent b6ac8f41bdd2edd9d215e376efa47261e9b118a1
author Jamal Hadi Salim <[email protected]> Sat, 02 Dec 2006 07:08:15 -0500 committer Jamal Hadi Salim <[email protected]> Sat, 02 Dec 2006 07:08:15 -0500

 include/net/genetlink.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/net/genetlink.h +2 -0
index 7fd131c..52bc278 100644
@@ -49,6 +49,7 @@ struct genl_info
 /**
  * struct genl_ops - generic netlink operations
  * @cmd: command identifier
+ * @name: command name
  * @flags: flags
  * @policy: attribute validation policy
  * @doit: standard command callback
@@ -58,6 +59,7 @@ struct genl_info
 struct genl_ops
 {
 	u8			cmd;
+	char			name[GENL_NAMSIZ];
 	unsigned int		flags;
 	struct nla_policy	*policy;
 	int		       (*doit)(struct sk_buff *skb,
#1 lore raw

* jamal <[email protected]> 2006-12-02 07:11

Quoted 8 lines

[GENETLINK] introduce command names

Introduce optional command names.
While command names can be put in user space by the author of the command, this alleviates things for the discovery process without requiring any user space code written.
In a recent tutorial that i gave, the desire for this feature was the highest.

I assume you're planning to export this to userspace at some point? What's the real advantage besides that when listing avaiable operations we can output names instead of numbers? Userspace should be aware of operation numbers when using it. I'm all for this if the direction is to move towards having some form of scriptable genetlink tool which can be used to communicate with simple genetlink families.

I guess the desire was the highest because you sold it as such :-)

author
#2 lore raw
Quoted 11 lines · Thomas Graf

* jamal <[email protected]> 2006-12-02 07:11

Quoted 8 lines

[GENETLINK] introduce command names

Introduce optional command names.
While command names can be put in user space by the author of the command, this alleviates things for the discovery process without requiring any user space code written.
In a recent tutorial that i gave, the desire for this feature was the highest.

I assume you're planning to export this to userspace at some point?

Right.

Quoted 2 lines

What's the real advantage besides that when listing avaiable operations we can output names instead of numbers?

Just makes the discovery more knowledgeable.
Theres a hidden meaning in that i would like if possible to create as much of user space as possible without the user having a single line written. Heres how i output the discovered families at the moment without the patch.

-----

hadi@lilsol:~/git-trees/iproute2/nov22/genl$ ./genl ctrl ls
Added Family  Name: nlctrl
        ID: 0x10  Version: 0x1  header size: 0  max attribs: 6 
        commands supported: 
                #1:  ID-0x3  flags-0x0 
                        Capabilities:  has policy; can doit; can dumpit

Added Family Name: TASKSTATS

        ID: 0x11  Version: 0x1  header size: 0  max attribs: 4 
        commands supported: 
                #1:  ID-0x1  flags-0x0 
                        Capabilities:  has policy; can doit;

hadi@lilsol:~/git-trees/iproute2/nov22/genl$
-----------

It would be a lot more human friendly to put better readability in the commands.

Quoted 6 lines

Userspace should
be aware of operation numbers when using it. I'm all for this if the direction is to move towards having some form of scriptable genetlink tool which can be used to communicate with simple genetlink families.

That is the real agenda actually. To be honest i dont know how realistic it would be. But one of the next things is to output the command policies.

Quoted 1 line

I guess the desire was the highest because you sold it as such :-)

Theres some truth to that ;-> But i didnt start it;->, after two people asking why they couldnt tell the command name, it connected to me i also need it for this other reason.

cheers,
jamal

#3 lore raw

* jamal <[email protected]> 2006-12-04 08:09

Quoted 20 lines

Just makes the discovery more knowledgeable.
Theres a hidden meaning in that i would like if possible to create as much of user space as possible without the user having a single line written. Heres how i output the discovered families at the moment without the patch.

-----

hadi@lilsol:~/git-trees/iproute2/nov22/genl$ ./genl ctrl ls
Added Family  Name: nlctrl
        ID: 0x10  Version: 0x1  header size: 0  max attribs: 6 
        commands supported: 
                #1:  ID-0x3  flags-0x0 
                        Capabilities:  has policy; can doit; can dumpit

Added Family Name: TASKSTATS

        ID: 0x11  Version: 0x1  header size: 0  max attribs: 4 
        commands supported: 
                #1:  ID-0x1  flags-0x0 
                        Capabilities:  has policy; can doit;
Quoted 5 lines

hadi@lilsol:~/git-trees/iproute2/nov22/genl$
-----------

It would be a lot more human friendly to put better readability in the commands.

I don't agree to waste so much text section just to fancy up some userspace tool which is mainly a toy while developing. If you really need it, do it in userspace like libnl.

Quoted 10 lines
Quoted 6 lines

Userspace should
be aware of operation numbers when using it. I'm all for this if the direction is to move towards having some form of scriptable genetlink tool which can be used to communicate with simple genetlink families.

That is the real agenda actually. To be honest i dont know how realistic it would be. But one of the next things is to output the command policies.

Once we go that path we can reconsider a patch based on this which includes the bits to dump the information to userspace. Until then I don't see the point in this.

author
#4 lore raw
Quoted 2 lines · Thomas Graf

* jamal <[email protected]> 2006-12-04 08:09

Quoted 1 line

Just makes the discovery more knowledgeable.

...
...

Quoted 5 lines
Quoted 2 lines

It would be a lot more human friendly to put better readability in the commands.

I don't agree to waste so much text section just to fancy up some userspace tool which is mainly a toy while developing.

Hey, it is not a toy ;->

Quoted 2 lines

If you
really need it, do it in userspace like libnl.

...
....

Quoted 7 lines
Quoted 3 lines

That is the real agenda actually. To be honest i dont know how realistic it would be. But one of the next things is to output the command policies.

Once we go that path we can reconsider a patch based on this which includes the bits to dump the information to userspace. Until then I don't see the point in this.

Ok, fair enough lets defer it for then.

cheers,
jamal