Do not add slaves to bond interface if they are already added

X-Gentoo-Bug: 366653
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=366653
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
Kfir Lavi 2011-05-16 09:21:18 -04:00 committed by Anthony G. Basile
parent 2493a1f32e
commit db1daa5857

View File

@ -97,13 +97,15 @@ bonding_pre_start()
# finally add in slaves
eoutdent
if [ -d /sys/class/net ]; then
sys_bonding_path=/sys/class/net/"${IFACE}"/bonding
if [ -n "${primary}" ]; then
echo "+${primary}" >/sys/class/net/"${IFACE}"/bonding/slaves
echo "${primary}" >/sys/class/net/"${IFACE}"/bonding/primary
echo "+${primary}" >$sys_bonding_path/slaves
echo "${primary}" >$sys_bonding_path/primary
fi
for s in ${slaves}; do
[ "${s}" = "${primary}" ] && continue
echo "+${s}" >/sys/class/net/"${IFACE}"/bonding/slaves
grep -q ${s} $sys_bonding_path/slaves \
|| echo "+${s}" >$sys_bonding_path/slaves
done
else
/sbin/ifenslave "${IFACE}" ${slaves} >/dev/null