aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorJirka Klimes <jklimes@redhat.com>2014-06-05 16:06:49 +0200
committerLukas Nykryn <lnykryn@redhat.com>2014-06-05 16:06:49 +0200
commit74c339e602ea613bf084fcbd38b3e02937d5da8a (patch)
tree85a2fd53c1f13872d9027b1cbfa3a63c6c3885d3 /sysconfig
parent7cb06713039dcb4e581a070ce102ad408fdff2e4 (diff)
downloadinitscripts-74c339e602ea613bf084fcbd38b3e02937d5da8a.tar
initscripts-74c339e602ea613bf084fcbd38b3e02937d5da8a.tar.gz
initscripts-74c339e602ea613bf084fcbd38b3e02937d5da8a.tar.bz2
initscripts-74c339e602ea613bf084fcbd38b3e02937d5da8a.tar.xz
initscripts-74c339e602ea613bf084fcbd38b3e02937d5da8a.zip
network-functions: handle BONDING_OPTS better
Diffstat (limited to 'sysconfig')
-rw-r--r--sysconfig/network-scripts/network-functions32
1 files changed, 29 insertions, 3 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index eb55c57b..68c042ee 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -437,10 +437,36 @@ install_bonding_driver ()
if [ -f /sys/class/net/${DEVICE}/bonding/slaves -a $(wc -l < /sys/class/net/${DEVICE}/bonding/slaves) -eq 0 ]; then
/sbin/ip link set dev ${DEVICE} down
- # add the bits to setup driver parameters here
+ # parse options and put them to arrays
for arg in $BONDING_OPTS ; do
- key=${arg%%=*};
- value=${arg##*=};
+ bopts_keys[${#bopts_keys[*]}]=${arg%%=*}
+ bopts_vals[${#bopts_vals[*]}]=${arg##*=}
+ done
+
+ # add the bits to setup driver parameters here
+ # first set mode, miimon
+ for (( idx=0; idx < ${#bopts_keys[*]}; idx++ )) ; do
+ key=${bopts_keys[$idx]}
+ value=${bopts_vals[$idx]}
+
+ if [ "${key}" = "mode" ] ; then
+ echo "${value}" > /sys/class/net/${DEVICE}/bonding/$key
+ bopts_keys[$idx]=""
+ fi
+ if [ "${key}" = "miimon" ] ; then
+ echo "${value}" > /sys/class/net/${DEVICE}/bonding/$key
+ bopts_keys[$idx]=""
+ fi
+ done
+
+ # set all other remaining options
+ for (( idx=0; idx < ${#bopts_keys[*]}; idx++ )) ; do
+ key=${bopts_keys[$idx]}
+ value=${bopts_vals[$idx]}
+
+ # option already set; take next
+ [[ -z "$key" ]] && continue
+
if [ "${key}" = "arp_ip_target" -a "${value:0:1}" != "+" ]; then
OLDIFS=$IFS;
IFS=',';