From 0ccf248afde8159ece027af1491daed97c761420 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 3 Oct 2007 13:35:39 +0000 Subject: Default to tunctl so we can create the device as a specific user, #194588 thanks to Jaco Kroon. --- net.Linux/tuntap.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'net.Linux/tuntap.sh') 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 $? } -- cgit v1.2.3