Default to tunctl so we can create the device as a specific user, #194588 thanks to Jaco Kroon.
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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 $?
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user