Re: RTM_NEWLINK not received by application when connecting multiple devices simultaneously

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Thu, 19 Apr 2012 21:54:24 +0200
Kristian Evensen <kristian.evensen@xxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at

[Linux Kernel Discussion]     [Ethernet Bridging]     [Linux Wireless Networking]     [Linux Bluetooth Networking]     [Linux Networking Users]     [VLAN]     [Git]     [IETF Annouce]     [Linux Assembly]     [Security]     [Bugtraq]     [Photo]     [Singles Social Networking]     [Yosemite Information]     [MIPS Linux]     [ARM Linux Kernel]     [ARM Linux]     [Linux Virtualization]     [Linux Security]     [Linux IDE]     [Linux RAID]     [Linux SCSI]     [Free Dating]

Add to Google Powered by Linux