← Back to team overview

touch-packages team mailing list archive

[Bug 1424143] Re: lxc-net should attempt to use ip before ifconfig, not vice-versa

 

Thank you for the patch.  Would you mind posting it with a Signed-off-by
to lxc-devel@xxxxxxxxxxxxxxxxxxxxxxxxx?

(If you prefer I can post it)

** Changed in: lxc (Ubuntu)
   Importance: Undecided => Medium

** Changed in: lxc (Ubuntu)
       Status: New => Triaged

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to lxc in Ubuntu.
https://bugs.launchpad.net/bugs/1424143

Title:
  lxc-net should attempt to use ip before ifconfig, not vice-versa

Status in lxc package in Ubuntu:
  Triaged

Bug description:
  The lxc-net script in /usr/lib/$archtriplet/lxc/lxc-net attempts to
  use ifconfig first and then falls back to trying to use ip(8) in the
  ifup() and ifdown() shell functions. This behavior should be reversed,
  as ip has been preferred over ifconfig for several years now.

  As an example of why, lxc-net breaks the network setup within
  virtualbox guests. After starting lxc-net, the route table looks like:

    ubuntu@vivid-i386:~$ route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.0.2.2        0.0.0.0         UG    1024   0        0 eth0
    10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 lxcbr0
    10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
    169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0

  This is despite the following settings in /etc/default/lxc-net:

    LXC_BRIDGE="lxcbr0"
    LXC_ADDR="10.0.3.1"
    LXC_NETMASK="255.255.255.0"
    LXC_NETWORK="10.0.3.0/24"

  Switching the order in ifup and ifdown to try using ip first results
  in the correct netmask being applied:

    ubuntu@vivid-i386:~$ route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.0.2.2        0.0.0.0         UG    1024   0        0 eth0
    10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
    10.0.3.0        0.0.0.0         255.255.255.0   U     0      0        0 lxcbr0
    169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0

  Looking at sh -x output when running lxc-net manually, it *looks* like
  ifconfig is being invoked correctly, so I don't know why it's getting
  the netmask wrong:

  + use_iptables_lock=-w
  + iptables -w -L -n
  + [ -d /sys/class/net/lxcbr0 ]
  + brctl addbr lxcbr0
  + echo 1
  + [ ! -d /run/lxc ]
  + ifup lxcbr0 10.0.3.1 255.255.255.0
  + which ifconfig
  + [ 0 = 0 ]
  + ifconfig lxcbr0 10.0.3.1 netmask 255.255.255.0 up
  + return

  ProblemType: Bug
  DistroRelease: Ubuntu 15.04
  Package: lxc 1.1.0-0ubuntu1
  ProcVersionSignature: Ubuntu 3.18.0-13.14-generic 3.18.5
  Uname: Linux 3.18.0-13-generic i686
  ApportVersion: 2.16.1-0ubuntu2
  Architecture: i386
  Date: Sat Feb 21 00:13:27 2015
  InstallationDate: Installed on 2014-12-12 (70 days ago)
  InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Alpha i386 (20141212)
  ProcEnviron:
   TERM=screen
   SHELL=/bin/bash
   PATH=(custom, no user)
   LANG=en_US.UTF-8
   XDG_RUNTIME_DIR=<set>
  SourcePackage: lxc
  UpgradeStatus: No upgrade log present (probably fresh install)
  defaults.conf:
   lxc.network.type = veth
   lxc.network.link = lxcbr0
   lxc.network.flags = up
   lxc.network.hwaddr = 00:16:3e:xx:xx:xx
  modified.conffile..etc.default.lxc: [modified]
  mtime.conffile..etc.default.lxc: 2015-02-20T18:15:56.552501

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1424143/+subscriptions


References