netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about netlink
@ 2003-07-08 18:43 Krishna Kumar
  2003-07-08 19:04 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 4+ messages in thread
From: Krishna Kumar @ 2003-07-08 18:43 UTC (permalink / raw)
  To: David S. Miller, kuznet, netdev

Hi,

Some of the netlink routines (eg rtnetlink_dump_ifinfo or inet6_dump_ifaddr) seem to get
user arguments from cb->args['n']. However I was not able to figure out where the
arguments are being set, can anyone help ?

netlink_dump_start() is where the cb gets allocated (initialized to 0), and that calls
netlink_dump(), which calls the assigned routine. I couldn't find where the args gets
initialized to user provided values. Any pointer to what to look for is very much
appreciated.

Thanks,

- KK

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about netlink
  2003-07-08 18:43 Question about netlink Krishna Kumar
@ 2003-07-08 19:04 ` YOSHIFUJI Hideaki / 吉藤英明
  2003-07-08 20:27   ` Krishna Kumar
  0 siblings, 1 reply; 4+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-07-08 19:04 UTC (permalink / raw)
  To: krkumar; +Cc: davem, kuznet, netdev

In article <3F0B10E3.9050700@us.ibm.com> (at Tue, 08 Jul 2003 11:43:47 -0700), Krishna Kumar <krkumar@us.ibm.com> says:

> Some of the netlink routines (eg rtnetlink_dump_ifinfo or inet6_dump_ifaddr) seem to get
> user arguments from cb->args['n']. However I was not able to figure out where the
> arguments are being set, can anyone help ?

Take a look at net/core/rtnelink.c:rtnetlink_dump_ifinfo()
               net/core/neighbour.c:neigh_dump_{info,table}()
and seek the truth. :-)

--yoshfuji

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about netlink
  2003-07-08 19:04 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2003-07-08 20:27   ` Krishna Kumar
  2003-07-08 23:50     ` kuznet
  0 siblings, 1 reply; 4+ messages in thread
From: Krishna Kumar @ 2003-07-08 20:27 UTC (permalink / raw)
  To: yoshfuji; +Cc: davem, kuznet, netdev

I am still not convinced how it works, though I have been trying to seek the truth for some
time now :-).

These routines 'get' the value of args[0] and then 'set' it to the resultant value. How is
this value set in the first place to the user provided value ? It seems to be initialized
to ZERO in netlink_dump_start(). The only way it seems to use the value is if it gets
called twice from netlink_dump(), the first time cb->args will be set to zero's while the
second time it will have the values set by the first invocation to the same routine. Am I
missing something or is 'args' not intended for user specified arguments ? If so, how
should we access the arguments passed by the user ?

Thanks,

- KK

YOSHIFUJI Hideaki wrote:
> In article <3F0B10E3.9050700@us.ibm.com> (at Tue, 08 Jul 2003 11:43:47 -0700), Krishna Kumar <krkumar@us.ibm.com> says:
> 
> 
>>Some of the netlink routines (eg rtnetlink_dump_ifinfo or inet6_dump_ifaddr) seem to get
>>user arguments from cb->args['n']. However I was not able to figure out where the
>>arguments are being set, can anyone help ?
> 
> 
> Take a look at net/core/rtnelink.c:rtnetlink_dump_ifinfo()
>                net/core/neighbour.c:neigh_dump_{info,table}()
> and seek the truth. :-)
> 
> --yoshfuji
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about netlink
  2003-07-08 20:27   ` Krishna Kumar
@ 2003-07-08 23:50     ` kuznet
  0 siblings, 0 replies; 4+ messages in thread
From: kuznet @ 2003-07-08 23:50 UTC (permalink / raw)
  To: Krishna Kumar; +Cc: yoshfuji, davem, netdev

Hello!

> These routines 'get' the value of args[0] and then 'set' it to the resultant value. How is
> this value set in the first place to the user provided value ?

It is not. Zero values means that dump starts from the very beginning.
It is supposed to be done at the first entry to the ->dump(),
but selective dumps are not implemented in the most of ->dump() methods.


> missing something or is 'args' not intended for user specified arguments ? If so, how
> should we access the arguments passed by the user ?

The pointer to nlmsg header is kept in cb->nlh. So, you can refer to
it to get user supplied values of selector to rewind the dump to required
point at the first entry or to select some specific entries while scanning
a table.

F.e. look into sch_api.c:tc_dump_tclass(), it scopes dump to a netdevice
(tcp_ifindex), and filters answers to a specific qdisc (tcp_parent).
It is also partial. More finegrain selection is not required, but desired,
feel free to implement. F.e. implementation of "ip route ls root 3ffe::/24",
which translates to selection of a root node for fib6_walk() to a more
specific place and filtering out some nodes while walking, would be cool.

Alexey

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-07-08 23:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-08 18:43 Question about netlink Krishna Kumar
2003-07-08 19:04 ` YOSHIFUJI Hideaki / 吉藤英明
2003-07-08 20:27   ` Krishna Kumar
2003-07-08 23:50     ` kuznet

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).