diff options
author | Jirka Klimes <jklimes@redhat.com> | 2014-06-05 16:06:49 +0200 |
---|---|---|
committer | Lukas Nykryn <lnykryn@redhat.com> | 2014-07-24 14:25:13 +0200 |
commit | 0a56b2cc22e7ee4e2e8ea926fc0ff81cbc299d34 (patch) | |
tree | 5359539641efa1092947864c1d0b3cbe9850d917 /sysconfig/network-scripts | |
parent | a788682bd31937468739a223c28e99cffc72e869 (diff) | |
download | initscripts-0a56b2cc22e7ee4e2e8ea926fc0ff81cbc299d34.tar initscripts-0a56b2cc22e7ee4e2e8ea926fc0ff81cbc299d34.tar.gz initscripts-0a56b2cc22e7ee4e2e8ea926fc0ff81cbc299d34.tar.bz2 initscripts-0a56b2cc22e7ee4e2e8ea926fc0ff81cbc299d34.tar.xz initscripts-0a56b2cc22e7ee4e2e8ea926fc0ff81cbc299d34.zip |
network-functions: handle BONDING_OPTS better
Diffstat (limited to 'sysconfig/network-scripts')
-rw-r--r-- | sysconfig/network-scripts/network-functions | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index a76d7432..8a9028fc 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -445,10 +445,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=','; |