/[baselayout]/trunk/net.Linux/tuntap.sh
Gentoo

Contents of /trunk/net.Linux/tuntap.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2567 - (show annotations) (download) (as text)
Tue Apr 10 10:33:44 2007 UTC (7 years, 3 months ago) by uberlord
File MIME type: text/x-sh
File size: 1184 byte(s)
Misc network fixes so we work on my stable server. Splash plugin removed as splashtuils-1.4 now ships with its own.
1 # Copyright 2004-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 tuntap_depend() {
5 before bridge interface macchanger
6 }
7
8 _config_vars="$_config_vars tunctl"
9
10 _is_tuntap() {
11 [ -n "$(get_options tuntap "${SVCNAME}")" ]
12 }
13
14 tuntap_pre_start() {
15 local tuntap=
16 eval tuntap=\$tuntap_${IFVAR}
17
18 [ -z "${tuntap}" ] && return 0
19
20 if [ ! -e /dev/net/tun ] ; then
21 modprobe tun && sleep 1
22 if [ ! -e /dev/net/tun ] ; then
23 eerror "TUN/TAP support is not present in this kernel"
24 return 1
25 fi
26 fi
27
28 ebegin "Creating Tun/Tap interface ${IFACE}"
29
30 # Set the base metric to 1000
31 metric=1000
32
33 if [ -x /usr/sbin/openvpn ] ; then
34 openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" > /dev/null
35 else
36 local opts=
37 eval opts=\$tunctl_${IFVAR}
38 tunctl ${opts} -t "${IFACE}" >/dev/null
39 fi
40 eend $? && _up && save_options tuntap "${tuntap}"
41 }
42
43 tuntap_post_stop() {
44 _is_tuntap || return 0
45
46 ebegin "Destroying Tun/Tap interface ${IFACE}"
47 if [ -x /usr/sbin/openvpn ] ; then
48 openvpn --rmtun \
49 --dev-type "$(get_options tuntap)" \
50 --dev "${IFACE}" > /dev/null
51 else
52 tunctl -d "${IFACE}" >/dev/null
53 fi
54 eend $?
55 }
56
57 # vim: set ts=4 :

  ViewVC Help
Powered by ViewVC 1.1.20