Public bug reported: 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). ** Affects: ifenslave (Ubuntu) Importance: Undecided Status: Invalid ** Affects: ifenslave (Ubuntu Xenial) Importance: Undecided Status: Invalid ** Changed in: ifenslave (Ubuntu) Status: New => Invalid ** Also affects: ifenslave (Ubuntu Xenial) Importance: Undecided Status: New ** Changed in: ifenslave (Ubuntu Xenial) Status: New => Invalid ** Description changed: 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" ] && + | 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). + Where rather than ||, it should be && in the else block (for detaching). -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1957128 Title: ifenslave fails to detach slave from bonded interface To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ifenslave/+bug/1957128/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs