commit:     89a7d0f0af6807ed9b4a7204cddc214722de1ee9
Author:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  7 20:02:33 2015 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sat Nov  7 20:02:33 2015 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=89a7d0f0

net: bridge: display a warning for brctl options depreciation

Signed-off-by: Alon Bar-Lev <alonbl <AT> gentoo.org>

 doc/net.example.Linux.in |  1 +
 net/bridge.sh            | 22 +++++++++++++---------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index ddfe5e0..b91bb50 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -910,6 +910,7 @@
 
 # Below is an example of configuring the bridge
 # Consult "man brctl" for more details
+# This method is deprecated in favour of the sysfs interface.
 #brctl_br0="setfd 15
 #sethello 2
 #stp on"

diff --git a/net/bridge.sh b/net/bridge.sh
index 60d3eeb..1d01be2 100644
--- a/net/bridge.sh
+++ b/net/bridge.sh
@@ -82,16 +82,20 @@ bridge_pre_start()
        # Old configuration set mechanism
        # Only a very limited subset of the options are available in the old
        # configuration method. The sysfs interface is in the next block 
instead.
-       local IFS="$__IFS"
-       for x in ${opts}; do
+       if [ -n "${opts}" ]; then
+               ewarn "brctl options are deprecated please migrate to sysfs 
options"
+               ewarn "map of important options is available at 
https://wiki.gentoo.org/wiki/Netifrc/Brctl_Migration";
+               local IFS="$__IFS"
+               for x in ${opts}; do
+                       unset IFS
+                       set -- ${x}
+                       x=$1
+                       shift
+                       set -- "${x}" "${IFACE}" "$@"
+                       brctl "$@"
+               done
                unset IFS
-               set -- ${x}
-               x=$1
-               shift
-               set -- "${x}" "${IFACE}" "$@"
-               brctl "$@"
-       done
-       unset IFS
+       fi
 
        # New configuration set mechanism, matches bonding
        for x in /sys/class/net/"${IFACE}"/bridge/*; do

Reply via email to