Pre-process standard files up front

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5070 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-12-09 19:01:42 +00:00
parent 14839970ba
commit 7d68533ab2
11 changed files with 89 additions and 117 deletions

View File

@ -479,11 +479,7 @@ validate_policy()
fi fi
done done
strip_file policy
while read client server policy loglevel synparams; do while read client server policy loglevel synparams; do
expandv client server policy loglevel synparams
clientwild= clientwild=
serverwild= serverwild=
@ -815,15 +811,12 @@ setup_ecn() # $1 = file name
local hosts= local hosts=
local h local h
strip_file ecn $1
if [ -s ${TMP_DIR}/ecn ]; then if [ -s ${TMP_DIR}/ecn ]; then
save_progress_message "Setting up ECN..." save_progress_message "Setting up ECN..."
progress_message2 "$DOING $1..." progress_message2 "$DOING $1..."
while read interface host; do while read interface host; do
expandv interface host
list_search $interface $ALL_INTERFACES || \ list_search $interface $ALL_INTERFACES || \
fatal_error "Unknown interface $interface" fatal_error "Unknown interface $interface"
list_search $interface $interfaces || \ list_search $interface $interfaces || \
@ -909,7 +902,7 @@ setup_tc1() {
# #
# Process the TC Rules File # Process the TC Rules File
# #
if [ -n "$LIB_tcrules_LOADED" ]; then if [ -s $TMP_DIR/tcrules ]; then
save_progress_message "Setting up TC Rules..." save_progress_message "Setting up TC Rules..."
save_command setup_tc_rules save_command setup_tc_rules
save_command save_command
@ -2084,11 +2077,9 @@ process_rule() # $1 = target
else else
loglevel="${target#*:}" loglevel="${target#*:}"
target="${target%%:*}" target="${target%%:*}"
expandv loglevel
if [ "$loglevel" != "${loglevel%:*}" ]; then if [ "$loglevel" != "${loglevel%:*}" ]; then
logtag="${loglevel#*:}" logtag="${loglevel#*:}"
loglevel="${loglevel%:*}" loglevel="${loglevel%:*}"
expandv logtag
fi fi
case $loglevel in case $loglevel in
@ -2430,8 +2421,6 @@ process_macro() # $1 = target
progress_message "..Expanding Macro $(find_file macro.${itarget%%:*})..." progress_message "..Expanding Macro $(find_file macro.${itarget%%:*})..."
while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do
expandv mtarget mclients mservers mprotocol mports mcports mratelimit muserspec
mtarget=$(merge_levels $itarget $mtarget) mtarget=$(merge_levels $itarget $mtarget)
case $mtarget in case $mtarget in
@ -2550,8 +2539,6 @@ process_rules()
{ {
local intrazone= local intrazone=
expandv xprotocol xports xcports xaddress xratelimit xuserspec
if [ -z "$SECTIONS" ]; then if [ -z "$SECTIONS" ]; then
finish_section ESTABLISHED,RELATED finish_section ESTABLISHED,RELATED
SECTIONS="ESTABLISHED RELATED NEW" SECTIONS="ESTABLISHED RELATED NEW"
@ -2612,8 +2599,6 @@ process_rules()
} }
while read xtarget xclients xservers xprotocol xports xcports xaddress xratelimit xuserspec; do while read xtarget xclients xservers xprotocol xports xcports xaddress xratelimit xuserspec; do
expandv xtarget xclients xservers
if [ "x$xclients" = xnone -o "x$servers" = xnone ]; then if [ "x$xclients" = xnone -o "x$servers" = xnone ]; then
rule="$xtarget $xclients $xservers $xprotocol $xports $xcports $xaddress $xratelimit $xuserspec" rule="$xtarget $xclients $xservers $xprotocol $xports $xcports $xaddress $xratelimit $xuserspec"
progress_message " Rule \"$rule\" ignored." progress_message " Rule \"$rule\" ignored."
@ -2745,7 +2730,6 @@ process_default_macro() # $1 = macro name
progress_message "..Expanding Default Macro $f into chain $macro..." progress_message "..Expanding Default Macro $f into chain $macro..."
while read target client server protocol port cport ratelimit userspec; do while read target client server protocol port cport ratelimit userspec; do
expandv target client server protocol port cport ratelimit userspec
rule="$target ${client:--} ${server:--} ${protocol:--} ${port:--} ${cport:--} ${ratelimit:--} ${userspec:--}" rule="$target ${client:--} ${server:--} ${protocol:--} ${port:--} ${cport:--} ${ratelimit:--} ${userspec:--}"
case $target in case $target in
@ -2993,8 +2977,6 @@ process_tos() # $1 = name of tos file
stdchain=FORWARD stdchain=FORWARD
fi fi
strip_file tos $1
if [ -s $TMP_DIR/tos ] ; then if [ -s $TMP_DIR/tos ] ; then
save_progress_message "Setting up TOS..." save_progress_message "Setting up TOS..."
@ -3005,7 +2987,6 @@ process_tos() # $1 = name of tos file
createmanglechain outtos createmanglechain outtos
while read src dst protocol sport dport tos; do while read src dst protocol sport dport tos; do
expandv src dst protocol sport dport tos
rule="$(echo $src $dst $protocol $sport $dport $tos)" rule="$(echo $src $dst $protocol $sport $dport $tos)"
process_tos_rule process_tos_rule
done < $TMP_DIR/tos done < $TMP_DIR/tos
@ -3308,7 +3289,6 @@ process_blacklist()
[ "$disposition" = REJECT ] && disposition=reject [ "$disposition" = REJECT ] && disposition=reject
strip_file blacklist $f
progress_message2 "Compiling $f..." progress_message2 "Compiling $f..."
cat >&3 << __EOF__ cat >&3 << __EOF__
@ -3321,7 +3301,6 @@ __EOF__
INDENT=" " INDENT=" "
while read networks protocol ports; do while read networks protocol ports; do
expandv networks protocol ports
process_blacklist_rec process_blacklist_rec
done < $TMP_DIR/blacklist done < $TMP_DIR/blacklist
@ -3506,8 +3485,6 @@ __EOF__
save_progress_message "Setting up RFC1918 Filtering..." save_progress_message "Setting up RFC1918 Filtering..."
strip_file rfc1918
createchain norfc1918 no createchain norfc1918 no
createchain rfc1918 no createchain rfc1918 no
@ -5117,15 +5094,12 @@ __EOF__
determine_interfaces determine_interfaces
determine_hosts determine_hosts
if strip_file_and_lib_load tcrules tcrules; then if [ -s $TMP_DIR/tcrules ]; then
progress_message2 "Compiling $(find_file tcrules)..." progress_message2 "Compiling $(find_file tcrules)..."
process_tc_rules process_tc_rules
fi fi
if [ "$TC_ENABLED" = Internal ]; then if [ "$TC_ENABLED" = Internal ]; then
strip_file_and_lib_load tcdevices tc
strip_file_and_lib_load tcclasses tc
[ -n "$LIB_tc_LOADED" ] && setup_traffic_shaping [ -n "$LIB_tc_LOADED" ] && setup_traffic_shaping
fi fi
@ -5181,9 +5155,6 @@ __EOF__
append_file init append_file init
strip_file rules
strip_file maclist
TERMINATOR=fatal_error TERMINATOR=fatal_error
deletechain shorewall deletechain shorewall
@ -5278,8 +5249,6 @@ __EOF__
progress_message2 "$DOING $f ..." progress_message2 "$DOING $f ..."
strip_file routestopped $f
process_routestopped -A process_routestopped -A
if [ -n "$DISABLE_IPV6" ]; then if [ -n "$DISABLE_IPV6" ]; then
@ -5302,7 +5271,7 @@ __EOF__
run_iptables -A $chain -p udp --dport 53 -j ACCEPT run_iptables -A $chain -p udp --dport 53 -j ACCEPT
done done
strip_file_and_lib_load accounting accounting && setup_accounting $(find_file accounting) [ -n "$LIB_accounting_LOADED" ] && setup_accounting $(find_file accounting)
createchain reject no createchain reject no
createchain dynamic no createchain dynamic no
@ -5345,7 +5314,7 @@ __EOF__
createchain $(out_chain $interface) no createchain $(out_chain $interface) no
done done
if strip_file_and_lib_load proxyarp proxyarp; then if [ -s $TMP_DIR/proxyarp ]; then
progress_message2 "$DOING Proxy ARP" progress_message2 "$DOING Proxy ARP"
setup_proxy_arp setup_proxy_arp
else else
@ -5355,7 +5324,7 @@ __EOF__
# #
# [re]-Establish routing # [re]-Establish routing
# #
if strip_file_and_lib_load providers providers; then if [ -s $TMP_DIR/providers ]; then
setup_providers $(find_file providers) setup_providers $(find_file providers)
[ -n "$ROUTEMARK_INTERFACES" ] && setup_route_marking [ -n "$ROUTEMARK_INTERFACES" ] && setup_route_marking
else else
@ -5364,14 +5333,15 @@ __EOF__
save_command restore_default_route save_command restore_default_route
fi fi
if strip_file_and_lib_load nat nat; then
if [ -s $TMP_DIR/nat ]; then
progress_message2 "$DOING NAT..." progress_message2 "$DOING NAT..."
setup_nat setup_nat
else else
> $STATEDIR/nat > $STATEDIR/nat
fi fi
if strip_file_and_lib_load netmap nat; then if [ -s $TMP_DIR/netmap ]; then
progress_message2 "$DOING NETMAP..." progress_message2 "$DOING NETMAP..."
setup_netmap setup_netmap
fi fi
@ -5396,7 +5366,7 @@ __EOF__
save_progress_message "Setting up Rules..." save_progress_message "Setting up Rules..."
process_rules process_rules
if strip_file_and_lib_load tunnels tunnels; then if [ -s $TMP_DIR/tunnels ]; then
tunnels=$(find_file tunnels) tunnels=$(find_file tunnels)
progress_message2 "$DOING $tunnels..." progress_message2 "$DOING $tunnels..."
save_progress_message "Setting up Tunnels..." save_progress_message "Setting up Tunnels..."
@ -5428,7 +5398,7 @@ __EOF__
progress_message2 "$DOING $(find_file policy)..."; apply_policy_rules progress_message2 "$DOING $(find_file policy)..."; apply_policy_rules
if strip_file_and_lib_load masq nat; then if [ -s $TMP_DIR/nat ]; then
setup_masq $(find_file masq) setup_masq $(find_file masq)
fi fi

View File

@ -242,7 +242,6 @@ setup_accounting() # $1 = Name of accounting file
strip_file accounting $1 strip_file accounting $1
while read action chain source dest proto port sport user ; do while read action chain source dest proto port sport user ; do
expandv action chain source dest proto port sport user
process_accounting_rule process_accounting_rule
done < $TMP_DIR/accounting done < $TMP_DIR/accounting

View File

@ -329,11 +329,9 @@ process_action() # $1 = chain (Chain to add the rules to)
else else
loglevel="${target#*:}" loglevel="${target#*:}"
target="${target%%:*}" target="${target%%:*}"
expandv loglevel
if [ "$loglevel" != "${loglevel%:*}" ]; then if [ "$loglevel" != "${loglevel%:*}" ]; then
logtag="${loglevel#*:}" logtag="${loglevel#*:}"
loglevel="${loglevel%:*}" loglevel="${loglevel%:*}"
expandv logtag
fi fi
case $loglevel in case $loglevel in
@ -588,7 +586,6 @@ process_actions1() {
progress_message2 " Pre-processing $fn..." progress_message2 " Pre-processing $fn..."
strip_file $f $fn strip_file $f $fn
while read xtarget xclients xservers xprotocol xports xcports xratelimit $xuserspec; do while read xtarget xclients xservers xprotocol xports xcports xratelimit $xuserspec; do
expandv xtarget
temp="${xtarget%%:*}" temp="${xtarget%%:*}"
case "$temp" in case "$temp" in
ACCEPT|DROP|REJECT|LOG|QUEUE|CONTINUE) ACCEPT|DROP|REJECT|LOG|QUEUE|CONTINUE)
@ -630,7 +627,6 @@ process_actions1() {
progress_message " ..Expanding Macro $fn..." progress_message " ..Expanding Macro $fn..."
while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do
expandv mtarget
temp="${mtarget%%:*}" temp="${mtarget%%:*}"
case "$temp" in case "$temp" in
ACCEPT|DROP|REJECT|LOG|QUEUE|CONTINUE|PARAM) ACCEPT|DROP|REJECT|LOG|QUEUE|CONTINUE|PARAM)
@ -726,7 +722,6 @@ process_action3() {
progress_message2 "$DOING $(find_file $f) for Chain $xchain..." progress_message2 "$DOING $(find_file $f) for Chain $xchain..."
while read xtarget xclients xservers xprotocol xports xcports xratelimit xuserspec; do while read xtarget xclients xservers xprotocol xports xcports xratelimit xuserspec; do
expandv xtarget
# #
# Generate the target:level:tag to pass to process_action() # Generate the target:level:tag to pass to process_action()
# #
@ -768,8 +763,6 @@ process_action3() {
;; ;;
esac esac
expandv xclients xservers xprotocol xports xcports xratelimit xuserspec
if [ -n "$is_macro" ]; then if [ -n "$is_macro" ]; then
xtarget1=$(map_old_action $xtarget1) xtarget1=$(map_old_action $xtarget1)
@ -783,7 +776,6 @@ process_action3() {
progress_message "..Expanding Macro $(find_file macro.$xtarget1)..." progress_message "..Expanding Macro $(find_file macro.$xtarget1)..."
while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do
expandv mtarget mclients mservers mprotocol mports mcports mratelimit muserspec
mtarget=$(merge_levels $xaction2 $mtarget) mtarget=$(merge_levels $xaction2 $mtarget)

View File

@ -179,20 +179,6 @@ expand() # $@ = contents of variable which may be the name of another variable
eval echo \"$@\" eval echo \"$@\"
} }
#
# Perform variable substitition on the values of the passed list of variables
#
expandv() # $* = list of variable names
{
local varval
while [ $# -gt 0 ]; do
eval varval=\$${1}
eval $1=\"$varval\"
shift
done
}
# #
# Add whitespace after leading "!" # Add whitespace after leading "!"
# #
@ -215,6 +201,30 @@ fix_bang()
echo $result echo $result
} }
#
# Read the zones file and find the firewall zone
#
get_firewall_zone() {
local zone type rest comment='#*' f=$(find_file zones)
[ -f $f ] || startup_error "Unable to find zones file"
while read zone type rest; do
case $zone in
$comment)
;;
*)
if [ "x$type" = xfirewall ]; then
FW=$zone
return
fi
;;
esac
done < $f
startup_error "No firewall zone defined"
}
# #
# This function assumes that the TMP_DIR variable is set and that # This function assumes that the TMP_DIR variable is set and that
# its value names an existing directory. # its value names an existing directory.
@ -241,17 +251,13 @@ determine_zones()
fi fi
} }
strip_file zones
ZONES= ZONES=
IPV4_ZONES= IPV4_ZONES=
IPSEC_ZONES= IPSEC_ZONES=
[ "$IPSECFILE" = zones ] && new_zone_file=Yes || test -n "${FW:=fw}" [ "$IPSECFILE" = zones ] && new_zone_file=Yes
while read zone type rest; do while read zone type rest; do
expandv zone type
case $zone in case $zone in
*:*) *:*)
parents=${zone#*:} parents=${zone#*:}
@ -334,7 +340,6 @@ validate_interfaces_file() {
local z interface networks options r iface option local z interface networks options r iface option
while read z interface networks options; do while read z interface networks options; do
expandv z interface networks options
r="$z $interface $networks $options" r="$z $interface $networks $options"
[ "x$z" = "x-" ] && z= [ "x$z" = "x-" ] && z=
@ -495,20 +500,16 @@ setup_ipsec() {
progress_message "$DOING IPSEC..." progress_message "$DOING IPSEC..."
[ $PROGRAM = compiler -a -n "$IPSEC_ZONES" ] && save_progress_message "Setting up IPSEC management..." [ $PROGRAM = compiler -a -n "$IPSEC_ZONES" ] && save_progress_message "Setting up IPSEC management..."
;; ;;
*) ipsec)
f=$IPSECFILE
strip_file $f
using_ipsec=Yes using_ipsec=Yes
if [ -s ${TMP_DIR}/$f ]; then if [ -s ${TMP_DIR}/ipsec ]; then
progress_message "$DOING $f..." progress_message "$DOING ipsec..."
[ $PROGRAM = compiler ] && save_progress_message "Setting up IPSEC management..." [ $PROGRAM = compiler ] && save_progress_message "Setting up IPSEC management..."
fi fi
;; ;;
esac esac
while read zone type options in_options out_options mss; do while read zone type options in_options out_options mss; do
expandv zone type options in_options out_options mss
if [ -n "$using_ipsec" ]; then if [ -n "$using_ipsec" ]; then
validate_zone1 $zone || fatal_error "Unknown zone: $zone" validate_zone1 $zone || fatal_error "Unknown zone: $zone"
fi fi
@ -551,7 +552,6 @@ validate_hosts_file() {
} }
while read z hosts options; do while read z hosts options; do
expandv z hosts options
r="$z $hosts $options" r="$z $hosts $options"
validate_zone1 $z || startup_error "Invalid zone ($z) in record \"$r\"" validate_zone1 $z || startup_error "Invalid zone ($z) in record \"$r\""
@ -1137,7 +1137,6 @@ find_hosts() # $1 = host zone
while read z hosts options; do while read z hosts options; do
if [ "x$(expand $z)" = "x$1" ]; then if [ "x$(expand $z)" = "x$1" ]; then
expandv hosts
interface=${hosts%%:*} interface=${hosts%%:*}
addresses=${hosts#*:} addresses=${hosts#*:}
case $addresses in case $addresses in
@ -1166,8 +1165,7 @@ find_exclusions() # $1 = host zone
local hosts interface address addresses local hosts interface address addresses
while read z hosts options; do while read z hosts options; do
if [ "x$(expand $z)" = "x$1" ]; then if [ "x$z" = "x$1" ]; then
expandv hosts
interface=${hosts%%:*} interface=${hosts%%:*}
addresses=${hosts#*:} addresses=${hosts#*:}
case $addresses in case $addresses in
@ -1335,11 +1333,9 @@ find_hosts_by_option() # $1 = option
local ignore hosts interface address addresses options ipsec= list local ignore hosts interface address addresses options ipsec= list
while read ignore hosts options; do while read ignore hosts options; do
expandv options
list=$(separate_list $options) list=$(separate_list $options)
if list_search $1 $list; then if list_search $1 $list; then
list_search ipsec $list && ipsec=ipsec || ipsec=none list_search ipsec $list && ipsec=ipsec || ipsec=none
expandv hosts
interface=${hosts%%:*} interface=${hosts%%:*}
addresses=${hosts#*:} addresses=${hosts#*:}
for address in $(separate_list $addresses); do for address in $(separate_list $addresses); do
@ -1362,7 +1358,6 @@ process_routestopped() # $1 = command
local hosts= interface host host1 options networks source= dest= matched local hosts= interface host host1 options networks source= dest= matched
while read interface host options; do while read interface host options; do
expandv interface host options
[ "x$host" = "x-" -o -z "$host" ] && host=0.0.0.0/0 [ "x$host" = "x-" -o -z "$host" ] && host=0.0.0.0/0
for h in $(separate_list $host); do for h in $(separate_list $host); do
hosts="$hosts $interface:$h" hosts="$hosts $interface:$h"
@ -1438,11 +1433,7 @@ process_criticalhosts()
{ {
local hosts= interface host h options networks criticalhosts= local hosts= interface host h options networks criticalhosts=
strip_file routestopped
while read interface host options; do while read interface host options; do
expandv interface host options
[ "x$host" = "x-" -o -z "$host" ] && host=0.0.0.0/0 || host=$(separate_list $host) [ "x$host" = "x-" -o -z "$host" ] && host=0.0.0.0/0 || host=$(separate_list $host)
if [ -n "$options" ]; then if [ -n "$options" ]; then
@ -1574,7 +1565,7 @@ read_file() # $1 = file name, $2 = nest count
error_message "WARNING: INCLUDE in $1 ignored (nested too deeply)" error_message "WARNING: INCLUDE in $1 ignored (nested too deeply)"
fi fi
else else
echo "$first $rest" echo "$(expand $first $rest)"
fi fi
done < $1 done < $1
else else
@ -1888,7 +1879,7 @@ do_initialize() {
f=$(find_file capabilities) f=$(find_file capabilities)
if [ -f $f ] && . $f || determine_capabilities [ -f $f ] && . $f || determine_capabilities
else else
f=$(find_file capabilities) f=$(find_file capabilities)
@ -1896,6 +1887,8 @@ do_initialize() {
[ -f $f ] && . $f || fatal_error "The -e flag requires a capabilities file" [ -f $f ] && . $f || fatal_error "The -e flag requires a capabilities file"
fi fi
ADD_IP_ALIASES="$(added_param_value_yes ADD_IP_ALIASES $ADD_IP_ALIASES)"
if [ -n "${LOGRATE}${LOGBURST}" ]; then if [ -n "${LOGRATE}${LOGBURST}" ]; then
LOGLIMIT="--match limit" LOGLIMIT="--match limit"
[ -n "$LOGRATE" ] && LOGLIMIT="$LOGLIMIT --limit $LOGRATE" [ -n "$LOGRATE" ] && LOGLIMIT="$LOGLIMIT --limit $LOGRATE"
@ -2021,14 +2014,6 @@ do_initialize() {
[ -n "$HIGH_ROUTE_MARKS" -a -z "$XCONNMARK" ] && fatal_error "HIGH_ROUTE_MARKS=Yes requires extended CONNMARK target, extended CONNMARK match support and extended MARK support" [ -n "$HIGH_ROUTE_MARKS" -a -z "$XCONNMARK" ] && fatal_error "HIGH_ROUTE_MARKS=Yes requires extended CONNMARK target, extended CONNMARK match support and extended MARK support"
case ${IPSECFILE:=ipsec} in
ipsec|zones)
;;
*)
fatal_error "Invalid value ($IPSECFILE) for IPSECFILE option"
;;
esac
case ${MACLIST_TABLE:=filter} in case ${MACLIST_TABLE:=filter} in
filter) filter)
;; ;;
@ -2098,11 +2083,6 @@ do_initialize() {
;; ;;
esac esac
# #
# Strip the files that we use often
#
strip_file interfaces
strip_file hosts
#
# Check out the user's shell # Check out the user's shell
# #
[ -n "${SHOREWALL_SHELL:=/bin/sh}" ] [ -n "${SHOREWALL_SHELL:=/bin/sh}" ]
@ -2118,4 +2098,50 @@ do_initialize() {
fi fi
qt mywhich awk && HAVEAWK=Yes || HAVEAWK= qt mywhich awk && HAVEAWK=Yes || HAVEAWK=
case ${IPSECFILE:=ipsec} in
ipsec)
[ -n "${FW:=fw}" ]
strip_file ipsec
;;
zones)
get_firewall_zone
;;
*)
fatal_error "Invalid value ($IPSECFILE) for IPSECFILE option"
;;
esac
strip_file zones
strip_file routestopped
strip_file interfaces
strip_file hosts
if [ $PROGRAM = compiler ]; then
strip_file_and_lib_load accounting accounting
strip_file blacklist
strip_file ecn
strip_file maclist
strip_file_and_lib_load masq nat
strip_file_and_lib_load nat nat
strip_file_and_lib_load netmap nat
strip_file policy
strip_file_and_lib_load providers providers
strip_file_and_lib_load proxyarp proxyarp
strip_file rfc1918
strip_file routestopped
strip_file rules
if [ "$TC_ENABLED" = Internal ]; then
strip_file_and_lib_load tcdevices tc
strip_file_and_lib_load tcclasses tc
fi
strip_file_and_lib_load tcrules tcrules
strip_file tos
strip_file_and_lib_load tunnels tunnels
fi
FW=
} }

View File

@ -114,7 +114,6 @@ setup_mac_lists() # $1 = Phase Number
# Process the maclist file producing the verification rules # Process the maclist file producing the verification rules
# #
while read disposition interface mac addresses; do while read disposition interface mac addresses; do
expandv disposition interface mac addresses
level= level=

View File

@ -432,7 +432,6 @@ __EOF__
save_progress_message "Setting up Masquerading/SNAT..." save_progress_message "Setting up Masquerading/SNAT..."
while read fullinterface networks addresses proto ports ipsec; do while read fullinterface networks addresses proto ports ipsec; do
expandv fullinterface networks addresses proto ports ipsec
if [ -n "$NAT_ENABLED" ]; then if [ -n "$NAT_ENABLED" ]; then
if [ "x$fullinterface" = xCOMMENT ]; then if [ "x$fullinterface" = xCOMMENT ]; then
if [ -n "$COMMENTS" ]; then if [ -n "$COMMENTS" ]; then
@ -530,7 +529,6 @@ setup_nat() {
save_progress_message "Setting up one-to-one NAT..." save_progress_message "Setting up one-to-one NAT..."
while read external interface internal allints localnat; do while read external interface internal allints localnat; do
expandv external interface internal allints localnat
if [ "x$external" = xCOMMENT ]; then if [ "x$external" = xCOMMENT ]; then
if [ -n "$COMMENTS" ]; then if [ -n "$COMMENTS" ]; then
@ -560,7 +558,6 @@ setup_nat() {
setup_netmap() { setup_netmap() {
while read type net1 interface net2 ; do while read type net1 interface net2 ; do
expandv type net1 interface net2
list_search $interface $ALL_INTERFACES || \ list_search $interface $ALL_INTERFACES || \
fatal_error "Unknown interface $interface in entry \"$type $net1 $interface $net2\"" fatal_error "Unknown interface $interface in entry \"$type $net1 $interface $net2\""

View File

@ -347,7 +347,6 @@ __EOF__
save_command "DEFAULT_ROUTE=" save_command "DEFAULT_ROUTE="
while read table number mark duplicate interface gateway options copy; do while read table number mark duplicate interface gateway options copy; do
expandv table number mark duplicate interface gateway options copy
provider="$table $number $mark $duplicate $interface $gateway $options $copy" provider="$table $number $mark $duplicate $interface $gateway $options $copy"
add_a_provider add_a_provider
PROVIDERS="$PROVIDERS $table" PROVIDERS="$PROVIDERS $table"
@ -405,7 +404,6 @@ __EOF__
save_command save_command
while read source dest provider priority; do while read source dest provider priority; do
expandv source dest provider priority
rule="$source $dest $priority $provider" rule="$source $dest $priority $provider"
add_an_rtrule add_an_rtrule
done < $TMP_DIR/route_rules done < $TMP_DIR/route_rules

View File

@ -101,7 +101,6 @@ __EOF__
save_progress_message "Setting up Proxy ARP..." save_progress_message "Setting up Proxy ARP..."
while read address interface external haveroute persistent; do while read address interface external haveroute persistent; do
expandv address interface external haveroute persistent
list_search $interface $setlist || setlist="$setlist $interface" list_search $interface $setlist || setlist="$setlist $interface"
list_search $external $resetlist || list_search $external $setlist || resetlist="$resetlist $external" list_search $external $resetlist || list_search $external $setlist || resetlist="$resetlist $external"
setup_one_proxy_arp setup_one_proxy_arp

View File

@ -76,7 +76,6 @@ setup_traffic_shaping()
get_outband_for_dev() { get_outband_for_dev() {
local device inband outband local device inband outband
while read device inband outband; do while read device inband outband; do
expandv device inband outband
tcdev="$device $inband $outband" tcdev="$device $inband $outband"
if [ "$1" = "$device" ] ; then if [ "$1" = "$device" ] ; then
echo $outband echo $outband
@ -107,7 +106,6 @@ setup_traffic_shaping()
searchdev=$1 searchdev=$1
while read device mark rate ceil prio options; do while read device mark rate ceil prio options; do
expandv device mark rate ceil prio options
options=$(separate_list $options | tr '[A-Z]' '[a-z]') options=$(separate_list $options | tr '[A-Z]' '[a-z]')
tcdev="$device $mark $rate $ceil $prio $options" tcdev="$device $mark $rate $ceil $prio $options"
if [ "$searchdev" = "$device" ] ; then if [ "$searchdev" = "$device" ] ; then
@ -126,7 +124,6 @@ setup_traffic_shaping()
progress_message2 "Validating $devfile..." progress_message2 "Validating $devfile..."
local device local device inband outband local device local device inband outband
while read device inband outband; do while read device inband outband; do
expandv device inband outband
tcdev="$device $inband $outband" tcdev="$device $inband $outband"
check_defmark_for_dev $device || fatal_error "Option default is not defined for any class in tcclasses for interface $device" check_defmark_for_dev $device || fatal_error "Option default is not defined for any class in tcclasses for interface $device"
case $interface in case $interface in
@ -146,7 +143,6 @@ setup_traffic_shaping()
local classlist device mark rate ceil prio bandw wrongopt allopts opt local classlist device mark rate ceil prio bandw wrongopt allopts opt
allopts="" allopts=""
while read device mark rate ceil prio options; do while read device mark rate ceil prio options; do
expandv device mark rate ceil prio options
tcdev="$device $mark $rate $ceil $prio $options" tcdev="$device $mark $rate $ceil $prio $options"
ratew=$(get_outband_for_dev $device) ratew=$(get_outband_for_dev $device)
options=$(separate_list $options | tr '[A-Z]' '[a-z]') options=$(separate_list $options | tr '[A-Z]' '[a-z]')
@ -314,7 +310,6 @@ __EOF__
progress_message2 "$DOING $devfile..." progress_message2 "$DOING $devfile..."
while read device inband outband; do while read device inband outband; do
expandv device inband outband
tcdev="$device $inband $outband" tcdev="$device $inband $outband"
add_root_tc && progress_message " TC Device $tcdev defined." add_root_tc && progress_message " TC Device $tcdev defined."
done < $TMP_DIR/tcdevices done < $TMP_DIR/tcdevices
@ -326,7 +321,6 @@ __EOF__
last_device= last_device=
while read device mark rate ceil prio options; do while read device mark rate ceil prio options; do
expandv device mark rate ceil prio options
tcdev="$device $mark $rate $ceil $prio $options" tcdev="$device $mark $rate $ceil $prio $options"
options=$(separate_list $options | tr '[A-Z]' '[a-z]') options=$(separate_list $options | tr '[A-Z]' '[a-z]')

View File

@ -468,7 +468,6 @@ __EOF__
INDENT=" " INDENT=" "
while read mark sources dests proto ports sports user testval length tos; do while read mark sources dests proto ports sports user testval length tos; do
expandv mark sources dests proto ports sports user testval length tos
if [ "x$mark" = xCOMMENT ]; then if [ "x$mark" = xCOMMENT ]; then
if [ -n "$COMMENTS" ]; then if [ -n "$COMMENTS" ]; then
comment=$(echo $sources $dests $proto $ports $sports $user $testval $length $tos) comment=$(echo $sources $dests $proto $ports $sports $user $testval $length $tos)

View File

@ -226,7 +226,6 @@ setup_tunnels() # $1 = name of tunnels file
strip_file tunnels $1 strip_file tunnels $1
while read kind z gateway z1; do while read kind z gateway z1; do
expandv kind z gateway z1
tunnel="$(echo $kind $z $gateway $z1)" tunnel="$(echo $kind $z $gateway $z1)"
if validate_zone $z; then if validate_zone $z; then
inchain=${z}2${FW} inchain=${z}2${FW}