blob: a7eadef848c24ba727e57f78f14d0e38bf375b62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/cisco-vpnclient-3des/files/vpnclient.rc,v 1.4 2004/03/06 03:29:17 vapier Exp $
opts="start stop status"
VPNCLIENT="/usr/bin/vpnclient"
VPNDEV="cipsec0"
VPNMOD="cisco_ipsec"
ID="`which id`"
if [ "$?" != "0" ]; then
eerror "Failed: Unable to determine access level (can't find $HILITE id $NORMAL in \$PATH)."
unset ID
exit 1
fi
WHOAMI="`$ID -u`"
depend() {
need net
}
start() {
ebegin "Starting Cisco VPN Client"
if [ -f /etc/resolv.conf.vpnbackup ]; then
einfo "restoring /etc/resolv.conf"
mv /etc/resolv.conf.vpnbackup /etc/resolv.conf
fi
if [ -d /lib/modules/preferred ]; then
PC=/lib/modules/preferred/CiscoVPN
else
PC=/lib/modules/`uname -r`/CiscoVPN
fi
if [ -d $PC ] ; then
/sbin/insmod ${PC}/${VPNMOD} >/dev/null 2>&1
if [ "$?" != "0" ] ; then
eerror "Failed to load module ${VPNMOD}"
exit 1
fi
else
eerror "module directory $PC not found."
exit 1
fi
case "`uname -r`" in
2.6.*)
;;
2.5.*)
;;
2.4.*)
;;
2.2.*)
;;
2.0.*)
#
# This is only needed due to a bug in 2.0.x kernels that affects
# arp lookups.
#
ifconfig $VPNDEV 222.222.222.222 ;
if [ "$?" != "0" ] ; then
eerror "Failed (ifconfig)."
/sbin/rmmod ${VPNMOD}
exit 1
fi
;;
*)
eerror "Failed (unsupported Linux version)."
/sbin/rmmod ${VPNMOD}
exit 1
;;
esac
eend $?
}
stop() {
ebegin "Stopping Cisco VPN Client"
if [ -x $VPNCLIENT ]; then
$VPNCLIENT disconnect > /dev/null 2>&1
fi
/sbin/lsmod | grep -q "${VPNMOD}"
if [ "$?" != "0" ] ; then
eerror "Failed: module ${VPNMOD} is not running."
exit 1
fi
/sbin/ifconfig $VPNDEV down
if [ "$?" != "0" ] ; then
eerror "Failed (ifconfig)."
exit 1
fi
/sbin/rmmod ${VPNMOD}
if [ "$?" != "0" ] ; then
eerror "Failed (rmmod)."
exit 1
fi
eend $?
}
status() {
/sbin/lsmod | egrep 'Module'
/sbin/lsmod | egrep "${VPNMOD}"
if [ "$?" != "0" ] ; then
echo
eerror "Failed (lsmod ${VPNMOD}): the VPN module is not loaded."
exit 1
fi
echo
/sbin/ifconfig $VPNDEV
if [ "$?" != "0" ] ; then
echo
eerror "Failed (ifconfig ${VPNDEV}): the virtual interface is not present."
exit 1
fi
}
|