commit:     85f486367ab158b605d8817571028c90bccdc130
Author:     Marc Schiffbauer <mschiff <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  6 18:23:41 2017 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Jun  9 23:48:18 2017 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=85f48636

bonding: add arp_ip_targets properly

netifrc handles bonding interfaces in /lib/netifrc/net/bonding.sh which
will apply all settings (*_bondX) like 'echo "${s}" >"${x}"' which will
not work for bonding arip ip targets: these have to be added by using
"echo +<ip> > arp_ip_target"

Please consider merging the attached patch which will fix that feature
and make netifrc work correctly with bonding interfaces when using
arp_ip_target instead of miimon.

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

 net/bonding.sh | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/net/bonding.sh b/net/bonding.sh
index d0ed319..a25bf1f 100644
--- a/net/bonding.sh
+++ b/net/bonding.sh
@@ -1,4 +1,5 @@
 # Copyright (c) 2007-2008 Roy Marples <[email protected]>
+#               2017      Marc Schiffbauer <[email protected]>
 # Released under the 2-clause BSD license.
 
 bonding_depend()
@@ -21,7 +22,7 @@ _is_bond()
 
 bonding_pre_start()
 {
-       local x= s= n= slaves= primary=
+       local x= s= n= i= slaves= primary=
 
        slaves="$(_get_array "slaves_${IFVAR}")"
        unset slaves_${IFVAR}
@@ -76,13 +77,26 @@ bonding_pre_start()
                        eerror "Failed to configure $n (${n}_${IFVAR})"
                fi
        done
+       # Configure arp ip targets, they need to be added one after another
+       n=arp_ip_target
+       x=/sys/class/net/"${IFACE}"/bonding/$n
+       [ -d /sys/class/net ] && if [ -f "$x" ]; then
+               eval s=\$${n}_${IFVAR}
+               if [ -n "${s}" ]; then
+                       for i in $s; do
+                               einfo "Adding ${n}: ${i}"
+                               echo "+${i/+/}" >"${x}" || \
+                               eerror "Failed to add $i (${n}_${IFVAR})"
+                       done
+               fi
+       fi
        # Nice and dynamic for remaining options:)
        [ -d /sys/class/net ] && for x in /sys/class/net/"${IFACE}"/bonding/*; 
do
                [ -f "${x}" ] || continue
                n=${x##*/}
                eval s=\$${n}_${IFVAR}
                # skip mode and miimon
-               [ "${n}" = "mode" -o "${n}" = "miimon" ] && continue
+               [ "${n}" = "mode" -o "${n}" = "miimon" -o "${n}" = 
"arp_ip_target" ] && continue
                if [ -n "${s}" ]; then
                        einfo "Setting ${n}: ${s}"
                        echo "${s}" >"${x}" || \

Reply via email to