2019-05-14, 12:05:16 +0200, Nicolas Dichtel wrote: > Le 14/05/2019 à 10:01, Sabrina Dubroca a écrit : > > 2019-05-14, 09:32:32 +0200, Nicolas Dichtel wrote: > [snip] > >> What about this one? > >> Fixes: d8a5ec672768 ("[NET]: netlink support for moving devices between > >> network > >> namespaces.") > > > > Nice. Now I think the bug can't really trigger unless one of these > > commits are present: > > > > aa79e66eee5d ("net: Make ifindex generation per-net namespace") > > 9c7dafbfab15 ("net: Allow to create links with given ifindex") > > > I don't think so. > > Please have a look to commit ce286d327341 ("[NET]: Implement network device > movement between namespaces"). > In dev_change_net_namespace(), there is the following code: > > /* If there is an ifindex conflict assign a new one */ > if (__dev_get_by_index(net, dev->ifindex)) { > int iflink = (dev->iflink == dev->ifindex); > dev->ifindex = dev_new_index(net); > if (iflink) > dev->iflink = dev->ifindex; > } > > This code may change the ifindex of an interface when this interface moves to > another netns. This may happen even before the commits you propose, because > the > global ifindex counter can wrap around.
Yes, that's possible although quite unlikely. I'll go with d8a5ec672768. -- Sabrina