net/bonding: ensure slave interfaces are down before adding.

The old ifenslave binary forcibly set new slave interface to down before
adding into the kernel, as a way of show it's version to the kernel. We
need to duplicate this so that the kernel doesn't think it's an old
ifenslave version using the bonding setup interface.

X-Gentoo-Bug: 391881
X-Gentoo-Bug-URL: https://bugs.gentoo.org/391881
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Thanks-to: Yun Zheng Hu <hu@fox-it.com>
This commit is contained in:
Robin H. Johnson 2011-12-12 18:12:35 -08:00
parent 46b96eb80d
commit dd45506a40

View File

@ -95,16 +95,22 @@ bonding_pre_start()
_up
# finally add in slaves
# things needed in the process, and if they are done by ifenslave, openrc, and/or the kernel.
# down new slave interface: ifenslave, openrc
# set mtu: ifenslave, kernel
# set slave MAC: ifenslave, kernel
eoutdent
if [ -d /sys/class/net ]; then
sys_bonding_path=/sys/class/net/"${IFACE}"/bonding
if [ -n "${primary}" ]; then
IFACE=$primary _down
echo "+${primary}" >$sys_bonding_path/slaves
echo "${primary}" >$sys_bonding_path/primary
fi
for s in ${slaves}; do
[ "${s}" = "${primary}" ] && continue
if ! grep -q ${s} $sys_bonding_path/slaves; then
IFACE=$s _down
echo "+${s}" >$sys_bonding_path/slaves
fi
done