forked from extern/shorewall_code
Add brief option to shorewall show
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
30066062d1
commit
baf42f2ac0
@ -660,6 +660,8 @@ show_command() {
|
|||||||
table=filter
|
table=filter
|
||||||
local table_given
|
local table_given
|
||||||
table_given=
|
table_given=
|
||||||
|
local output_filter
|
||||||
|
output_filter=cat
|
||||||
|
|
||||||
show_macro() {
|
show_macro() {
|
||||||
foo=`grep 'This macro' $macro | sed 's/This macro //'`
|
foo=`grep 'This macro' $macro | sed 's/This macro //'`
|
||||||
@ -674,6 +676,11 @@ show_command() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# eliminates rules which have not been used from ip*tables' output
|
||||||
|
brief_output() {
|
||||||
|
grep -Eve '^ +0 +0 +'
|
||||||
|
}
|
||||||
|
|
||||||
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||||
option=$1
|
option=$1
|
||||||
case $option in
|
case $option in
|
||||||
@ -726,6 +733,10 @@ show_command() {
|
|||||||
g_routecache=Yes
|
g_routecache=Yes
|
||||||
option=${option#c}
|
option=${option#c}
|
||||||
;;
|
;;
|
||||||
|
b)
|
||||||
|
output_filter=brief_output
|
||||||
|
option=${option#b}
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage 1
|
usage 1
|
||||||
;;
|
;;
|
||||||
@ -787,28 +798,28 @@ show_command() {
|
|||||||
echo "$g_product $SHOREWALL_VERSION NAT Table at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION NAT Table at $g_hostname - $(date)"
|
||||||
echo
|
echo
|
||||||
show_reset
|
show_reset
|
||||||
$g_tool -t nat -L $g_ipt_options
|
$g_tool -t nat -L $g_ipt_options | $output_filter
|
||||||
;;
|
;;
|
||||||
raw)
|
raw)
|
||||||
[ $# -gt 1 ] && usage 1
|
[ $# -gt 1 ] && usage 1
|
||||||
echo "$g_product $SHOREWALL_VERSION RAW Table at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION RAW Table at $g_hostname - $(date)"
|
||||||
echo
|
echo
|
||||||
show_reset
|
show_reset
|
||||||
$g_tool -t raw -L $g_ipt_options
|
$g_tool -t raw -L $g_ipt_options | $output_filter
|
||||||
;;
|
;;
|
||||||
rawpost)
|
rawpost)
|
||||||
[ $# -gt 1 ] && usage 1
|
[ $# -gt 1 ] && usage 1
|
||||||
echo "$g_product $SHOREWALL_VERSION RAWPOST Table at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION RAWPOST Table at $g_hostname - $(date)"
|
||||||
echo
|
echo
|
||||||
show_reset
|
show_reset
|
||||||
$g_tool -t rawpost -L $g_ipt_options
|
$g_tool -t rawpost -L $g_ipt_options | $output_filter
|
||||||
;;
|
;;
|
||||||
tos|mangle)
|
tos|mangle)
|
||||||
[ $# -gt 1 ] && usage 1
|
[ $# -gt 1 ] && usage 1
|
||||||
echo "$g_product $SHOREWALL_VERSION Mangle Table at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION Mangle Table at $g_hostname - $(date)"
|
||||||
echo
|
echo
|
||||||
show_reset
|
show_reset
|
||||||
$g_tool -t mangle -L $g_ipt_options
|
$g_tool -t mangle -L $g_ipt_options | $output_filter
|
||||||
;;
|
;;
|
||||||
log)
|
log)
|
||||||
[ $# -gt 2 ] && usage 1
|
[ $# -gt 2 ] && usage 1
|
||||||
@ -844,7 +855,7 @@ show_command() {
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
$g_tool -t mangle -L -n -v
|
$g_tool -t mangle -L -n -v | $output_filter
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -927,11 +938,11 @@ show_command() {
|
|||||||
show_reset
|
show_reset
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
for chain in $*; do
|
for chain in $*; do
|
||||||
$g_tool -t $table -L $chain $g_ipt_options
|
$g_tool -t $table -L $chain $g_ipt_options | $output_filter
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
$g_tool -t $table -L $g_ipt_options
|
$g_tool -t $table -L $g_ipt_options | $output_filter
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
vardir)
|
vardir)
|
||||||
@ -1049,14 +1060,14 @@ show_command() {
|
|||||||
echo
|
echo
|
||||||
show_reset
|
show_reset
|
||||||
for chain in $*; do
|
for chain in $*; do
|
||||||
$g_tool -t $table -L $chain $g_ipt_options
|
$g_tool -t $table -L $chain $g_ipt_options | $output_filter
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "$g_product $SHOREWALL_VERSION $table Table at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION $table Table at $g_hostname - $(date)"
|
||||||
echo
|
echo
|
||||||
show_reset
|
show_reset
|
||||||
$g_tool -t $table -L $g_ipt_options
|
$g_tool -t $table -L $g_ipt_options | $output_filter
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -3180,7 +3191,7 @@ usage() # $1 = exit status
|
|||||||
echo " restart [ -n ] [ -p ] [ -f ] [ <directory> ]"
|
echo " restart [ -n ] [ -p ] [ -f ] [ <directory> ]"
|
||||||
echo " restore [ -n ] [ <file name> ]"
|
echo " restore [ -n ] [ <file name> ]"
|
||||||
echo " save [ <file name> ]"
|
echo " save [ <file name> ]"
|
||||||
echo " show [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]"
|
echo " show [ -b ] [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]"
|
||||||
echo " show [ -f ] capabilities"
|
echo " show [ -f ] capabilities"
|
||||||
echo " show classifiers"
|
echo " show classifiers"
|
||||||
echo " show config"
|
echo " show config"
|
||||||
|
Loading…
Reference in New Issue
Block a user