From ea3fa8710ef5ec1f1621cfe661407019575b55a5 Mon Sep 17 00:00:00 2001 From: teastep Date: Fri, 15 Apr 2005 14:35:54 +0000 Subject: [PATCH] Add -v option to /sbin/shorewall git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@2053 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall2/changelog.txt | 2 ++ Shorewall2/releasenotes.txt | 6 ++++++ Shorewall2/shorewall | 25 ++++++++++++++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Shorewall2/changelog.txt b/Shorewall2/changelog.txt index 42b1fa357..3cb5dd943 100644 --- a/Shorewall2/changelog.txt +++ b/Shorewall2/changelog.txt @@ -17,6 +17,8 @@ Changes in 2.2.4 8) Add 'shorewall show capabilities' +8) Add '-v' option + Changes in 2.2.3 1) Added the 'continue' extension script. diff --git a/Shorewall2/releasenotes.txt b/Shorewall2/releasenotes.txt index 0b26e4636..e26a3814b 100755 --- a/Shorewall2/releasenotes.txt +++ b/Shorewall2/releasenotes.txt @@ -151,6 +151,12 @@ New Features in version 2.2.4 Owner Match: Available gateway:~# +6) A "-v" option has been added to /sbin/shorewall. Currently, this + option only affects the "show log" command (e.g., "shorewall -v show + log") and the "monitor" command. In these commands, it causes the + MAC address in the log message (if any) to be displayed. As + previously, when "-v" is omitted, the MAC address is suppressed. + ----------------------------------------------------------------------- Problems corrected in version 2.2.3 diff --git a/Shorewall2/shorewall b/Shorewall2/shorewall index 650e95924..80a5936d2 100755 --- a/Shorewall2/shorewall +++ b/Shorewall2/shorewall @@ -354,11 +354,18 @@ packet_log() # $1 = number of messages [ -n "$realtail" ] && options="-n$1" - grep "${LOGFORMAT}" $LOGFILE | \ - sed s/" kernel:"// | \ - sed s/" $host $LOGFORMAT"/" "/ | \ - sed 's/MAC=.* SRC=/SRC=/' | \ - tail $options + if [ -n "$VERBOSE" ]; then + grep "${LOGFORMAT}" $LOGFILE | \ + sed s/" kernel:"// | \ + sed s/" $host $LOGFORMAT"/" "/ | \ + tail $options + else + grep "${LOGFORMAT}" $LOGFILE | \ + sed s/" kernel:"// | \ + sed s/" $host $LOGFORMAT"/" "/ | \ + sed 's/MAC=.* SRC=/SRC=/' | \ + tail $options + fi } # @@ -597,7 +604,7 @@ help() # usage() # $1 = exit status { - echo "Usage: $(basename $0) [debug|trace] [nolock] [-c ] [ -x ] [ -q ] [ -f ] " + echo "Usage: $(basename $0) [debug|trace] [nolock] [ -x ] [ -q ] [ -f ] [ -v ] " echo "where is one of:" echo " add [:{[:]|}[,...]] ... " echo " allow
..." @@ -625,7 +632,6 @@ usage() # $1 = exit status echo " try [ ]" echo " version" echo - echo "The -c and -f options may not be specified with a in the start, restart and check commands" exit $1 } @@ -666,6 +672,7 @@ SHOREWALL_DIR= QUIET= IPT_OPTIONS="-nv" FAST= +VERBOSE= done=0 @@ -707,6 +714,10 @@ while [ $done -eq 0 ]; do FAST=Yes option=${option#f} ;; + v*) + VERBOSE=Yes + option=${option#v} + ;; *) usage 1 ;;