mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-03 03:59:16 +01:00
More code generation changes; remove trailing whitespace
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4772 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
058bb60e26
commit
2e949f5aa8
@ -5431,8 +5431,9 @@ __EOF__
|
||||
#
|
||||
if strip_file_and_lib_load providers providers; then
|
||||
setup_providers $(find_file providers)
|
||||
[ -n "$ROUTEMARK_INTERFACES" ] && setup_routes
|
||||
[ -n "$ROUTEMARK_INTERFACES" ] && setup_route_marking
|
||||
else
|
||||
save_command
|
||||
save_command undo_routing
|
||||
save_command restore_default_route
|
||||
fi
|
||||
|
@ -758,6 +758,14 @@ find_first_interface_address_if_any() # $1 = interface
|
||||
[ -n "$addr" ] && echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//' || echo 0.0.0.0
|
||||
}
|
||||
|
||||
#
|
||||
# Determine if interface is usable from a Netfilter prespective
|
||||
#
|
||||
interface_is_usable() # $1 = interface
|
||||
{
|
||||
interface_is_up $1 && [ "\$(find_first_interface_address_if_any $1)" != 0.0.0.0 ]
|
||||
}
|
||||
|
||||
#
|
||||
# Find interface addresses--returns the set of addresses assigned to the passed
|
||||
# device
|
||||
|
@ -227,7 +227,7 @@ setup_mac_lists() # $1 = Phase Number
|
||||
if [ -n "$MACLIST_LOG_LEVEL" -o $MACLIST_DISPOSITION != ACCEPT ]; then
|
||||
indent >&3 << __EOF__
|
||||
|
||||
if interface_is_up $interface && [ "\$(find_first_interface_address_if_any $interface)" != 0.0.0.0 ]; then
|
||||
if interface_is_usable $interface; then
|
||||
ip -f inet addr show $interface 2> /dev/null | grep 'inet.*brd' | sed 's/inet //; s/brd //; s/scope.*//;' | while read address broadcast; do
|
||||
address=\${address%/*}
|
||||
if [ -n "\$broadcast" ]; then
|
||||
|
@ -113,7 +113,7 @@ __EOF__
|
||||
# Add Provider $table ($number)
|
||||
#
|
||||
__EOF__
|
||||
save_command "if interface_is_up $interface && [ \"\$(find_first_interface_address_if_any $interface)\" != 0.0.0.0 ]; then"
|
||||
save_command "if interface_is_usable $interface; then"
|
||||
save_indent1="$INDENT"
|
||||
INDENT="$INDENT "
|
||||
|
||||
@ -417,9 +417,9 @@ __EOF__
|
||||
}
|
||||
|
||||
#
|
||||
# Set up Routing
|
||||
# Set up Route marking (Only called if $ROUTEMARK_INTERFACES is non-empty)
|
||||
#
|
||||
setup_routes()
|
||||
setup_route_marking()
|
||||
{
|
||||
local mask=0xFF mark_op="--set-mark" save_indent="$INDENT"
|
||||
|
||||
@ -429,7 +429,6 @@ setup_routes()
|
||||
run_iptables -t mangle -A OUTPUT -m connmark ! --mark 0/$mask -j CONNMARK --restore-mark --mask $mask
|
||||
createmanglechain routemark
|
||||
|
||||
if [ -n "$ROUTEMARK_INTERFACES" ]; then
|
||||
for interface in $ROUTEMARK_INTERFACES ; do
|
||||
iface=$(chain_base $interface)
|
||||
eval mark_value=\$${iface}_routemark
|
||||
@ -444,7 +443,6 @@ setup_routes()
|
||||
done
|
||||
|
||||
save_command
|
||||
fi
|
||||
|
||||
run_iptables -t mangle -A routemark -m mark ! --mark 0/$mask -j CONNMARK --save-mark --mask $mask
|
||||
|
||||
|
@ -179,7 +179,7 @@ setup_traffic_shaping()
|
||||
|
||||
dev=$(chain_base $device)
|
||||
|
||||
save_command "if qt ip link ls dev $device; then"
|
||||
save_command "if interface_is_usable $device; then"
|
||||
indent="$INDENT"
|
||||
INDENT="$INDENT "
|
||||
save_command ${dev}_exists=Yes
|
||||
@ -202,7 +202,7 @@ setup_traffic_shaping()
|
||||
INDENT="$indent"
|
||||
save_command else
|
||||
INDENT="$INDENT "
|
||||
save_command error_message "\"WARNING: Device $device not found -- traffic-shaping configuration skipped\""
|
||||
save_command error_message "\"WARNING: Device $device not up and configured -- traffic-shaping configuration skipped\""
|
||||
save_command "${dev}_exists="
|
||||
INDENT="$indent"
|
||||
save_command "fi"
|
||||
@ -282,6 +282,12 @@ setup_traffic_shaping()
|
||||
return 0
|
||||
}
|
||||
|
||||
finish_device() {
|
||||
INDENT="$indent"
|
||||
save_command fi
|
||||
save_command
|
||||
}
|
||||
|
||||
validate_tcdevices_file
|
||||
validate_tcclasses_file
|
||||
|
||||
@ -309,11 +315,8 @@ setup_traffic_shaping()
|
||||
dev=$(chain_base $device)
|
||||
|
||||
if [ "$device" != "$last_device" ]; then
|
||||
if [ -n "$last_device" ]; then
|
||||
INDENT="$indent"
|
||||
save_command fi
|
||||
save_command
|
||||
fi
|
||||
|
||||
[ -n "$last_device" ] && finish_device
|
||||
|
||||
save_command "if [ -n \"\$${dev}_exists\" ] ; then"
|
||||
indent="$INDENT"
|
||||
@ -326,10 +329,6 @@ setup_traffic_shaping()
|
||||
add_tc_class && progress_message " TC Class $tcdev defined."
|
||||
done < $TMP_DIR/tcclasses
|
||||
|
||||
if [ -n "$last_device" ]; then
|
||||
INDENT="$indent"
|
||||
save_command fi
|
||||
save_command
|
||||
fi
|
||||
[ -n "$last_device" ] && finish_device
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user