Skip to content

Commit

Permalink
dev: set iflink to 0 for virtual interfaces
Browse files Browse the repository at this point in the history
Virtual interfaces are supposed to set an iflink value != of their ifindex.
It was not the case for some of them, like vxlan, bond or bridge.
Let's set iflink to 0 when dev->rtnl_link_ops is set.

Signed-off-by: Nicolas Dichtel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
NicolasDichtel authored and davem330 committed Apr 2, 2015
1 parent 7a66bbc commit e1622ba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ int dev_get_iflink(const struct net_device *dev)
if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink)
return dev->netdev_ops->ndo_get_iflink(dev);

/* If dev->rtnl_link_ops is set, it's a virtual interface. */
if (dev->rtnl_link_ops)
return 0;

return dev->ifindex;
}
EXPORT_SYMBOL(dev_get_iflink);
Expand Down

0 comments on commit e1622ba

Please sign in to comment.