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() { show_events() {
local file
local base
if [ -f /proc/net/xt_recent/%CURRENTTIME ]; then 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 +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 fi
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
@ -747,9 +752,13 @@ show_events() {
done done
else else
for file in /proc/net/xt_recent/*; do for file in /proc/net/xt_recent/*; do
echo $(basename $file) base=$(basename $file)
cat $file
echo if [ $base != %CURRENTTIME ]; then
echo $(basename $file)
cat $file
echo
fi
done done
fi fi
} }

View File

@ -512,7 +512,9 @@ EOF
emit( emit(
' run_refreshed_exit', ' run_refreshed_exit',
' do_iptables -N shorewall' ); ' 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( emit(
" set_state Started $config_dir", " set_state Started $config_dir",
' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall', ' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall',
@ -537,7 +539,7 @@ EOF
do_iptables -N shorewall do_iptables -N shorewall
EOF 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"; emit<<"EOF";
set_state Started $config_dir set_state Started $config_dir