Add 'encode' and 'decode' commands

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9940 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2009-04-19 19:58:04 +00:00
parent 8d450e673c
commit e076cf00f9
2 changed files with 29 additions and 0 deletions

View File

@ -212,6 +212,25 @@ None.
The above defines 32 classes with MARK values 100-131. Each
class has a guaranteed rate of 1kbit/second.
As part of this change, the generation of class ids from mark
values has been changed. The class number is now
( <devnum> << 10 ) | <mask>
/sbin/shorewall has an 'encode' and 'decode' command to translate a
device number, mark pair to/from a classid:
encode <devnum> <mark>
decode <classnum>
Example:
$ shorewall decode 3172
Device = 3 Mark = 100
$ shorewall encode 3 100
Class number = 3172
$
----------------------------------------------------------------------------
N E W F E A T U R E S IN 4 . 3
----------------------------------------------------------------------------

View File

@ -1444,9 +1444,11 @@ usage() # $1 = exit status
echo " check [ -e ] [ <directory> ]"
echo " clear [ -f ]"
echo " compile [ -e ] [ -d ] [ <directory name> ] [ <path name> ]"
echo " decode <classnum>"
echo " delete <interface>[:<host-list>] ... <zone>"
echo " drop <address> ..."
echo " dump [ -x ]"
echo " encode <devnum> <mark>"
echo " export [ <directory1> ] [<user>@]<system>[:<directory2>]"
echo " forget [ <file name> ]"
echo " help"
@ -1992,6 +1994,14 @@ case "$COMMAND" in
shift
restore_command $@
;;
decode)
[ $# -eq 2 ] || usage 1
echo "Device = $(($2 >> 10)) Mark = $(($2 & 0x3ff))"
;;
encode)
[ $# -eq 3 ] || usage 1
echo "Class Number = $((($2 << 10) | $3))"
;;
call)
get_config
[ -n "$debugging" ] && set -x