Index: strongswan-2.8.2/programs/Makefile =================================================================== --- strongswan-2.8.2.orig/programs/Makefile 2007-06-04 13:23:04.661025312 +0200 +++ strongswan-2.8.2/programs/Makefile 2007-06-04 13:23:06.414758704 +0200 @@ -22,7 +22,7 @@ SUBDIRS+=_realsetup _secretcensor _startklips _updown _updown_espmark SUBDIRS+=auto barf ipsec look manual ranbits secrets starter SUBDIRS+=rsasigkey send-pr setup showdefaults showhostkey calcgoo mailkey -SUBDIRS+=ikeping examples openac scepclient +SUBDIRS+=ikeping examples openac scepclient _showstatus wakeup ifeq ($(USE_LWRES),true) SUBDIRS+=lwdnsq Index: strongswan-2.8.2/programs/_showstatus/Makefile =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strongswan-2.8.2/programs/_showstatus/Makefile 2007-06-04 13:23:06.414758704 +0200 @@ -0,0 +1,22 @@ +# Makefile for miscelaneous programs +# Copyright (C) 2002 Michael Richardson +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. See . +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# RCSID $Id: Makefile,v 1.3 2006/04/17 06:48:49 as Exp $ + +FREESWANSRCDIR=../.. +include ${FREESWANSRCDIR}/Makefile.inc + +PROGRAM=_showstatus +PROGRAMDIR=${LIBDIR} + +include ../Makefile.program Index: strongswan-2.8.2/programs/_showstatus/_showstatus.8 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strongswan-2.8.2/programs/_showstatus/_showstatus.8 2007-06-04 13:23:06.414758704 +0200 @@ -0,0 +1,23 @@ +.TH _showstatus 8 "03 Feb 2007" +.\" +.\" RCSID $Id: _showstatus.8 +.\" +.SH NAME +ipsec _showstatus \- give state feedback via led or other method +.SH SYNOPSIS +.I _showstatus +is invoked by _updown to trigger led's, or other distribution +or platform specific behavior. Presently, the SES button is +supported as a status light on OpenWRT platforms. The button +is configurable by environment variable: +-B IPSEC_STATUS_LED_START +defaults to ses_orange, and +-B IPSEC_STATUS_LED_VALID +defaults to ses_white. +.SH "SEE ALSO" +ipsec(8), ipsec_updown(8). +.SH HISTORY +Man page written for the Linux strongSwan project +by Kevin Cody Jr. Original manpage for _updown by Michael Richardson. +Original program written by Henry Spencer. Extended for the Linux strongSwan +project by Andreas Steffen. Index: strongswan-2.8.2/programs/_showstatus/_showstatus.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strongswan-2.8.2/programs/_showstatus/_showstatus.in 2007-06-04 13:23:06.414758704 +0200 @@ -0,0 +1,70 @@ +#! /bin/sh +# +# Copyright (C) 2007 Kevin Cody Jr. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. See . +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# RCSID $Id: _showstatus.in + + +LED_START=$IPSEC_STATUS_LED_START +LED_VALID=$IPSEC_STATUS_LED_VALID + +[ -z "$LED_START" ] && LED_START="ses_orange" +[ -z "$LED_VALID" ] && LED_VALID="ses_white" + + +setled() { + led=$1 + st=$2 + + [ -n "$led" -a -n "$st" ] || return + + if [ -w "/proc/diag/led/$led" ] ; then + echo "$st" > "/proc/diag/led/$led" + fi + + # integrate other led control methods here + +} + + +case "$1" in + 'start') + [ -n "$LED_VALID" ] && setled "$LED_START" 1 + [ -z "$LED_VALID" ] && setled "$LED_START" f + setled "$LED_VALID" 0 + ;; + 'stop') + setled "$LED_START" 0 + setled "$LED_VALID" 0 + ;; + 'valid') + setled "$LED_VALID" 1 + ;; + 'invalid') + setled "$LED_VALID" 0 + ;; + 'up') + [ -n "$LED_VALID" ] && setled "$LED_START" 0 + [ -z "$LED_VALID" ] && setled "$LED_START" 1 + setled "$LED_VALID" 1 + ;; + 'down') + [ -n "$LED_VALID" ] && setled "$LED_START" 1 + [ -z "$LED_VALID" ] && setled "$LED_START" f + setled "$LED_VALID" f + ;; + *) + echo "$0: unknown status $status" >&2 + ;; +esac + Index: strongswan-2.8.2/programs/wakeup/Makefile =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strongswan-2.8.2/programs/wakeup/Makefile 2007-06-04 13:23:06.415758552 +0200 @@ -0,0 +1,22 @@ +# Makefile for miscelaneous programs +# Copyright (C) 2002 Michael Richardson +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. See . +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# RCSID $Id: Makefile,v 1.3 2006/04/17 06:48:49 as Exp $ + +FREESWANSRCDIR=../.. +include ${FREESWANSRCDIR}/Makefile.inc + +PROGRAM=wakeup +PROGRAMDIR=${LIBDIR} + +include ../Makefile.program Index: strongswan-2.8.2/programs/wakeup/wakeup.8 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strongswan-2.8.2/programs/wakeup/wakeup.8 2007-06-04 13:23:06.415758552 +0200 @@ -0,0 +1,16 @@ +.TH wakeup 8 "03 Feb 2007" +.\" +.\" RCSID $Id: wakeup.8 +.\" +.SH NAME +ipsec wakeup \- stalled and down connection detection +.SH SYNOPSIS +.I wakeup +is invoked by cron and checks ipsec status, whacking as necessary. +.SH "SEE ALSO" +ipsec(8), ipsec_whack(8). +.SH HISTORY +Man page written for the Linux strongSwan project +by Kevin Cody Jr. Original manpage for _updown by Michael Richardson. +Original program written by Henry Spencer. Extended for the Linux strongSwan +project by Andreas Steffen. Index: strongswan-2.8.2/programs/wakeup/wakeup.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ strongswan-2.8.2/programs/wakeup/wakeup.in 2007-06-04 13:23:06.415758552 +0200 @@ -0,0 +1,38 @@ +#! /bin/sh +# wakeup script +# +# Copyright (C) 2007 Kevin Cody Jr. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. See . +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# + +# only applicable when ipsec is running +[ -e /var/run/pluto.pid ] || exit + +# loop through any erouted tunnels in the HOLD state +for f in `ipsec status | awk '/erouted HOLD/{ print $2 }' | cut -f1 -d\: | cut -f2 -d\"` ; do + + # only whack if no pending events at all exists + ipsec status | grep STATE | grep -q $f || + ipsec whack --name $f --initiate --asynchronous + +done + +# loop through any tunnels that don't quite exist +for f in `ipsec status | awk '/prospective erouted/{ print $2 }' | cut -f1 -d: | grep -v \# | cut -f2 -d\"` ; do + + ipsec status | grep STATE_QUICK | grep -q $f || { + ipsec status | grep STATE_MAIN | grep -q $f && ipsec down $f + ipsec up $f + } + +done +