public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta•com>
To: Ben Greear <greearb@candelatech•com>
Cc: Kristian Evensen <kristian.evensen@gmail•com>, netdev@vger•kernel.org
Subject: Re: RTM_NEWLINK not received by application when connecting multiple devices simultaneously
Date: Thu, 19 Apr 2012 07:54:52 -0700	[thread overview]
Message-ID: <20120419075452.379f711b@s6510.linuxnetplumber.net> (raw)
In-Reply-To: <4F90208E.6070201@candelatech.com>

On Thu, 19 Apr 2012 07:26:22 -0700
Ben Greear <greearb@candelatech•com> wrote:

> On 04/19/2012 04:44 AM, Kristian Evensen wrote:
> > Hello,
> 
> > The application works as intended when I connect interfaces one by
> > one. However, if I connect two interfaces "simultaneously", the
> > RTM_NEWLINK message for one of the interfaces is sometimes not
> > received. Nothing arrives at the handle. It seems to be random which
> > RTM_NEWLINK actually arrives. I have only been able to recreate this
> > problem when connecting two USB 3G modems and automatically dialing
> > the ISP, but I assume it would happen with other technologies as well.
> > What puzzles me, is that both RTM_NEWLINK messages are seen by for
> > example ip monitor. This has led me to conclusion that there is a bug
> > in my application, and my question is therefore, are there any common
> > mistakes one can make or things to forget that would cause a message
> > to get lost or not be received, or does anyone have any tips on where
> > I can start looking?
> 
> Multiple netlink msgs can be received in each read of a netlink
> socket.  Maybe you are only processing the first one?

I recommend using the libmnl library instead of the older
libnetlink. The code is cleaner and it handles error cases better.
In libmnl there is a callback interface for parsing
netlink messages.

  reply	other threads:[~2012-04-19 14:55 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 [this message]
2012-04-19 15:07     ` Kristian Evensen
2012-04-19 19:54       ` Kristian Evensen
2012-04-19 20:36         ` Stephen Hemminger
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=20120419075452.379f711b@s6510.linuxnetplumber.net \
    --to=shemminger@vyatta$(echo .)com \
    --cc=greearb@candelatech$(echo .)com \
    --cc=kristian.evensen@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox