aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sysconfig/network-scripts/network-functions16
1 files changed, 14 insertions, 2 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 0e86efd0..e6273bb6 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -458,10 +458,22 @@ phy_wireless_device ()
cat /sys/class/net/$1/phy80211/name
}
+bond_master_exists ()
+{
+ local bond_name
+ [ -z "${1}" ] && return 1
+ [ ! -f /sys/class/net/bonding_masters ] && return 1
+
+ for bond_name in $(< /sys/class/net/bonding_masters); do
+ [ "${bond_name}" == "${1}" ] && return 0
+ done
+ return 1
+}
+
install_bonding_driver ()
{
- [ ! -f /sys/class/net/bonding_masters ] && ( modprobe bonding || return 1 )
- if ! fgrep -sqx "$1" /sys/class/net/bonding_masters; then
+ if ! bond_master_exists ${1}; then
+ modprobe bonding || return 1
echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null
fi
(