X-Git-Url: https://git.tld-linux.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fifdown-bond;h=f490bbe69fb645591faa0d18eaa8fc7d3cd3cf69;hb=HEAD;hp=1d81ecb548e88f0432e0c6b29a619df6810211ef;hpb=7469b84d1e7ffde6f48bf19b999c005249df5dae;p=rc-scripts.git diff --git a/lib/ifdown-bond b/lib/ifdown-bond index 1d81ecb..f490bbe 100755 --- a/lib/ifdown-bond +++ b/lib/ifdown-bond @@ -35,19 +35,19 @@ fi setup_ip_param # forget all addresses -LC_ALL=C ip addr flush dev ${DEVICE} 2>&1 | grep -v "Nothing to flush" +LC_ALL=C ip addr flush dev "${DEVICE}" 2>&1 | grep -v "Nothing to flush" # release slave devices -for SLAVE_DEV in $(cat /sys/class/net/${DEVICE}/bonding/slaves); do - echo "-${SLAVE_DEV}" > /sys/class/net/${DEVICE}/bonding/slaves +for SLAVE_DEV in $(cat /sys/class/net/${DEVICE}/bonding/slaves 2>/dev/null); do + ip link set "${SLAVE_DEV}" nomaster done # bring bonding master down -ip link set ${DEVICE} down +ip link set "${DEVICE}" down # remove bonding master -if grep -wq "${DEVICE}" /sys/class/net/bonding_masters; then - echo "-${DEVICE}" > /sys/class/net/bonding_masters +if [ -d "/sys/class/net/${DEVICE}" ]; then + ip link del "${DEVICE}" type bond if [ $? -ne 0 ]; then exit 1 fi