[lxc-devel] [lxc/lxc] b466dc: setup_netdev: re-read ifindex in LXC_NET_PHYS case

GitHub noreply at github.com
Thu Nov 14 15:25:24 UTC 2013


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: b466dc337caba11688820e9ef79c5dc20de904cc
      https://github.com/lxc/lxc/commit/b466dc337caba11688820e9ef79c5dc20de904cc
  Author: Bogdan Purcareata <bogdan.purcareata at freescale.com>
  Date:   2013-11-14 (Thu, 14 Nov 2013)

  Changed paths:
    M src/lxc/conf.c

  Log Message:
  -----------
  setup_netdev: re-read ifindex in LXC_NET_PHYS case

When moving an interface from the host netns to a container's,
the ifindex might not remain the same. This happens when the
index of the host interface is already assigned to another interface
in the new netns.

For veth/vlan/macvlan, virtual interfaces are first created on the host,
and then moved in the container. Since they are created after all other
interfaces are discovered, there is no chance for its assigned ifindex
to be already present in a freshly created netns, because it's a greater
number.

However, when moving a physical interface, there is a chance that its
ifindex in the host netns is not free in the new netns. The patch
forces ifindex re-read for the LXC_NET_PHYS case to update the
lxc_netdev structure.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata at freescale.com>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>





More information about the lxc-devel mailing list