[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1288125432.2652.39.camel@edumazet-laptop>
Date: Tue, 26 Oct 2010 22:37:12 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Ben Greear <greearb@...delatech.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: netlink stats: Ability to get stats for a single device?
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]);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists