From: Eric Dumazet <eric.dumazet@gmail.com>
To: Ben Greear <greearb@candelatech.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: netlink stats: Ability to get stats for a single device?
Date: Tue, 26 Oct 2010 22:37:12 +0200 [thread overview]
Message-ID: <1288125432.2652.39.camel@edumazet-laptop> (raw)
In-Reply-To: <4CC73A1E.5050605@candelatech.com>
Le mardi 26 octobre 2010 à 13:29 -0700, Ben Greear a écrit :
> I'm trying to craft my own netlink message...basically:
>
> memset(&snl, 0, sizeof(snl));
> snl.nl_family = AF_NETLINK;
> snl.nl_pid = 0;
> snl.nl_groups = 0;
>
> memset(&buffer, 0, sizeof(buffer));
> nlh->nlmsg_type = msg_type;
> nlh->nlmsg_flags = NLM_F_MATCH|NLM_F_REQUEST;
dont use F_MATCH : check net/core/rtnetlink.c
vi +1660 net/core/rtnetlink.c
You _dont_ want to call 'dumpit' : so dont use a bit present in
NLM_F_DUMP at all:
if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) {
struct sock *rtnl;
rtnl_dumpit_func dumpit;
dumpit = rtnl_get_dumpit(family, type);
if (dumpit == NULL)
return -EOPNOTSUPP;
__rtnl_unlock();
rtnl = net->rtnl;
err = netlink_dump_start(rtnl, skb, nlh, dumpit, NULL);
rtnl_lock();
return err;
}
You want instead to call the 'doit' handler (one device only)
doit = rtnl_get_doit(family, type);
if (doit == NULL)
return -EOPNOTSUPP;
return doit(skb, nlh, (void *)&rta_buf[0]);
next prev parent reply other threads:[~2010-10-26 20:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-26 19:31 netlink stats: Ability to get stats for a single device? Ben Greear
2010-10-26 19:35 ` Eric Dumazet
2010-10-26 19:38 ` David Miller
2010-10-26 19:56 ` Eric Dumazet
2010-10-26 20:29 ` Ben Greear
2010-10-26 20:37 ` Eric Dumazet [this message]
2010-10-26 20:43 ` Ben Greear
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=1288125432.2652.39.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=greearb@candelatech.com \
--cc=netdev@vger.kernel.org \
/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