convert iptables commands within a script into a correspondig iptables-save script
output is written to stdout for maximum flexibilty
Author: Johannes Hubertz <johannes@hubertz.de> Date: 2013-08-09 version: 0.9 License: GNU General Public License version 3 or later
Have Fun!
this is for one type of tables
fill this line into this tabular
name is one of filter, nat, raw, mangle, tables is a list of tables in that table-class
some chaingroups in tables are predef: filter, nat, mangle, raw
put line into matching Chains-object
read file into Tables-object
all predefined Chains aka lists are setup as new here
printout nonempty tabulars in fixed sequence
main parses options, filnames and the like one option (-s) may be given: input-filename if none given, it defaults to: rules
this is for one type of tables
fill this line into this tabular
name is one of filter, nat, raw, mangle, tables is a list of tables in that table-class
some chaingroups in tables are predef: filter, nat, mangle, raw
put line into matching Chains-object
read file into Tables-object
all predefined Chains aka lists are setup as new here
printout nonempty tabulars in fixed sequence
some tests for class Chain
create a Filter group, f.e. filter
check 3 valid policies, 1 exception
3 cases OK, 1 Exception
flush filter group, 2 rules and an invalid chain
create a new chain in filtergroup, create an exsiting chain should fail
insert a rule into an empty chain fails
insert a rule into a non_existing chain fails
insert a rule into a nonempty chain works at start
append a rule to a chain
try to remove a prefined chain
try to remove an existing chain
try an ilegal command
Tables: some first tests for the class
create a Tables object, check chains
nat PREROUTING entry
mangle INPUT entry
raw OUTPUT entry
INPUT to not existing chain
read non existing file
read default file: reference-one, check chains
read empty file (in relation to iptables-commands)