From f99e20ee19ebdcd34f7cb1d42e74c0cd49ab5221 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 11 Jul 2013 19:21:56 -0700 Subject: [PATCH] Allow 'show event[s]' Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index 7992979e3..23a1e0083 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -728,6 +728,27 @@ show_nfacct() { echo fi } + +show_events() { + if [ $# -gt 0 ]; then + for event in $@ ; do + if [ -f /proc/net/xt_recent/$event ]; then + echo $event: + cat /proc/net/xt_recent/$event + echo + else + error_message "WARNING: Event $event not found" + fi + done + else + for file in /proc/net/xt_recent/*; do + echo $(basename $file) + cat $file + echo + done + fi +} + # # Show Command Executor # @@ -1066,6 +1087,19 @@ show_command() { error_message "Cannot locate the arptables executable" fi ;; + event) + [ $# -gt 1 ] || usage 1 + echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)" + echo + shift + show_events $@ + ;; + events) + [ $# -gt 1 ] && usage 1 + echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)" + echo + show_events + ;; *) case "$g_program" in *-lite) @@ -1360,6 +1394,9 @@ do_dump_command() { heading "NF Accounting" show_nfacct + heading "Events" + show_events + if qt mywhich setkey; then heading "PFKEY SPD" setkey -DP @@ -3306,6 +3343,8 @@ usage() # $1 = exit status echo " show classifiers" echo " show config" echo " show connections" + echo " show event [ ...]" + echo " show events" echo " show filters" echo " show ip"