ifenslave fails to detach slave from bonded interface

Bug #1957128 reported by Haw Loeung
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ifenslave (Ubuntu)
Invalid
Undecided
Unassigned
Xenial
Invalid
Undecided
Unassigned

Bug Description

Hi,

When I try to detach a slave from a bonded interface, it fails as follows:

| [hloeung@myhost etc]$ sudo ifenslave -v -d bond0 ens2f1
| ens2f1: is not enslaved to bond0

It's definitely part of the bond:

| [hloeung@myhost etc]$ ls /sys/class/net/bond0/ -la | grep ens
| lrwxrwxrwx 1 root root 0 Jan 12 02:36 lower_ens2f0 -> ../../../pci0000:00/0000:00:02.0/0000:05:00.0/net/ens2f0
| lrwxrwxrwx 1 root root 0 Jan 12 02:36 lower_ens2f1 -> ../../../pci0000:00/0000:00:02.0/0000:05:00.1/net/ens2f1

Running ifenslave with `sh -x` shows this:

| ...
| + [ -z ens2f1 ]
| + master=bond0
| + shift
| + [ -d /sys/class/net/bond0 ]
| + [ -d /sys/class/net/bond0/bonding ]
| + [ = 1 ]
| + [ -d /sys/class/net/ens2f1 ]
| + [ -z 1 ]
| + [ ! -h /sys/class/net/bond0/slave_ens2f1 ]
| + echo ens2f1: is not enslaved to bond0
| ens2f1: is not enslaved to bond0
| + continue
| + exit 0

I think the bug is in this code:

| if [ -z "$DETACH" ]; 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
| ...
| else
| 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

Where rather than ||, it should be && in the else block (for detaching).

Revision history for this message
Haw Loeung (hloeung) wrote :

Looks fixed in more recent versions.

Changed in ifenslave (Ubuntu):
status: New → Invalid
Changed in ifenslave (Ubuntu Xenial):
status: New → Invalid
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.