aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions20
1 files changed, 17 insertions, 3 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index ffc23238..9e269fda 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -466,7 +466,9 @@ add_default_route ()
is_wireless_device ()
{
- [ -d "/sys/class/net/$1/wireless" -o -d "/sys/class/net/$1/phy80211" ]
+ [ -x /usr/sbin/iw ] || return 1
+ LC_ALL=C /usr/sbin/iw dev $1 info > /dev/null 2>&1 || return 0
+ return 1
}
phy_wireless_device ()
@@ -474,10 +476,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
(