This is an automated email from the ASF dual-hosted git repository. gilbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push: new d8de112 Bring up the loopback interface using `iproute2`. d8de112 is described below commit d8de1127bb4aa5cb36d2942cdea39e8ec620babe Author: Sergey Urbanovich <sergey.urbanov...@gmail.com> AuthorDate: Mon Oct 8 16:42:41 2018 -0700 Bring up the loopback interface using `iproute2`. The last release of `net-tools` was released in 2001. The tools were deprecated years ago (see [1], [2], and [3]) and no longer installed by default in many linux-based operating systems. Bring up the loopback interface using `ip` from `iproute2` and if it fails to start fall back on `ifconfig` from `net-tools`. [1] https://lists.debian.org/debian-devel/2009/03/msg00780.html [2] https://bugzilla.redhat.com/show_bug.cgi?id=687920 [3] https://lwn.net/Articles/710533/ Review: https://reviews.apache.org/r/68921/ --- .../containerizer/mesos/isolators/network/cni/cni.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp index ba46552..64271df 100644 --- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp +++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp @@ -2252,21 +2252,31 @@ int NetworkCniIsolatorSetup::execute() return EXIT_FAILURE; } - const Option<int> status = os::spawn("ifconfig", {"ifconfig", "lo", "up"}); + // TODO(urbanserj): To get rid of all external dependencies such as + // `iproute2` and `net-tools`, use Netlink Protocol Library (libnl). + Option<int> status = os::spawn( + "ip", {"ip", "link", "set", "dev", "lo", "up"}); const string message = "Failed to bring up the loopback interface in the new " "network namespace of pid " + stringify(flags.pid.get()); if (status.isNone()) { - cerr << message << ": " << "os::spawn failed: " + cerr << message << ": os::spawn 'ip link set dev lo up' failed: " + << os::strerror(errno) << endl; + + // Fall back on `ifconfig` if `ip` command fails to start. + status = os::spawn("ifconfig", {"ifconfig", "lo", "up"}); + } + + if (status.isNone()) { + cerr << message << ": os::spawn 'ifconfig lo up' failed: " << os::strerror(errno) << endl; return EXIT_FAILURE; } if (!WSUCCEEDED(status.get())) { - cerr << message << ": 'ifconfig lo up' " - << WSTRINGIFY(status.get()) << endl; + cerr << message << ": " << WSTRINGIFY(status.get()) << endl; return EXIT_FAILURE; } }