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

Hi,

Thanks for writing and maintaining the separate ifenslave tool!

What do you think about the attached patch that makes ifenslave actually
work when detaching a "real" interface from a bonding one?  The problem
is that the commit that introduced the handling of lower_ as well as
slave_ had a logic bug in inverting the check: it is correct when adding
an interface to a bonding one, but the reversal needs && instead of ||.

This is trivially reproducible by adding an interface to a bond and
then immediately invoking ifenslave -d with the same interface names.
It was also noted in a Ubuntu bug against ifenslave:

  https://bugs.launchpad.net/ubuntu/+source/ifenslave/+bug/1298325

Thanks again for your work on ifenslave and Debian in general!

G'luck,
Peter

-- System Information:
Debian Release: stretch/sid
  APT prefers oldoldstable
  APT policy: (500, 'oldoldstable'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.7.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.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.8.13
ii  iproute2  4.6.0-4

Versions of packages ifenslave recommends:
ii  net-tools  1.60+git20150829.73cef8a-2

ifenslave suggests no packages.

-- no debconf information
From c91cccc1065da92547642676ac02ab0623b16270 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <r...@ringlet.net>
Date: Mon, 26 Sep 2016 15:41:24 +0300
Subject: [PATCH 01/17] Fix the slave_*/lower_* logic when detaching.

LP:             #1298325
Obtained from:  
https://bugs.launchpad.net/ubuntu/+source/ifenslave/+bug/1298325/comments/4
---
 ifenslave | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ifenslave b/ifenslave
index 21097aa..2c4428c 100755
--- a/ifenslave
+++ b/ifenslave
@@ -93,7 +93,7 @@ for slave in "$@"; do
        [ -d "/sys/class/net/$slave" ] || error "$slave: no such interface"
 
        if [ -z "$DETACH" ]; then
-               if [ -h "/sys/class/net/$master/slave_$slave" ] ||
+               if [ -h "/sys/class/net/$master/slave_$slave" ] &&
                   [ -h "/sys/class/net/$master/lower_$slave" ]; then
                        echo "$slave: already enslaved to $master" >&2
                        continue
-- 
2.9.3

Attachment: signature.asc
Description: PGP signature

Reply via email to