From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C57A61384B4 for ; Sun, 8 Nov 2015 14:30:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 55CF021C00B; Sun, 8 Nov 2015 14:30:06 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CAED221C005 for ; Sun, 8 Nov 2015 14:30:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6D78433FAAE for ; Sun, 8 Nov 2015 14:30:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4D501228A for ; Sun, 8 Nov 2015 14:30:01 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1446926542.8b98728ce0b3249da5cc2e6571bf19d57fe75a14.robbat2@OpenRC> Subject: [gentoo-commits] proj/netifrc:master commit in: net/ X-VCS-Repository: proj/netifrc X-VCS-Files: net/bridge.sh X-VCS-Directories: net/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 8b98728ce0b3249da5cc2e6571bf19d57fe75a14 X-VCS-Branch: master Date: Sun, 8 Nov 2015 14:30:01 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: fd66bb59-8033-4e7e-94bb-bb221d33a729 X-Archives-Hash: c20307b637c59040e7a5ceefd14de3eb commit: 8b98728ce0b3249da5cc2e6571bf19d57fe75a14 Author: Alon Bar-Lev gentoo org> AuthorDate: Sat Nov 7 20:02:22 2015 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Sat Nov 7 20:02:22 2015 +0000 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=8b98728c Revert "bridge: use/prefer iproute2/sysfs where possible" This reverts commit 6befe06a7e72b5b7f17c7f1118fc16000a0cce13. net/bridge.sh | 89 ++++------------------------------------------------------- 1 file changed, 6 insertions(+), 83 deletions(-) diff --git a/net/bridge.sh b/net/bridge.sh index 87e4055..60d3eeb 100644 --- a/net/bridge.sh +++ b/net/bridge.sh @@ -4,7 +4,7 @@ bridge_depend() { before interface macnet - program ip brctl + program brctl } _config_vars="$_config_vars bridge bridge_add brctl" @@ -29,83 +29,6 @@ _bridge_ports() done } -_brctl() -{ - if [ -z "${_bridge_use_ip}" ]; then - if ip -V >/dev/null 2>&1 && [ "$(ip -V | cut -c 24-29)" -ge 130430 ]; then - _bridge_use_ip=1 - else - _bridge_use_ip=0 - fi - fi - if [ "${_bridge_use_ip}" -eq 1 ]; then - case "$1" in - addbr) - ip link add "$2" type bridge - ;; - delbr) - ip link del "$2" - ;; - addif) - ip link set "$3" master "$2" - ;; - delif) - ip link set "$3" nomaster - ;; - setageing) - echo "$3" > /sys/class/net/"$2"/bridge/ageing_time - ;; - setgcint) - # appears to have been dropped in Debian, and I don't see a sysfs file for it - eerror "brctl setgcint is not supported!" - return 1 - ;; - stp) - if [ "$3" = "on" -o "$3" = "yes" -o "$3" = "1" ]; then - _stp_state=1 - elif [ "$3" = "off" -o "$3" = "no" -o "$3" = "0" ]; then - _stp_state=0 - else - eerror "Invalid STP state for brctl stp!" - return 1 - fi - echo ${_stp_state} > /sys/class/net/"$2"/bridge/stp_state - ;; - setbridgeprio) - echo "$3" > /sys/class/net/"$2"/bridge/priority - ;; - setfd) - echo "$3" > /sys/class/net/"$2"/bridge/forward_delay - ;; - sethello) - echo "$3" > /sys/class/net/"$2"/bridge/hello_time - ;; - setmaxage) - echo "$3" > /sys/class/net/"$2"/bridge/max_age - ;; - setpathcost) - echo "$4" > /sys/class/net/"$2"/brif/"$3"/path_cost - ;; - setportprio) - echo "$4" > /sys/class/net/"$2"/brif/"$3"/priority - ;; - hairpin) - if [ "$4" -eq "on" -o "$4" -eq "yes" -o "$4" -eq "1" ]; then - _hairpin_mode=1 - elif [ "$4" -eq "off" -o "$4" -eq "no" -o "$4" -eq "0" ]; then - _hairpin_mode=0 - else - eerror "Invalid hairpin mode for brctl hairpin!" - return 1 - fi - echo ${_hairpin_mode} > /sys/class/net/"$2"/brif/"$3"/hairpin_mode - ;; - esac - else - brctl "$@" - fi -} - bridge_pre_start() { local brif= oiface="${IFACE}" e= x= @@ -147,7 +70,7 @@ bridge_pre_start() if ! _is_bridge ; then ebegin "Creating bridge ${IFACE}" - if ! _brctl addbr "${IFACE}"; then + if ! brctl addbr "${IFACE}"; then eend 1 return 1 fi @@ -166,7 +89,7 @@ bridge_pre_start() x=$1 shift set -- "${x}" "${IFACE}" "$@" - _brctl "$@" + brctl "$@" done unset IFS @@ -197,7 +120,7 @@ bridge_pre_start() fi # The interface is known to exist now _up - if ! _brctl addif "${BR_IFACE}" "${x}"; then + if ! brctl addif "${BR_IFACE}" "${x}"; then eend 1 return 1 fi @@ -253,13 +176,13 @@ bridge_post_stop() ebegin "Removing port ${port}${extra}" local IFACE="${port}" _set_flag -promisc - _brctl delif "${iface}" "${port}" + brctl delif "${iface}" "${port}" eend $? done if ${delete}; then eoutdent - _brctl delbr "${iface}" + brctl delbr "${iface}" eend $? fi