aboutsummaryrefslogtreecommitdiff
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
parent8abd6ebb111a4a3e4bc4eb5ce440632577c06878 (diff)
Default to tunctl so we can create the device as a specific user, #194588 thanks to Jaco Kroon.
-rw-r--r--ChangeLog5
-rw-r--r--net.Linux/tuntap.sh20
2 files changed, 15 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 91ddc634..a3de9966 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
+ 03 Oct 2007; Roy Marples <uberlord@gentoo.org>:
+
+ Default to tunctl so we can create the device as a specific
+ user, #194588 thanks to Jaco Kroon.
+
28 Sep 2007; Roy Marples <uberlord@gentoo.org>:
rc_service_state now returns the state as a mask, which means that
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 $?
}