All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Eric Dumazet <eric.dumazet@gmail.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 13:29:18 -0700	[thread overview]
Message-ID: <4CC73A1E.5050605@candelatech.com> (raw)
In-Reply-To: <1288122986.2652.20.camel@edumazet-laptop>

On 10/26/2010 12:56 PM, Eric Dumazet wrote:
> Le mardi 26 octobre 2010 à 12:38 -0700, David Miller a écrit :
>> From: Ben Greear<greearb@candelatech.com>
>> Date: Tue, 26 Oct 2010 12:31:12 -0700
>>
>>> Am I missing something, or do I just need to write up a patch
>>> to have netlink pay attention to the ifindex?
>>
>> Setting the ->ifi_index or IFLA_IFNAME attribute values appropriately
>> in the getlink request doesn't work?
>>
>> That should give you back, amonst other things, the rtnl_link_stats
>> for the device in the netlink response.
>> --
>
> Yep, it should be easy to change iproute2 to not ask a full dump
> in ip/ipaddress.c :
>
> if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETLINK)<  0) ...
>
> and instead use rtnl_send() or something like that, if user provided one
> specific interface name   (or index)
>
> ip link show dev eth0

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;
    static unsigned int nl_seqno = 1;
    nlh->nlmsg_seq = nl_seqno++;
    nlh->nlmsg_pid = nl_pid;



       nlh->nlmsg_len = NLMSG_LENGTH(sizeof(*ifinfomsg));
       ifinfomsg = (struct ifinfomsg*)(NLMSG_DATA(nlh));
       ifinfomsg->ifi_family = AF_UNSPEC;
       ifinfomsg->ifi_type = IFLA_UNSPEC;
       ifinfomsg->ifi_index = if_index;
       ifinfomsg->ifi_flags = 0;
       ifinfomsg->ifi_change = 0xffffffff;


It's possible that I'm somehow messing this up. But, looking at the
static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
method, I cannot see how it would bail out properly after a single dev
has been processed, either.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


  reply	other threads:[~2010-10-26 20:29 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 [this message]
2010-10-26 20:37       ` Eric Dumazet
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=4CC73A1E.5050605@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.