Display the current time as an integer in 'show event[s]' output

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-07-12 09:46:08 -07:00
parent 282bf0a78c
commit 5c7500e13e
2 changed files with 16 additions and 5 deletions

View File

@ -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
base=$(basename $file)
if [ $base != %CURRENTTIME ]; then
echo $(basename $file)
cat $file
echo
fi
done
fi
}

View File

@ -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