From a0b42400a3889e2ee9493830d245acba89a71e3d Mon Sep 17 00:00:00 2001 From: teastep Date: Mon, 1 Jan 2007 00:40:42 +0000 Subject: [PATCH] Add wait4ifup git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5180 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-lite/install.sh | 9 +++++++++ Shorewall-lite/shorewall-lite.spec | 1 + Shorewall/changelog.txt | 5 ++++- Shorewall/install.sh | 9 +++++++++ Shorewall/releasenotes.txt | 9 +++++++++ Shorewall/shorewall.spec | 1 + Shorewall/wait4ifup | 28 ++++++++++++++++++++++++++++ tools/build/makeshorewall | 3 +++ 8 files changed, 64 insertions(+), 1 deletion(-) create mode 100755 Shorewall/wait4ifup diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index b1201cde7..c963cae68 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -311,6 +311,15 @@ install_file shorecap ${PREFIX}/usr/share/shorewall-lite/shorecap 0555 echo echo "Capability file builder installed in ${PREFIX}/usr/share/shorewall-lite/shorecap" +# +# Install wait4ifup +# + +install_file wait4ifup ${PREFIX}/usr/share/shorewall-lite/wait4ifup 0555 + +echo +echo "wait4ifup installed in ${PREFIX}/usr/share/shorewall-lite/wait4ifup" + # # Install the Modules file # diff --git a/Shorewall-lite/shorewall-lite.spec b/Shorewall-lite/shorewall-lite.spec index f4e75d092..334bc82a7 100644 --- a/Shorewall-lite/shorewall-lite.spec +++ b/Shorewall-lite/shorewall-lite.spec @@ -80,6 +80,7 @@ fi %attr(0444,root,root) /usr/share/shorewall-lite/lib.cli %attr(0444,root,root) /usr/share/shorewall-lite/modules %attr(0544,root,root) /usr/share/shorewall-lite/shorecap +%attr(0555,root,root) /usr/share/shorewall-lite/wait4ifup %attr(0444,root,root) %{_mandir}/man5/shorewall-accounting.5.gz %attr(0444,root,root) %{_mandir}/man5/shorewall-actions.5.gz diff --git a/Shorewall/changelog.txt b/Shorewall/changelog.txt index 173532ea7..805177fb9 100644 --- a/Shorewall/changelog.txt +++ b/Shorewall/changelog.txt @@ -2,7 +2,10 @@ Changes in 3.4.0 Beta 2 1) Fix for empty blacklist file. -2) Don't copy files from /usr/share/shorewall into the compiled script. +2) Don't copy files from /usr/share/shorewall into the compiled + script. + +3) Add wait4ifup. Changes in 3.4.0 Beta 1 diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 6ef3538bb..96483a812 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -291,6 +291,15 @@ install_file compiler ${PREFIX}/usr/share/shorewall/compiler 0555 echo echo "Compiler installed in ${PREFIX}/usr/share/shorewall/compiler" +# +# Install wait4ifup +# + +install_file wait4ifup ${PREFIX}/usr/share/shorewall/wait4ifup 0555 + +echo +echo "wait4ifup installed in ${PREFIX}/usr/share/shorewall/wait4ifup" + # # Install the policy file # diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index 00e300a0b..b4b3150a2 100644 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -619,6 +619,15 @@ New Features in Shorewall 3.4: causes the resulting rule to be inserted into the POSTROUTING chain. +28) The program /usr/share/shorewall/wait4ifup can be used to wait for + a network device (such as a ppp device) to reach the UP state. + + /usr/share/shorewall/wait4ifup [ ] + + The program will wait for up to seconds for the + named to reach the UP state. if is not given, + 60 seconds is assumed. + Problems Corrected in 3.4.0 Beta 1. 1) It is now possible to place entries in the IPSEC column of diff --git a/Shorewall/shorewall.spec b/Shorewall/shorewall.spec index 1e1244bd8..1795ae143 100644 --- a/Shorewall/shorewall.spec +++ b/Shorewall/shorewall.spec @@ -190,6 +190,7 @@ fi %attr(0644,root,root) /usr/share/shorewall/prog.header %attr(0644,root,root) /usr/share/shorewall/rfc1918 %attr(0644,root,root) /usr/share/shorewall/configpath +%attr(0555,root,root) /usr/share/shorewall/wait4ifup %attr(0644,root,root) /usr/share/shorewall/configfiles/shorewall.conf %attr(0644,root,root) /usr/share/shorewall/configfiles/zones diff --git a/Shorewall/wait4ifup b/Shorewall/wait4ifup new file mode 100755 index 000000000..8ec7527da --- /dev/null +++ b/Shorewall/wait4ifup @@ -0,0 +1,28 @@ +#!/bin/sh + +# +# Determine if Interface is up +# +interface_is_up() { + [ -n "$(ip link ls dev $1 | grep -e '[<,]UP[,>]')" ] +} + +case $# in + 1) + timeout=60 + ;; + 2) + timeout=$2 + ;; + *) + echo "usage: $(basename $0) [ ]" + exit 2 + ;; +esac + +while [ $timeout -gt 0 ] && ! interface_is_up $1; do + sleep 1 + timeout=$(( $timeout - 1 )) +done + + diff --git a/tools/build/makeshorewall b/tools/build/makeshorewall index b53fb4ead..40cbce424 100755 --- a/tools/build/makeshorewall +++ b/tools/build/makeshorewall @@ -317,6 +317,9 @@ if [ -n "${BUILDTARBALL}${BUILDRPM}" ]; then if [ -f $SHOREWALLDIR/lib.cli ]; then do_or_die "cp $SHOREWALLDIR/lib.cli $SHOREWALLLITEDIR >> $LOGFILE 2>&1" fi + if [ -f $SHOREWALLDIR/wait4ifup ]; then + do_or_die "cp $SHOREWALLDIR/wait4ifup $SHOREWALLLITEDIR >> $LOGFILE 2>&1" + fi else do_or_die "cp $SHOREWALLDIR/functions $SHOREWALLLITEDIR >> $LOGFILE 2>&1" fi