net: Fix for initial link state in 2.6.28
Michael Marineau authored
From: Michael Marineau <mike@marineau.org>

Commit b4730016

 "Do not fire linkwatch
events until the device is registered." was made as a workaround for
drivers that call netif_carrier_off before registering the device.
Unfortunately this causes these drivers to incorrectly report their
link status as IF_OPER_UNKNOWN which can falsely set the IFF_RUNNING
flag when the interface is first brought up. This issues was
previously pointed out[1] but was dismissed saying that IFF_RUNNING is
not related to the link status. From my digging IFF_RUNNING, as
reported to userspace, is based on the link state. It is set based on
__LINK_STATE_START and IF_OPER_UP or IF_OPER_UNKNOWN. See [2], [3],
and [4]. (Whether or not the kernel has IFF_RUNNING set in flags is
not reported to user space so it may well be independent of the link,
I don't know if and when it may get set.)

The end result depends slightly depending on the driver. The the two I
tested were e1000e and b44. With e1000e if the system is booted
without a network cable attached the interface will falsely report
RUNNING when it is brought up causing NetworkManager to attempt to
start it and eventually time out. With b44 when the system is booted
with a network cable attached and brought up with dhcpcd it will time
out the first time.

The attached patch that will still set the operstate variable
correctly to IF_OPER_UP/DOWN/etc when linkwatch_fire_event is called
but then return rather than skipping the linkwatch_fire_event call
entirely as the previous fix did. (sorry it isn't inline, I don't have
a patch friendly email client at the moment)
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
22604c86
Name Last commit Last update
..
802 hippi: convert driver to net_device_ops
8021q vlan: fix convertion to net_device_ops
9p Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
appletalk net/appletalk: Remove redundant test
atm netdevice: Kill netdev->priv
ax25 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
bluetooth Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
bridge Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
can can: merge error paths
core net: Fix for initial link state in 2.6.28
dcb net: add DCNA attribute to the BCN interface for DCB
dccp net: Fix percpu counters deadlock
decnet net: Make static
dsa net: Make static
econet netns: Use net_eq() to compare net-namespaces for optimization.
ethernet eth: Declare an optimized compare_ether_addr_64bits() function
ipv4 gro: Use gso_size to store MSS
ipv6 ipv6: Fix sporadic sendmsg -EINVAL when sending to multicast groups.
ipx net: '&' redux
irda irda: merge exit paths
iucv [S390] convert iucv printks to dev_xxx and pr_xxx macros.
key netns PF_KEY: per-netns /proc/pfkey
lapb [LAPB] net/lapb/lapb_iface.c: use LIST_HEAD instead of LIST_HEAD_INIT
llc net: remove redundant argument comments
mac80211 mac80211: implement dynamic power save
netfilter
netlabel
netlink
netrom
packet
phonet
rfkill
rose
rxrpc
sched
sctp
sunrpc
tipc
unix
wanrouter
wireless
x25
xfrm
Kconfig
Makefile
TUNABLE
compat.c
nonet.c
socket.c
sysctl_net.c