diff --git a/Shorewall/compiler b/Shorewall/compiler index 14e26c519..422acd1f6 100755 --- a/Shorewall/compiler +++ b/Shorewall/compiler @@ -5540,7 +5540,10 @@ __EOF__ append_file start - [ -n "$DELAYBLACKLISTLOAD" ] && refresh_blacklist + if [ -n "$DELAYBLACKLISTLOAD" ]; then + refresh_blacklist + save_command + fi createchain shorewall no diff --git a/Shorewall/lib.maclist b/Shorewall/lib.maclist index 236eaf302..60dd93ab9 100644 --- a/Shorewall/lib.maclist +++ b/Shorewall/lib.maclist @@ -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_up $interface && [ "\$(find_first_interface_address_if_any $interface)" != 0.0.0.0 ]; 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 diff --git a/Shorewall/lib.tc b/Shorewall/lib.tc index 066f6d433..18264f2ab 100644 --- a/Shorewall/lib.tc +++ b/Shorewall/lib.tc @@ -38,7 +38,7 @@ setup_traffic_shaping() { local mtu r2q tc_all_devices device mark rate ceil prio options devfile=$(find_file tcdevices) classfile=$(find_file tcclasses) devnum=1 last_device= - r2q=10 + r2q=10 indent= rate_to_kbit() { local rateunit rate @@ -175,7 +175,7 @@ setup_traffic_shaping() } add_root_tc() { - local defmark dev indent + local defmark dev dev=$(chain_base $device) @@ -212,13 +212,7 @@ setup_traffic_shaping() } add_tc_class() { - local full classid tospair tosmask quantum indent - - dev=$(chain_base $device) - - save_command "if [ -n \"\$${dev}_exists\" ] ; then" - indent="$INDENT" - INDENT="$INDENT " + local full classid tospair tosmask quantum full=$(get_outband_for_dev $device) full=$(rate_to_kbit $full) @@ -284,9 +278,6 @@ setup_traffic_shaping() done save_progress_message_short " TC Class $tcdev defined." - INDENT="$indent" - save_command fi - save_command return 0 } @@ -308,12 +299,37 @@ setup_traffic_shaping() if [ -s $TMP_DIR/tcclasses ]; then progress_message2 "$DOING $classfile..." + last_device= + while read device mark rate ceil prio options; do expandv device mark rate ceil prio options tcdev="$device $mark $rate $ceil $prio $options" options=$(separate_list $options | tr '[A-Z]' '[a-z]') + + dev=$(chain_base $device) + + if [ "$device" != "$last_device" ]; then + if [ -n "$last_device" ]; then + INDENT="$indent" + save_command fi + save_command + fi + + save_command "if [ -n \"\$${dev}_exists\" ] ; then" + indent="$INDENT" + INDENT="$INDENT " + last_device=$device + else + save_command + fi + add_tc_class && progress_message " TC Class $tcdev defined." - last_device=$device done < $TMP_DIR/tcclasses + + if [ -n "$last_device" ]; then + INDENT="$indent" + save_command fi + save_command + fi fi }