From 5c7500e13e9567a95a8fea6b6b12a6bde2a2be30 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 12 Jul 2013 09:46:08 -0700 Subject: [PATCH] Display the current time as an integer in 'show event[s]' output Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 15 ++++++++++++--- Shorewall/Perl/Shorewall/Compiler.pm | 6 ++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index cd4ecc165..99c836149 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -730,9 +730,14 @@ show_nfacct() { } show_events() { + local file + local base + if [ -f /proc/net/xt_recent/%CURRENTTIME ]; then echo -127.0.0.1 > /proc/net/xt_recent/%CURRENTTIME echo +127.0.0.1 > /proc/net/xt_recent/%CURRENTTIME + echo Current time: $(cat /proc/net/xt_recent/%CURRENTTIME | cut -d ' ' -f 5 -) + echo fi if [ $# -gt 0 ]; then @@ -747,9 +752,13 @@ show_events() { done else for file in /proc/net/xt_recent/*; do - echo $(basename $file) - cat $file - echo + base=$(basename $file) + + if [ $base != %CURRENTTIME ]; then + echo $(basename $file) + cat $file + echo + fi done fi } diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index 598377442..7d8b38a10 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -512,7 +512,9 @@ EOF emit( ' run_refreshed_exit', ' do_iptables -N shorewall' ); - emit ( ' do_iptables -A shorewall -m recent --set --name \%CURRENTTIME' ) if have_capability 'RECENT_MATCH'; + + emit ( ' do_iptables -A shorewall -m recent --set --name %CURRENTTIME' ) if have_capability 'RECENT_MATCH'; + emit( " set_state Started $config_dir", ' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall', @@ -537,7 +539,7 @@ EOF do_iptables -N shorewall EOF - emit ( ' do_iptables -A shorewall -m recent --set --name \%CURRENTTIME' ) if have_capability 'RECENT_MATCH'; + emit ( ' do_iptables -A shorewall -m recent --set --name %CURRENTTIME' ) if have_capability 'RECENT_MATCH'; emit<<"EOF"; set_state Started $config_dir