aboutsummaryrefslogtreecommitdiff
path: root/net.Linux
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-03 13:35:39 +0000
committerRoy Marples <roy@marples.name>2007-10-03 13:35:39 +0000
commit0ccf248afde8159ece027af1491daed97c761420 (patch)
tree7f95b7c592c4b1910035d17669b01706875342d3 /net.Linux
parent8abd6ebb111a4a3e4bc4eb5ce440632577c06878 (diff)
Default to tunctl so we can create the device as a specific user, #194588 thanks to Jaco Kroon.
Diffstat (limited to 'net.Linux')
-rw-r--r--net.Linux/tuntap.sh20
1 files changed, 10 insertions, 10 deletions
diff --git a/net.Linux/tuntap.sh b/net.Linux/tuntap.sh
index ba9b2e87..93798c3e 100644
--- a/net.Linux/tuntap.sh
+++ b/net.Linux/tuntap.sh
@@ -17,9 +17,9 @@ tuntap_pre_start() {
[ -z "${tuntap}" ] && return 0
- if [ ! -e /dev/net/tun ] ; then
+ if [ ! -e /dev/net/tun ]; then
modprobe tun && sleep 1
- if [ ! -e /dev/net/tun ] ; then
+ if [ ! -e /dev/net/tun ]; then
eerror "TUN/TAP support is not present in this kernel"
return 1
fi
@@ -29,13 +29,13 @@ tuntap_pre_start() {
# Set the base metric to 1000
metric=1000
-
- if [ -x /usr/sbin/openvpn ] ; then
- openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" > /dev/null
- else
+
+ if type tunctl >/dev/null 2>&1; then
local opts=
eval opts=\$tunctl_${IFVAR}
tunctl ${opts} -t "${IFACE}" >/dev/null
+ else
+ openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" >/dev/null
fi
eend $? && _up && save_options tuntap "${tuntap}"
}
@@ -44,12 +44,12 @@ tuntap_post_stop() {
_is_tuntap || return 0
ebegin "Destroying Tun/Tap interface ${IFACE}"
- if [ -x /usr/sbin/openvpn ] ; then
+ if type tunctl >/dev/null 2>&1; then
+ tunctl -d "${IFACE}" >/dev/null
+ else
openvpn --rmtun \
--dev-type "$(get_options tuntap)" \
- --dev "${IFACE}" > /dev/null
- else
- tunctl -d "${IFACE}" >/dev/null
+ --dev "${IFACE}" >/dev/null
fi
eend $?
}