Skip to content

Commit e1622ba

Browse files
NicolasDichteldavem330
authored andcommitted
dev: set iflink to 0 for virtual interfaces
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]>
1 parent 7a66bbc commit e1622ba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/core/dev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,10 @@ int dev_get_iflink(const struct net_device *dev)
672672
if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink)
673673
return dev->netdev_ops->ndo_get_iflink(dev);
674674

675+
/* If dev->rtnl_link_ops is set, it's a virtual interface. */
676+
if (dev->rtnl_link_ops)
677+
return 0;
678+
675679
return dev->ifindex;
676680
}
677681
EXPORT_SYMBOL(dev_get_iflink);

0 commit comments

Comments
 (0)