commit:     18bceba0c3cd4a40937d158f8b59461d0eebee7f
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  9 23:51:53 2017 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Jun  9 23:51:53 2017 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=18bceba0

bonding: make patching sysfs args easier in future.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 net/bonding.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/net/bonding.sh b/net/bonding.sh
index a25bf1f..6e5d810 100644
--- a/net/bonding.sh
+++ b/net/bonding.sh
@@ -78,6 +78,7 @@ bonding_pre_start()
                fi
        done
        # Configure arp ip targets, they need to be added one after another
+       # With a leading '+' as a prefix.
        n=arp_ip_target
        x=/sys/class/net/"${IFACE}"/bonding/$n
        [ -d /sys/class/net ] && if [ -f "$x" ]; then
@@ -94,9 +95,14 @@ bonding_pre_start()
        [ -d /sys/class/net ] && for x in /sys/class/net/"${IFACE}"/bonding/*; 
do
                [ -f "${x}" ] || continue
                n=${x##*/}
+               # These entries are already handled above.
+               case "$n" in
+                       mode) continue ;;
+                       miimon) continue ;;
+                       arp_ip_target) continue ;;
+               esac
+               # Check if anything to do.
                eval s=\$${n}_${IFVAR}
-               # skip mode and miimon
-               [ "${n}" = "mode" -o "${n}" = "miimon" -o "${n}" = 
"arp_ip_target" ] && continue
                if [ -n "${s}" ]; then
                        einfo "Setting ${n}: ${s}"
                        echo "${s}" >"${x}" || \
@@ -156,7 +162,7 @@ bonding_pre_start()
                fi
                # up the interface
                _up
-    fi
+       fi
 
        # finally add in slaves
        # things needed in the process, and if they are done by ifenslave, 
openrc, and/or the kernel.

Reply via email to