summaryrefslogtreecommitdiffstats
path: root/src/connections/bridge
diff options
context:
space:
mode:
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?