All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Kristian Evensen <kristian.evensen@gmail.com>
Cc: Ben Greear <greearb@candelatech.com>, netdev@vger.kernel.org
Subject: Re: RTM_NEWLINK not received by application when connecting multiple devices simultaneously
Date: Thu, 19 Apr 2012 13:36:35 -0700	[thread overview]
Message-ID: <20120419133635.7d816d67@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <CAKfDRXhAqFzPWAJkzhPdZGsUrtjex8uVwHBynCdvA+Zo6sjMig@mail.gmail.com>

On Thu, 19 Apr 2012 21:54:24 +0200
Kristian Evensen <kristian.evensen@gmail.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

  reply	other threads:[~2012-04-19 20:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-19 11:44 RTM_NEWLINK not received by application when connecting multiple devices simultaneously Kristian Evensen
2012-04-19 14:26 ` Ben Greear
2012-04-19 14:54   ` Stephen Hemminger
2012-04-19 15:07     ` Kristian Evensen
2012-04-19 19:54       ` Kristian Evensen
2012-04-19 20:36         ` Stephen Hemminger [this message]
2012-04-20 14:07           ` Kristian Evensen
2012-04-20 15:14             ` Stephen Hemminger
2012-04-20 15:54               ` Kristian Evensen
2012-04-20 16:04                 ` Kristian Evensen
2012-04-20 16:15                   ` Stephen Hemminger

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=20120419133635.7d816d67@nehalam.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=greearb@candelatech.com \
    --cc=kristian.evensen@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.