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 2>/dev/null); do
- echo "-${SLAVE_DEV}" > /sys/class/net/${DEVICE}/bonding/slaves
+ 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