/[vps]/baselayout-vserver/trunk/lib/rcscripts/net.modules.d/iptunnel
Gentoo

Contents of /baselayout-vserver/trunk/lib/rcscripts/net.modules.d/iptunnel

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sat Sep 3 16:10:27 2005 UTC (9 years, 3 months ago) by hollow
File size: 1716 byte(s)
import initial baselayout sources (1.12.0_pre8)
1 #!/bin/bash
2 # Copyright (c) 2004-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 # Contributed by Roy Marples (uberlord@gentoo.org)
6
7 # char* iptunnel_provides(void)
8 #
9 # Returns a string to change module definition for starting up
10 iptunnel_provides() {
11 echo "iptunnel"
12 }
13
14 # void iptunnel_depend(void)
15 #
16 # Sets up the dependancies for the module
17 iptunnel_depend() {
18 after wireless
19 before interface
20 }
21
22 # bool iptunnel_check_installed(void)
23 #
24 # Tunnelling is provided by the interface
25 iptunnel_check_installed() {
26 return 0
27 }
28
29 # bool iptunnel_check_depends(void)
30 #
31 # Checks to see if we have the needed functions
32 iptunnel_check_depends() {
33 local f
34
35 for f in interface_exists interface_tunnel; do
36 [[ $( type -t "${f}" ) == "function" ]] && continue
37 eerror "iptunnel: missing required function ${f}\n"
38 return 1
39 done
40
41 return 0
42 }
43
44 # char* iptunnel_get_vars(char *interface)
45 #
46 # Returns a string spaced with possible user set
47 # configuration variables
48 iptunnel_get_vars() {
49 echo "iptunnel_$1"
50 }
51
52 # bool iptunnel_pre_start(char *iface)
53 #
54 # Create the device, give it the right perms
55 iptunnel_pre_start() {
56 local iface="$1" opts ifvar=$( bash_variable "$1" )
57
58 # Get our options
59 eval opts=\"\$\{iptunnel_${ifvar}\}\"
60 [[ -z ${opts} ]] && return 0
61
62 ebegin "Creating tunnel ${iface}"
63 interface_tunnel add "${iface}" ${opts}
64 eend "$?"
65 return "$?"
66
67 }
68
69 # bool iptunnel_stop(char *iface)
70 #
71 # Removes the device
72 iptunnel_stop() {
73 local iface="$1"
74
75 interface_exists "${iface}" || return 0
76 [[ -z $( interface_tunnel show "${iface}" 2>/dev/null ) ]] && return 0
77
78 ebegin "Destroying tunnel ${iface}"
79 interface_tunnel del "${iface}"
80 eend "$?"
81 return "$?"
82 }
83
84 # vim:ts=4

  ViewVC Help
Powered by ViewVC 1.1.20