From 89f16bdb37c0f06f17b189b29c71ca03e3fb26d6 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 12 Jul 2013 07:14:22 -0700 Subject: [PATCH] Include a current time event in /proc/net/xt_recent/ Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 5 +++++ Shorewall/Perl/Shorewall/Compiler.pm | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index 23a1e0083..a60444c3b 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -730,6 +730,11 @@ show_nfacct() { } show_events() { + 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 + fi + if [ $# -gt 0 ]; then for event in $@ ; do if [ -f /proc/net/xt_recent/$event ]; then diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index 9c98a9196..598377442 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -511,7 +511,9 @@ EOF # emit( ' 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( " set_state Started $config_dir", ' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall', 'else', @@ -533,6 +535,11 @@ EOF emit<<"EOF"; run_start_exit do_iptables -N shorewall +EOF + + emit ( ' do_iptables -A shorewall -m recent --set --name \%CURRENTTIME' ) if have_capability 'RECENT_MATCH'; + + emit<<"EOF"; set_state Started $config_dir my_pathname=\$(my_pathname) [ \$my_pathname = \${VARDIR}/firewall ] || cp -f \$my_pathname \${VARDIR}/firewall