From 3ce524d2d83b116be18c991adeb0bc7d5b606c3c Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 10 Dec 2002 20:42:19 +0000 Subject: [PATCH] Added "shorewall show classifiers" command git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@360 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/changelog.txt | 15 ++++++++----- Shorewall/releasenotes.txt | 8 ++++--- Shorewall/shorewall | 45 +++++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/Shorewall/changelog.txt b/Shorewall/changelog.txt index 4f131ec74..2ed1e52cd 100755 --- a/Shorewall/changelog.txt +++ b/Shorewall/changelog.txt @@ -10,19 +10,22 @@ Changes since 1.3.11 5. Replaced 'sed' invocation in separate_list() by shell code (speedup). -6. Replace 'wc' invocation in list_count() by shell code (speedup) +6. Replaced 'wc' invocation in list_count() by shell code (speedup) -7. Replace 'sed' invocation in run_iptables() by shell code and - optomize (speedup) +7. Replaced 'sed' invocation in run_iptables() by shell code and + optomized (speedup) 8. Only read the interfaces file once (speedup) 9. Only read the policy file once (speedup) -10. Remove redundant function input_chains() (duplicate of first_chains()) +10. Removed redundant function input_chains() (duplicate of first_chains()) -11. Generate an error if 'lo' is defined in the interfaces file. +11. Generated an error if 'lo' is defined in the interfaces file. -12. Clarify error message where ORIGINAL DEST is specified on an +12. Clarified error message where ORIGINAL DEST is specified on an ACCEPT, DROP or REJECT rule. + +13. Added "shorewall show classifiers" command and added packet + classification filter display to "shorewall monitor" diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index e2f6a74c0..36a6643cb 100755 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -2,12 +2,14 @@ This is a minor release of Shorewall that has a couple of new features. New features include: -1) "shorewall refresh" now reloads the traffic shaping rules. +1) "shorewall refresh" now reloads the traffic shaping rules (tcrules + and tcstart). 2) "shorewall debug [re]start" now turns off debugging after an error occurs. This places the point of the failure near the end of the trace rather than up in the middle of it. 3) "shorewall [re]start" has been speeded up by approximately 40% with my configuration. Your milage may vary. - - +4) A "shorewall show classifiers" command has been added which shows + the current packet classification filters. The output from this + command is also added as a separate page in "shorewall monitor" diff --git a/Shorewall/shorewall b/Shorewall/shorewall index 1a7253cb6..563c9730d 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -58,6 +58,7 @@ # shorewall show nat Display the rules in the nat table # shorewall show {mangle|tos} Display the rules in the mangle table # shorewall show tc Display traffic control info +# shorewall show classifiers Display classifiers # shorewall version Display the installed version id # shorewall check Verify the more heavily-used # configuration files. @@ -294,6 +295,34 @@ show_tc() { } +# +# Show classifier information +# +show_classifiers() { + + show_one_classifier() { + local device=${1%@*} + qdisc=`tc qdisc list dev $device` + + if [ -n "$qdisc" ]; then + echo Device $device: + tc -s filter ls dev $device + echo + fi + } + + ip link list | \ + while read inx interface details; do + case $inx in + [0-9]*) + show_one_classifier ${interface%:} + ;; + *) + ;; + esac + done + +} # # Monitor the Firewall # @@ -383,6 +412,15 @@ monitor_firewall() # $1 = timeout -- if negative, prompt each time that echo show_tc timed_read + + clear + echo "$banner `date`" + echo + echo + echo "Packet Classifiers" + echo + show_classifiers + timed_read done } @@ -450,7 +488,7 @@ usage() # $1 = exit status echo "where is one of:" echo " add [:] " echo " delete [:] " - echo " show [|connections|log|nat|tc|tos]" + echo " show [|classifiers|connections|log|nat|tc|tos]" echo " start" echo " stop" echo " reset" @@ -629,6 +667,11 @@ case "$1" in echo show_tc ;; + classifiers) + echo "Shorewall-$version Clasifiers at $HOSTNAME - `date`" + echo + show_classifiers + ;; *) echo "Shorewall-$version Chain $2 at $HOSTNAME - `date`" echo