summaryrefslogtreecommitdiffstats
path: root/src/connections
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2012-07-14 15:44:21 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2012-07-14 15:44:21 +0200
commita0b9e69f406ad7cbb7f50f9a044509471f3bd262 (patch)
tree159cbbe16b7b87bc5df7b0fd3cc8b39ca34786d2 /src/connections
parenta02fed0ee3f23bb468f1577a61f24ff289bf3a6b (diff)
downloadnetctl-a0b9e69f406ad7cbb7f50f9a044509471f3bd262.tar.gz
netctl-a0b9e69f406ad7cbb7f50f9a044509471f3bd262.tar.xz
Revise simple connection scripts
- make specifying IP optional for tuntap profiles (FS#30638) - ethernet_{up,down} takes care of bring_interface {up,down} - debugging updates: don't hide errors, they are useful
Diffstat (limited to 'src/connections')
-rw-r--r--src/connections/bond4
-rw-r--r--src/connections/bridge2
-rw-r--r--src/connections/ethernet5
-rw-r--r--src/connections/tunnel3
-rw-r--r--src/connections/tuntap8
-rw-r--r--src/connections/vlan10
6 files changed, 10 insertions, 22 deletions
diff --git a/src/connections/bond b/src/connections/bond
index 1166fc5..4b038fd 100644
--- a/src/connections/bond
+++ b/src/connections/bond
@@ -11,7 +11,6 @@ bond_up() {
else
ip link add dev $INTERFACE type bond
fi
- bring_interface up "$INTERFACE"
"$CONN_DIR/ethernet" up "$1"
for slave in "${SLAVE_INTERFACES[@]}"; do
@@ -30,8 +29,7 @@ bond_down() {
done
"$CONN_DIR/ethernet" down "$1"
- bring_interface down "$INTERFACE"
- ip link delete "$INTERFACE" &> /dev/null
+ ip link delete "$INTERFACE"
return 0
}
diff --git a/src/connections/bridge b/src/connections/bridge
index 03b09d3..6b3ab67 100644
--- a/src/connections/bridge
+++ b/src/connections/bridge
@@ -24,7 +24,6 @@ bridge_up() {
[[ "$FWD_DELAY" ]] && $BRCTL setfd "$INTERFACE" "$FWD_DELAY"
[[ "$MAX_AGE" ]] && $BRCTL setmaxage "$INTERFACE" "$MAX_AGE"
- bring_interface up "$INTERFACE"
"$CONN_DIR/ethernet" up "$1"
return 0
}
@@ -39,7 +38,6 @@ bridge_down() {
done
"$CONN_DIR/ethernet" down "$1"
- bring_interface down "$INTERFACE"
$BRCTL delbr "$INTERFACE"
return 0
}
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 651df06..adb34e3 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -26,7 +26,7 @@ ethernet_up() {
sysctl -q -w "net.ipv6.conf.$SYSCTL_INTERFACE.disable_ipv6=1"
fi
- report_debug ethernet_up ifup
+ report_debug ethernet_up bring_interface up "$INTERFACE"
bring_interface up "$INTERFACE"
@@ -249,10 +249,11 @@ ethernet_down() {
stop_80211x
- report_debug ethernet_down if_down
if [[ "$CONNECTION" == "wireless" ]]; then
+ report_debug ethernet_down bring_interface flush "$INTERFACE"
bring_interface flush "$INTERFACE"
else
+ report_debug ethernet_down bring_interface down "$INTERFACE"
bring_interface down "$INTERFACE"
fi
return 0
diff --git a/src/connections/tunnel b/src/connections/tunnel
index e37a37c..6cefc5c 100644
--- a/src/connections/tunnel
+++ b/src/connections/tunnel
@@ -15,8 +15,6 @@ tunnel_up() {
ip tunnel change "$INTERFACE" local "$LOCAL"
fi
- bring_interface up "$INTERFACE"
-
"$CONN_DIR/ethernet" up "$1"
return 0
}
@@ -25,7 +23,6 @@ tunnel_down() {
load_profile "$1"
"$CONN_DIR/ethernet" down "$1"
- bring_interface down "$INTERFACE"
ip tunnel del "$INTERFACE"
return 0
diff --git a/src/connections/tuntap b/src/connections/tuntap
index 7a7f5f1..6985c8c 100644
--- a/src/connections/tuntap
+++ b/src/connections/tuntap
@@ -9,10 +9,9 @@ tuntap_up() {
exit 1
else
ip tuntap add dev "$INTERFACE" mode "$MODE" \
- user "$USER" group "$GROUP" &>/dev/null
+ user "$USER" group "$GROUP"
fi
- bring_interface up "$INTERFACE"
- "$CONN_DIR/ethernet" up "$1"
+ IP=${IP-no} "$CONN_DIR/ethernet" up "$1"
return 0
}
@@ -20,8 +19,7 @@ tuntap_down() {
load_profile "$1"
"$CONN_DIR/ethernet" down "$1"
- bring_interface down "$INTERFACE"
- ip tuntap del "$INTERFACE" mode "$MODE" &>/dev/null
+ ip tuntap del dev "$INTERFACE" mode "$MODE"
return 0
}
diff --git a/src/connections/vlan b/src/connections/vlan
index acaa399..75c7fa9 100644
--- a/src/connections/vlan
+++ b/src/connections/vlan
@@ -2,28 +2,24 @@
. /usr/lib/network/network
vlan_up() {
- local vlan_interface
load_profile "$1"
if [[ -e "/sys/class/net/$INTERFACE" ]]; then
report_fail "Interface $INTERFACE already exists."
exit 1
else
- ip link set "$VLAN_PHYS_DEV" up
- ip link add link "$VLAN_PHYS_DEV" name "$INTERFACE" type vlan id "$VLAN_ID" >/dev/null 2>&1
+ bring_interface up "$VLAN_PHYS_DEV"
+ ip link add link "$VLAN_PHYS_DEV" name "$INTERFACE" type vlan id "$VLAN_ID"
fi
- bring_interface up "$INTERFACE"
"$CONN_DIR/ethernet" up "$1"
return 0
}
vlan_down() {
- local vlan_interface
load_profile "$1"
"$CONN_DIR/ethernet" down "$1"
- bring_interface down "$INTERFACE"
- ip link delete "$INTERFACE" >/dev/null 2>&1
+ ip link delete "$INTERFACE"
return 0
}