Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 394281 | Differences between
and this patch

Collapse All | Expand All

(-)/lib/rc/net/tuntap.sh.old (-6 / +15 lines)
Lines 44-71 Link Here
44
	# Set the base metric to 1000
44
	# Set the base metric to 1000
45
	metric=1000
45
	metric=1000
46
46
47
	local o_opts= t_opts= do_openvpn=false do_tunctl=false
47
	local i_opts= o_opts= t_opts= do_iproute2=false do_openvpn=false do_tunctl=false
48
	eval i_opts=\$iproute2_${IFVAR}
48
	eval o_opts=\$openvpn_${IFVAR}
49
	eval o_opts=\$openvpn_${IFVAR}
49
	eval t_opts=\$tunctl_${IFVAR}
50
	eval t_opts=\$tunctl_${IFVAR}
50
51
51
	if [ -n "${o_opts}" ] && type openvpn >/dev/null 2>&1; then
52
	if [ -n "${i_opts}" ] && type ip >/dev/null 2>&1; then
53
		do_iproute2=true
54
	elif [ -n "${o_opts}" ] && type openvpn >/dev/null 2>&1; then
52
		do_openvpn=true
55
		do_openvpn=true
53
	elif [ -n "${t_opts}" ] && type tunctl >/dev/null 2>&1; then
56
	elif [ -n "${t_opts}" ] && type tunctl >/dev/null 2>&1; then
54
		do_tunctl=true
57
		do_tunctl=true
58
	elif type ip >/dev/null 2>&1; then
59
		do_iproute2=true
55
	elif type openvpn >/dev/null 2>&1; then
60
	elif type openvpn >/dev/null 2>&1; then
56
		do_openvpn=true
61
		do_openvpn=true
57
	elif type tunctl >/dev/null 2>&1; then
62
	elif type tunctl >/dev/null 2>&1; then
58
		do_tunctl=true
63
		do_tunctl=true
59
	fi
64
	fi
60
65
61
	if ${do_openvpn}; then
66
	if ${do_iproute2}; then
67
		ip tuntap add dev "${IFACE}" mode "${tuntap}" ${i_opts}
68
	elif ${do_openvpn}; then
62
		openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" \
69
		openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" \
63
			${o_opts} >/dev/null
70
			${o_opts} >/dev/null
64
	elif ${do_tunctl}; then
71
	elif ${do_tunctl}; then
65
		tunctl ${t_opts} -t "${IFACE}" >/dev/null
72
		tunctl ${t_opts} -t "${IFACE}" >/dev/null
66
	else
73
	else
67
		eerror "Neither openvpn nor tunctl has been found, please install"
74
		eerror "Neither iproute2, openvpn nor tunctl has been found, please install"
68
		eerror "either \"openvpn\" or \"usermode-utilities\"."
75
		eerror "either \"iproute2\" \"openvpn\" or \"usermode-utilities\"."
69
	fi
76
	fi
70
	eend $? && _up && service_set_value tuntap "${tuntap}"
77
	eend $? && _up && service_set_value tuntap "${tuntap}"
71
}
78
}
Lines 75-81 Link Here
75
	_is_tuntap || return 0
82
	_is_tuntap || return 0
76
83
77
	ebegin "Destroying Tun/Tap interface ${IFACE}"
84
	ebegin "Destroying Tun/Tap interface ${IFACE}"
78
	if type tunctl >/dev/null 2>&1; then
85
	if type iproute2 > /dev/null 2>&1; then
86
		_ip tuntap del dev ${IFACE} mode ${service_get_value tuntap}
87
	elif type tunctl >/dev/null 2>&1; then
79
		tunctl -d "${IFACE}" >/dev/null
88
		tunctl -d "${IFACE}" >/dev/null
80
	else
89
	else
81
		openvpn --rmtun \
90
		openvpn --rmtun \

Return to bug 394281