Correct issues with debugging the generated script

a) Rename DEBUG to g_debug_iptablesb
b) Clear all of the tables prior to handling iptables-restore input.
This commit is contained in:
Tom Eastep 2012-03-05 15:21:10 -08:00
parent 93df86c90a
commit 649f73a360
3 changed files with 17 additions and 2 deletions

View File

@ -6413,7 +6413,7 @@ sub create_netfilter_load( $ ) {
#
emit( 'exec 3>&-',
'',
'[ -n "$DEBUG" ] && command=debug_restore_input || command=$' . $UTILITY,
'[ -n "$g_debug_iptables" ] && command=debug_restore_input || command=$' . $UTILITY,
'',
'progress_message2 "Running $command..."',
'',

View File

@ -62,12 +62,14 @@ checkkernelversion() {
#
# Start trace if first arg is "debug" or "trace"
#
g_debug_iptables=
if [ $# -gt 1 ]; then
if [ "x$1" = "xtrace" ]; then
set -x
shift
elif [ "x$1" = "xdebug" ]; then
DEBUG=Yes
g_debug_iptables=Yes
shift
fi
fi

View File

@ -510,6 +510,19 @@ debug_restore_input() {
qt1 $g_tool -t raw -P $chain ACCEPT
done
qt1 $g_tool -t rawpost -F
qt1 $g_tool -t rawpost -X
for chain in POSTROUTING; do
qt1 $g_tool -t rawpost -P $chain ACCEPT
done
qt1 $g_tool -t nat -F
qt1 $g_tool -t nat -X
for chain in PREROUTING POSTROUTING; do
qt1 $g_tool -t nat -P $chain ACCEPT
qt1 $g_tool -t filter -F
qt1 $g_tool -t filter -X