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:56 +0200 |
commit | 696ef398d931e80ddea460018a37ed616887b575 (patch) | |
tree | 4cccd125c70721fd5ee71554f151c685ce8e025a /sysconfig/network-scripts | |
parent | bdfa5a5d4e959937fe9f525d8ce39cec410dbe08 (diff) | |
download | initscripts-696ef398d931e80ddea460018a37ed616887b575.tar initscripts-696ef398d931e80ddea460018a37ed616887b575.tar.gz initscripts-696ef398d931e80ddea460018a37ed616887b575.tar.bz2 initscripts-696ef398d931e80ddea460018a37ed616887b575.tar.xz initscripts-696ef398d931e80ddea460018a37ed616887b575.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 ff683b90..6e248b1c 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -462,10 +462,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=','; |