ifenslave fails to detach slave from bonded interface
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/
| lrwxrwxrwx 1 root root 0 Jan 12 02:36 lower_ens2f0 -> ../../.
| lrwxrwxrwx 1 root root 0 Jan 12 02:36 lower_ens2f1 -> ../../.
Running ifenslave with `sh -x` shows this:
| ...
| + [ -z ens2f1 ]
| + master=bond0
| + shift
| + [ -d /sys/class/
| + [ -d /sys/class/
| + [ = 1 ]
| + [ -d /sys/class/
| + [ -z 1 ]
| + [ ! -h /sys/class/
| + 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/
| [ -h "/sys/class/
| echo "$slave: already enslaved to $master" >&2
| continue
| fi
| ...
| else
| if [ ! -h "/sys/class/
| [ ! -h "/sys/class/
| echo "$slave: is not enslaved to $master" >&2
| continue
| fi
Where rather than ||, it should be && in the else block (for detaching).
Looks fixed in more recent versions.