[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120419133635.7d816d67@nehalam.linuxnetplumber.net>
Date: Thu, 19 Apr 2012 13:36:35 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: Kristian Evensen <kristian.evensen@...il.com>
Cc: Ben Greear <greearb@...delatech.com>, netdev@...r.kernel.org
Subject: Re: RTM_NEWLINK not received by application when connecting
multiple devices simultaneously
On Thu, 19 Apr 2012 21:54:24 +0200
Kristian Evensen <kristian.evensen@...il.com> wrote:
> I spent some more time debugging this now. It turns out that which
> interface is seen by my application is not random, it is always the
> first one that is connected. This indicates that the bug is that the
> netlink message contains information about more than one interface.
> However, I am not able to prove this.
There is no filtering. A dump request always returns all interfaces.
> When I check for the presence of NLM_F_MULTI, it is always NULL. Also,
> the length of the received nlmsg (including payload) always equals the
> numbers of bytes I receive from the netlink socket, i.e., all the data
> is received.
The flags for nested and multi are relatively new. The original ancient
rtnetlink message formats dont use them, don't depend on them.
Since rtnetlink is cast in ABI concrete, it can't be fixed.
> Based on my understanding of netlink, an nlmsg will only contain one
> packet (for example ifinfomsg), unless the NLM_F_MULTI flag is set. Or
> am I mistaken?
The only reliable way is to parse the response to GET request is
to keep reading until you see NLMSG_DONE (or NLMSG_ERROR)
Look at example in libmnl source examples/rtnl/rtnl-link-dump.c
--
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