dnsmasq: extend the init script thanks Sedky
[openwrt.git] / package / strongswan / patches / 200-wakeup-showstatus.patch
1 Index: strongswan-2.8.2/programs/Makefile
2 ===================================================================
3 --- strongswan-2.8.2.orig/programs/Makefile 2007-06-04 13:23:04.661025312 +0200
4 +++ strongswan-2.8.2/programs/Makefile 2007-06-04 13:23:06.414758704 +0200
5 @@ -22,7 +22,7 @@
6 SUBDIRS+=_realsetup _secretcensor _startklips _updown _updown_espmark
7 SUBDIRS+=auto barf ipsec look manual ranbits secrets starter
8 SUBDIRS+=rsasigkey send-pr setup showdefaults showhostkey calcgoo mailkey
9 -SUBDIRS+=ikeping examples openac scepclient
10 +SUBDIRS+=ikeping examples openac scepclient _showstatus wakeup
11
12 ifeq ($(USE_LWRES),true)
13 SUBDIRS+=lwdnsq
14 Index: strongswan-2.8.2/programs/_showstatus/Makefile
15 ===================================================================
16 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
17 +++ strongswan-2.8.2/programs/_showstatus/Makefile 2007-06-04 13:23:06.414758704 +0200
18 @@ -0,0 +1,22 @@
19 +# Makefile for miscelaneous programs
20 +# Copyright (C) 2002 Michael Richardson <mcr@freeswan.org>
21 +#
22 +# This program is free software; you can redistribute it and/or modify it
23 +# under the terms of the GNU General Public License as published by the
24 +# Free Software Foundation; either version 2 of the License, or (at your
25 +# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
26 +#
27 +# This program is distributed in the hope that it will be useful, but
28 +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
29 +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
30 +# for more details.
31 +#
32 +# RCSID $Id: Makefile,v 1.3 2006/04/17 06:48:49 as Exp $
33 +
34 +FREESWANSRCDIR=../..
35 +include ${FREESWANSRCDIR}/Makefile.inc
36 +
37 +PROGRAM=_showstatus
38 +PROGRAMDIR=${LIBDIR}
39 +
40 +include ../Makefile.program
41 Index: strongswan-2.8.2/programs/_showstatus/_showstatus.8
42 ===================================================================
43 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
44 +++ strongswan-2.8.2/programs/_showstatus/_showstatus.8 2007-06-04 13:23:06.414758704 +0200
45 @@ -0,0 +1,23 @@
46 +.TH _showstatus 8 "03 Feb 2007"
47 +.\"
48 +.\" RCSID $Id: _showstatus.8
49 +.\"
50 +.SH NAME
51 +ipsec _showstatus \- give state feedback via led or other method
52 +.SH SYNOPSIS
53 +.I _showstatus
54 +is invoked by _updown to trigger led's, or other distribution
55 +or platform specific behavior. Presently, the SES button is
56 +supported as a status light on OpenWRT platforms. The button
57 +is configurable by environment variable:
58 +-B IPSEC_STATUS_LED_START
59 +defaults to ses_orange, and
60 +-B IPSEC_STATUS_LED_VALID
61 +defaults to ses_white.
62 +.SH "SEE ALSO"
63 +ipsec(8), ipsec_updown(8).
64 +.SH HISTORY
65 +Man page written for the Linux strongSwan project <http://www.strongswan.org/>
66 +by Kevin Cody Jr. Original manpage for _updown by Michael Richardson.
67 +Original program written by Henry Spencer. Extended for the Linux strongSwan
68 +project <http://www.strongswan.org/> by Andreas Steffen.
69 Index: strongswan-2.8.2/programs/_showstatus/_showstatus.in
70 ===================================================================
71 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
72 +++ strongswan-2.8.2/programs/_showstatus/_showstatus.in 2007-06-04 13:23:06.414758704 +0200
73 @@ -0,0 +1,70 @@
74 +#! /bin/sh
75 +#
76 +# Copyright (C) 2007 Kevin Cody Jr. <kcody@vegaresearch.com>
77 +#
78 +# This program is free software; you can redistribute it and/or modify it
79 +# under the terms of the GNU General Public License as published by the
80 +# Free Software Foundation; either version 2 of the License, or (at your
81 +# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
82 +#
83 +# This program is distributed in the hope that it will be useful, but
84 +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
85 +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
86 +# for more details.
87 +#
88 +# RCSID $Id: _showstatus.in
89 +
90 +
91 +LED_START=$IPSEC_STATUS_LED_START
92 +LED_VALID=$IPSEC_STATUS_LED_VALID
93 +
94 +[ -z "$LED_START" ] && LED_START="ses_orange"
95 +[ -z "$LED_VALID" ] && LED_VALID="ses_white"
96 +
97 +
98 +setled() {
99 + led=$1
100 + st=$2
101 +
102 + [ -n "$led" -a -n "$st" ] || return
103 +
104 + if [ -w "/proc/diag/led/$led" ] ; then
105 + echo "$st" > "/proc/diag/led/$led"
106 + fi
107 +
108 + # integrate other led control methods here
109 +
110 +}
111 +
112 +
113 +case "$1" in
114 + 'start')
115 + [ -n "$LED_VALID" ] && setled "$LED_START" 1
116 + [ -z "$LED_VALID" ] && setled "$LED_START" f
117 + setled "$LED_VALID" 0
118 + ;;
119 + 'stop')
120 + setled "$LED_START" 0
121 + setled "$LED_VALID" 0
122 + ;;
123 + 'valid')
124 + setled "$LED_VALID" 1
125 + ;;
126 + 'invalid')
127 + setled "$LED_VALID" 0
128 + ;;
129 + 'up')
130 + [ -n "$LED_VALID" ] && setled "$LED_START" 0
131 + [ -z "$LED_VALID" ] && setled "$LED_START" 1
132 + setled "$LED_VALID" 1
133 + ;;
134 + 'down')
135 + [ -n "$LED_VALID" ] && setled "$LED_START" 1
136 + [ -z "$LED_VALID" ] && setled "$LED_START" f
137 + setled "$LED_VALID" f
138 + ;;
139 + *)
140 + echo "$0: unknown status $status" >&2
141 + ;;
142 +esac
143 +
144 Index: strongswan-2.8.2/programs/wakeup/Makefile
145 ===================================================================
146 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
147 +++ strongswan-2.8.2/programs/wakeup/Makefile 2007-06-04 13:23:06.415758552 +0200
148 @@ -0,0 +1,22 @@
149 +# Makefile for miscelaneous programs
150 +# Copyright (C) 2002 Michael Richardson <mcr@freeswan.org>
151 +#
152 +# This program is free software; you can redistribute it and/or modify it
153 +# under the terms of the GNU General Public License as published by the
154 +# Free Software Foundation; either version 2 of the License, or (at your
155 +# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
156 +#
157 +# This program is distributed in the hope that it will be useful, but
158 +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
159 +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
160 +# for more details.
161 +#
162 +# RCSID $Id: Makefile,v 1.3 2006/04/17 06:48:49 as Exp $
163 +
164 +FREESWANSRCDIR=../..
165 +include ${FREESWANSRCDIR}/Makefile.inc
166 +
167 +PROGRAM=wakeup
168 +PROGRAMDIR=${LIBDIR}
169 +
170 +include ../Makefile.program
171 Index: strongswan-2.8.2/programs/wakeup/wakeup.8
172 ===================================================================
173 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
174 +++ strongswan-2.8.2/programs/wakeup/wakeup.8 2007-06-04 13:23:06.415758552 +0200
175 @@ -0,0 +1,16 @@
176 +.TH wakeup 8 "03 Feb 2007"
177 +.\"
178 +.\" RCSID $Id: wakeup.8
179 +.\"
180 +.SH NAME
181 +ipsec wakeup \- stalled and down connection detection
182 +.SH SYNOPSIS
183 +.I wakeup
184 +is invoked by cron and checks ipsec status, whacking as necessary.
185 +.SH "SEE ALSO"
186 +ipsec(8), ipsec_whack(8).
187 +.SH HISTORY
188 +Man page written for the Linux strongSwan project <http://www.strongswan.org/>
189 +by Kevin Cody Jr. Original manpage for _updown by Michael Richardson.
190 +Original program written by Henry Spencer. Extended for the Linux strongSwan
191 +project <http://www.strongswan.org/> by Andreas Steffen.
192 Index: strongswan-2.8.2/programs/wakeup/wakeup.in
193 ===================================================================
194 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
195 +++ strongswan-2.8.2/programs/wakeup/wakeup.in 2007-06-04 13:23:06.415758552 +0200
196 @@ -0,0 +1,38 @@
197 +#! /bin/sh
198 +# wakeup script
199 +#
200 +# Copyright (C) 2007 Kevin Cody Jr. <kcody@vegaresearch.com>
201 +#
202 +# This program is free software; you can redistribute it and/or modify it
203 +# under the terms of the GNU General Public License as published by the
204 +# Free Software Foundation; either version 2 of the License, or (at your
205 +# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
206 +#
207 +# This program is distributed in the hope that it will be useful, but
208 +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
209 +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
210 +# for more details.
211 +#
212 +
213 +# only applicable when ipsec is running
214 +[ -e /var/run/pluto.pid ] || exit
215 +
216 +# loop through any erouted tunnels in the HOLD state
217 +for f in `ipsec status | awk '/erouted HOLD/{ print $2 }' | cut -f1 -d\: | cut -f2 -d\"` ; do
218 +
219 + # only whack if no pending events at all exists
220 + ipsec status | grep STATE | grep -q $f ||
221 + ipsec whack --name $f --initiate --asynchronous
222 +
223 +done
224 +
225 +# loop through any tunnels that don't quite exist
226 +for f in `ipsec status | awk '/prospective erouted/{ print $2 }' | cut -f1 -d: | grep -v \# | cut -f2 -d\"` ; do
227 +
228 + ipsec status | grep STATE_QUICK | grep -q $f || {
229 + ipsec status | grep STATE_MAIN | grep -q $f && ipsec down $f
230 + ipsec up $f
231 + }
232 +
233 +done
234 +
This page took 0.053944 seconds and 5 git commands to generate.