First phase of script reorganization complete

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9295 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2009-01-16 21:31:35 +00:00
parent 5b3a2831c6
commit ac66faf91a

View File

@ -607,7 +607,7 @@ EOF
# Second Phase of Script Generation # Second Phase of Script Generation
# #
# copies the 'prog.functions' file into the script and generates # copies the 'prog.functions' file into the script and generates
# the first part of 'setup_routing_and_traffic_shaping()' # the first part of 'setup_common()'
# #
# The bulk of that function is produced by the various config file # The bulk of that function is produced by the various config file
# parsing routines that are called directly out of 'compiler()'. # parsing routines that are called directly out of 'compiler()'.
@ -626,7 +626,29 @@ sub generate_script_2 () {
} }
emit( "\n#", emit( "\n#",
'# Setup Routing and Traffic Shaping', '# Setup Common Rules',
'#',
'setup_common_rules() {'
);
push_indent;
}
#
# Third step of script generation
#
# - End the setup_common() function
# - Start setup_routing_and_traffic_shaping()
#
sub generate_script_3 () {
pop_indent;
emit '}';
emit( "\n#",
'# Setup routing and traffic shaping',
'#', '#',
'setup_routing_and_traffic_shaping() {' 'setup_routing_and_traffic_shaping() {'
); );
@ -636,7 +658,7 @@ sub generate_script_2 () {
} }
# #
# Third (final) stage of script generation. # Fourth (final) stage of script generation.
# #
# Generate the end of 'setup_routing_and_traffic_shaping()': # Generate the end of 'setup_routing_and_traffic_shaping()':
# Generate code for loading the various files in /var/lib/shorewall[-lite] # Generate code for loading the various files in /var/lib/shorewall[-lite]
@ -648,7 +670,7 @@ sub generate_script_2 () {
# Note: This function is not called when $command eq 'check'. So it must have no side effects other # Note: This function is not called when $command eq 'check'. So it must have no side effects other
# than those related to writing to the object file. # than those related to writing to the object file.
# #
sub generate_script_3($) { sub generate_script_4($) {
emit 'cat > ${VARDIR}/proxyarp << __EOF__'; emit 'cat > ${VARDIR}/proxyarp << __EOF__';
dump_proxy_arp; dump_proxy_arp;
@ -760,7 +782,9 @@ sub generate_script_3($) {
emit ''; emit '';
emit( 'setup_routing_and_traffic_shaping', emit( 'setup_common_rules',
'',
'setup_routing_and_traffic_shaping',
'', '',
'if [ $COMMAND = restore ]; then', 'if [ $COMMAND = restore ]; then',
' iptables_save_file=${VARDIR}/$(basename $0)-iptables', ' iptables_save_file=${VARDIR}/$(basename $0)-iptables',
@ -981,6 +1005,10 @@ sub compiler {
# #
setup_zone_mss; setup_zone_mss;
# #
# Finish setup_common_rules() and start setup_routing_and_traffic_shaping()
#
generate_script_3;
#
# [Re-]establish Routing # [Re-]establish Routing
# #
setup_providers; setup_providers;
@ -1057,7 +1085,7 @@ sub compiler {
# #
# Finish the script. # Finish the script.
# #
generate_script_3( $chains ); generate_script_4( $chains );
finalize_object ( $export ); finalize_object ( $export );
# #
# And generate the auxilary config file # And generate the auxilary config file