netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lutomirski <amluto@gmail.com>
To: netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/1] Tell linkwatch about new interfaces
Date: Wed, 1 Apr 2009 11:40:06 -0400	[thread overview]
Message-ID: <cb0375e10904010840n1543a890w9039465d0f80ffcc@mail.gmail.com> (raw)

From: Andrew Lutomirski <amluto@gmail.com>

When a network driver registers a new interface, linkwatch will not notice,
and hence not set the rfc2863 operstate, until netif_carrier_on gets called.
If the new interface has no carrier when it is connected, then a status of
"unknown" is reported to userspace, which confuses various tools
(NetworkManager, for example).

This fires a linkwatch event for all new interfaces, so that operstate
gets set reasonably quickly.

Signed-off-by: Andrew Lutomirski <amluto@gmail.com>

---

This looks like the root cause of the bug I reported here:

http://lkml.org/lkml/2009/3/24/499

Without knowing all the locking and ordering constraints imposed on network
drivers, this seemed like the safest way to fix the bug.  Alternative
approaches would be to call rfc2863_policy directly or to initialize the
relevent fields to sane values (for the carrier off state) in alloc_netdev.

This applies to 2.6.29.  I can rediff it for any other tree, but I didn't see
any changes that would conflict.

diff --git a/net/core/dev.c b/net/core/dev.c
index e438f54..45911fd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4445,6 +4445,9 @@ int register_netdevice(struct net_device *dev)
 		dev->reg_state = NETREG_UNREGISTERED;
 	}

+	/* Update link state. */
+	linkwatch_fire_event(dev);
+
 out:
 	return ret;

             reply	other threads:[~2009-04-01 15:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-01 15:40 Andrew Lutomirski [this message]
2009-04-05  0:05 ` [PATCH 1/1] Tell linkwatch about new interfaces David Miller
2009-04-05  4:00   ` Andrew Lutomirski
2009-04-10  0:48     ` Brandeburg, Jesse
2009-04-11 15:46       ` Andrew Lutomirski
2009-04-13 23:22       ` David Miller
2009-04-14  7:43         ` Jeff Kirsher
2009-07-14 17:17   ` Sergio Luis
2009-07-14 18:33     ` David Miller
2009-07-14 18:37       ` Sergio Luis
2009-07-14 18:58       ` Andrew Lutomirski

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=cb0375e10904010840n1543a890w9039465d0f80ffcc@mail.gmail.com \
    --to=amluto@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).