Package: ifenslave
Version: 2.6
Severity: important
Tags: patch

Dear Maintainer,

Starting with kernel 3.13
(commit 
http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=5831d66e8097aedfa3bc35941cf265ada2352317),
 /sys/class/net/{bond}/slave_{ifname} (notice the slave_) no longer exist.

It has been replaced by /sys/class/net/{bond}/lower_{ifname}. The proposed 
patch adds
support for the new naming while remaining backward compatible.

Without this patch, trying to add a bond when this one is already defined
leads to the following obscure error :

root@sid-ifenslave:/sbin# ifenslave bond0 eth1 eth2
sh: echo: I/O error
eth1: could not add interface


-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ifenslave depends on:
ii  ifupdown  0.7.50
ii  iproute2  3.16.0-2

Versions of packages ifenslave recommends:
ii  net-tools  1.60-26+b1

ifenslave suggests no packages.

-- no debconf information
From: Louis Bouchard <louis.bouch...@ubuntu.com>
Date: Thu Jul  9 13:57:54 CEST 2015
Subject: Fix change in /sys/class/net/{bond}/slave_ naming after k3.13

Starting in kernel 3.13, slave_{ifname} is no longer present and
has been replaced by lower_{ifname}. Take this change into account
to avoid ambiguous error when ifenslave is run with existing bond
defined.
Ubuntu-Bug: http://bugs.launchpad.net/bugs/1326854

--- a/ifenslave.orig	2015-07-09 10:04:42.188000000 +0200
+++ b/ifenslave	2014-07-09 13:38:57.068000000 +0200
@@ -93,7 +93,8 @@
 	[ -d "/sys/class/net/$slave" ] || error "$slave: no such interface"
 
 	if [ -z "$DETACH" ]; then
-		if [ -h "/sys/class/net/$master/slave_$slave" ]; then
+		if [ -h "/sys/class/net/$master/slave_$slave" ] ||
+		   [ -h "/sys/class/net/$master/lower_$slave" ]; then
 			echo "$slave: already enslaved to $master" >&2
 			continue
 		fi
@@ -107,7 +108,8 @@
 		ip link set "$slave" down
 		echo "+$slave" >"/sys/class/net/$master/bonding/slaves" || error "$slave: could not add interface"
 	else
-		if [ ! -h "/sys/class/net/$master/slave_$slave" ]; then
+		if [ ! -h "/sys/class/net/$master/slave_$slave" ] ||
+		   [ ! -h "/sys/class/net/$master/lower_$slave" ]; then
 			echo "$slave: is not enslaved to $master" >&2
 			continue
 		fi

Reply via email to