netdev: don't always reset iflink when registering
Subsystems (2)
PATCH 1/1 netdev: don't always reset iflink when registering
Bound tunnel devices set their iflink to the ifindex of the underlying network interface when created. It shouldn't be reset by the registration process.
--- net/core/dev.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/core/dev.c +2 -1
@@ -5067,7 +5067,8 @@ int register_netdevice(struct net_device *dev)netdev_set_addr_lockdep_class (dev);netdev_init_queue_locks (dev); - dev->iflink =-1 ; +if (dev->iflink <=0 ) + dev->iflink =-1 ;/* Init, if this function is available */ if (dev->netdev_ops->ndo_init) {
Signature · 1 line
1.6.3.3
Quoted 4 lines · Tom Goff
Bound tunnel devices set their iflink to the ifindex of the underlying network interface when created. It shouldn't be reset by the registration process.
Which ones exactly? Usually they do this in ->setup() or later on.
From: Patrick McHardy <mailto:[email protected]>
Sent: Monday, March 22, 2010 10:43 AM
Quoted 9 lines
Quoted 1 line · Tom Goff
Bound tunnel devices set their iflink to the ifindex of the
underlying
Quoted 3 lines
network interface when created. It shouldn't be reset by the registration process.
Which ones exactly? Usually they do this in ->setup() or later on.
I observed the issue with a bound gre tunnel where:
ipgre_newlink() ... ipgre_tunnel_bind_dev() /* set dev->iflink */ ... register_netdevice() /* reset dev->iflink */
There's a similar pattern in ipv6/sit.c:
ipip6_tunnel_locate() ... ipip6_tunnel_init() ... ipip6_tunnel_bind_dev() /* set dev->iflink */ ... register_netdevice() /* reset dev->iflink */
So maybe it makes more sense to change these if that's more consistent with other cases.
Thanks for looking at this and the tc stuff.
Tom
David Miller
maintainerFrom: "Goff, Thomas" <[email protected]>
Date: Mon, 22 Mar 2010 12:06:46 -0700
Quoted 2 lines
So maybe it makes more sense to change these if that's more consistent with other cases.
Yes, it does. The canonical place to set ->iflink by hand is the ->ndo_init() method of the device.