summaryrefslogtreecommitdiffstats
path: root/src/connections/bridge
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2012-03-01 01:33:12 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2012-03-01 01:35:58 +0100
commiteed3f590c9db7cd9cd4d5fb4722fc7257a278ea6 (patch)
treed34406a8af61dccbb9655b899da30d04ce61a623 /src/connections/bridge
parent8d1c5e8ec6b637015e84bbb154ece9065c59f1c5 (diff)
downloadnetctl-eed3f590c9db7cd9cd4d5fb4722fc7257a278ea6.tar.gz
netctl-eed3f590c9db7cd9cd4d5fb4722fc7257a278ea6.tar.xz
Code quality upgrade
This is what you get when Dave Reisner points you at some bash anti-patterns. Also in this commit: - updated documentation - bugfix revision of the IPv6 SLAAC address/route bug
Diffstat (limited to 'src/connections/bridge')
-rw-r--r--src/connections/bridge28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/connections/bridge b/src/connections/bridge
index 3cf60c1..e134647 100644
--- a/src/connections/bridge
+++ b/src/connections/bridge
@@ -6,27 +6,23 @@ bridge_up() {
local bridge_interface
load_profile "$1"
- if [ -e "/sys/class/net/$INTERFACE" ]; then
- if [ ! -d "/sys/class/net/$INTERFACE/brif" ]; then
+ if [[ -e "/sys/class/net/$INTERFACE" ]]; then
+ if [[ ! -d "/sys/class/net/$INTERFACE/brif" ]]; then
report_fail "Interface $INTERFACE already exists and is not a bridge."
exit 1
fi
else
- $BRCTL addbr $INTERFACE
+ $BRCTL addbr "$INTERFACE"
fi
for bridge_client in $BRIDGE_INTERFACES; do
- ip link set $bridge_client promisc on up
- ip addr flush dev $bridge_client
- $BRCTL addif $INTERFACE $bridge_client
+ ip link set "$bridge_client" promisc on up
+ ip addr flush dev "$bridge_client"
+ $BRCTL addif "$INTERFACE" "$bridge_client"
done
# Set options
- if [ -n "$FWD_DELAY" ]; then
- $BRCTL setfd $INTERFACE "$FWD_DELAY"
- fi
- if [ -n "$MAX_AGE" ]; then
- $BRCTL setmaxage $INTERFACE "$MAX_AGE"
- fi
+ [[ "$FWD_DELAY" ]] && $BRCTL setfd "$INTERFACE" "$FWD_DELAY"
+ [[ "$MAX_AGE" ]] && $BRCTL setmaxage "$INTERFACE" "$MAX_AGE"
bring_interface up "$INTERFACE"
"$CONN_DIR/ethernet" up "$1"
@@ -38,14 +34,14 @@ bridge_down() {
load_profile "$1"
for bridge_client in $BRIDGE_INTERFACES; do
- ip link set $bridge_client promisc off down
- $BRCTL delif $INTERFACE $bridge_client
+ ip link set "$bridge_client" promisc off down
+ $BRCTL delif "$INTERFACE" "$bridge_client"
done
"$CONN_DIR/ethernet" down "$1"
bring_interface down "$INTERFACE"
- $BRCTL delbr $INTERFACE
- return 0
+ $BRCTL delbr "$INTERFACE"
+ return 0
}
# Returns status of profile - is it still functional?