Allow 'show event[s]'

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-07-11 19:21:56 -07:00
parent 8e30831385
commit f99e20ee19

View File

@ -728,6 +728,27 @@ show_nfacct() {
echo echo
fi 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 # Show Command Executor
# #
@ -1066,6 +1087,19 @@ show_command() {
error_message "Cannot locate the arptables executable" error_message "Cannot locate the arptables executable"
fi 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 case "$g_program" in
*-lite) *-lite)
@ -1360,6 +1394,9 @@ do_dump_command() {
heading "NF Accounting" heading "NF Accounting"
show_nfacct show_nfacct
heading "Events"
show_events
if qt mywhich setkey; then if qt mywhich setkey; then
heading "PFKEY SPD" heading "PFKEY SPD"
setkey -DP setkey -DP
@ -3306,6 +3343,8 @@ usage() # $1 = exit status
echo " show classifiers" echo " show classifiers"
echo " show config" echo " show config"
echo " show connections" echo " show connections"
echo " show event [ <event> ...]"
echo " show events"
echo " show filters" echo " show filters"
echo " show ip" echo " show ip"