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-25 version: 0.9.2 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
Chain 01: create a Filter group, f.e. filter
Chain 02: check 3 valid policies, 1 exception
Chain 03: 3 cases OK, 1 Exception
Chain 04: flush filter group, 2 rules and an invalid chain
Chain 05: create a new chain in filtergroup,
Chain 06: create an exsiting chain should fail
Chain 07: insert a rule into an empty chain fails
Chain 08: insert a rule into a non_existing chain fails
Chain 09: insert a rule into a nonempty chain works at start
Chain 10: append a rule to a chain
Chain 11: try to remove a prefined chain
Chain 12: try to remove an existing chain
Chain 13: try an ilegal command
Tables: some first tests for the class
Tables 01: create a Tables object, check chains
Tables 02: nat PREROUTING entry
Tables 03: mangle INPUT entry
Tables 04: raw OUTPUT entry
Tables 05: INPUT to not existing chain
Tables 06: read non existing file
Tables 07: read empty file (in relation to iptables-commands)
Tables 08: read default file: reference-one, check chains