mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-05 04:58:49 +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
|
if strip_file_and_lib_load providers providers; then
|
||||||
setup_providers $(find_file providers)
|
setup_providers $(find_file providers)
|
||||||
[ -n "$ROUTEMARK_INTERFACES" ] && setup_routes
|
[ -n "$ROUTEMARK_INTERFACES" ] && setup_route_marking
|
||||||
else
|
else
|
||||||
|
save_command
|
||||||
save_command undo_routing
|
save_command undo_routing
|
||||||
save_command restore_default_route
|
save_command restore_default_route
|
||||||
fi
|
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
|
[ -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
|
# Find interface addresses--returns the set of addresses assigned to the passed
|
||||||
# device
|
# device
|
||||||
|
@ -227,7 +227,7 @@ setup_mac_lists() # $1 = Phase Number
|
|||||||
if [ -n "$MACLIST_LOG_LEVEL" -o $MACLIST_DISPOSITION != ACCEPT ]; then
|
if [ -n "$MACLIST_LOG_LEVEL" -o $MACLIST_DISPOSITION != ACCEPT ]; then
|
||||||
indent >&3 << __EOF__
|
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
|
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%/*}
|
address=\${address%/*}
|
||||||
if [ -n "\$broadcast" ]; then
|
if [ -n "\$broadcast" ]; then
|
||||||
|
@ -113,7 +113,7 @@ __EOF__
|
|||||||
# Add Provider $table ($number)
|
# Add Provider $table ($number)
|
||||||
#
|
#
|
||||||
__EOF__
|
__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"
|
save_indent1="$INDENT"
|
||||||
INDENT="$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"
|
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
|
run_iptables -t mangle -A OUTPUT -m connmark ! --mark 0/$mask -j CONNMARK --restore-mark --mask $mask
|
||||||
createmanglechain routemark
|
createmanglechain routemark
|
||||||
|
|
||||||
if [ -n "$ROUTEMARK_INTERFACES" ]; then
|
|
||||||
for interface in $ROUTEMARK_INTERFACES ; do
|
for interface in $ROUTEMARK_INTERFACES ; do
|
||||||
iface=$(chain_base $interface)
|
iface=$(chain_base $interface)
|
||||||
eval mark_value=\$${iface}_routemark
|
eval mark_value=\$${iface}_routemark
|
||||||
@ -444,7 +443,6 @@ setup_routes()
|
|||||||
done
|
done
|
||||||
|
|
||||||
save_command
|
save_command
|
||||||
fi
|
|
||||||
|
|
||||||
run_iptables -t mangle -A routemark -m mark ! --mark 0/$mask -j CONNMARK --save-mark --mask $mask
|
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)
|
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"
|
||||||
INDENT="$INDENT "
|
INDENT="$INDENT "
|
||||||
save_command ${dev}_exists=Yes
|
save_command ${dev}_exists=Yes
|
||||||
@ -202,7 +202,7 @@ setup_traffic_shaping()
|
|||||||
INDENT="$indent"
|
INDENT="$indent"
|
||||||
save_command else
|
save_command else
|
||||||
INDENT="$INDENT "
|
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="
|
save_command "${dev}_exists="
|
||||||
INDENT="$indent"
|
INDENT="$indent"
|
||||||
save_command "fi"
|
save_command "fi"
|
||||||
@ -282,6 +282,12 @@ setup_traffic_shaping()
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finish_device() {
|
||||||
|
INDENT="$indent"
|
||||||
|
save_command fi
|
||||||
|
save_command
|
||||||
|
}
|
||||||
|
|
||||||
validate_tcdevices_file
|
validate_tcdevices_file
|
||||||
validate_tcclasses_file
|
validate_tcclasses_file
|
||||||
|
|
||||||
@ -309,11 +315,8 @@ setup_traffic_shaping()
|
|||||||
dev=$(chain_base $device)
|
dev=$(chain_base $device)
|
||||||
|
|
||||||
if [ "$device" != "$last_device" ]; then
|
if [ "$device" != "$last_device" ]; then
|
||||||
if [ -n "$last_device" ]; then
|
|
||||||
INDENT="$indent"
|
[ -n "$last_device" ] && finish_device
|
||||||
save_command fi
|
|
||||||
save_command
|
|
||||||
fi
|
|
||||||
|
|
||||||
save_command "if [ -n \"\$${dev}_exists\" ] ; then"
|
save_command "if [ -n \"\$${dev}_exists\" ] ; then"
|
||||||
indent="$INDENT"
|
indent="$INDENT"
|
||||||
@ -326,10 +329,6 @@ setup_traffic_shaping()
|
|||||||
add_tc_class && progress_message " TC Class $tcdev defined."
|
add_tc_class && progress_message " TC Class $tcdev defined."
|
||||||
done < $TMP_DIR/tcclasses
|
done < $TMP_DIR/tcclasses
|
||||||
|
|
||||||
if [ -n "$last_device" ]; then
|
[ -n "$last_device" ] && finish_device
|
||||||
INDENT="$indent"
|
|
||||||
save_command fi
|
|
||||||
save_command
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user