mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 22:58:52 +01:00
Detect devices in /etc/shorewall/tcdevices
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3932 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
cbe12e37e3
commit
f1d08e6cf8
@ -1667,15 +1667,23 @@ setup_traffic_shaping()
|
||||
}
|
||||
|
||||
add_root_tc() {
|
||||
local defmark dev
|
||||
local defmark dev indent
|
||||
|
||||
dev=$(chain_base $device)
|
||||
defmark=$(get_defmark_for_dev $device)
|
||||
|
||||
if [ $COMMAND = compile ]; then
|
||||
save_command "if qt ip link ls dev $device; then"
|
||||
indent="$INDENT"
|
||||
INDENT="$INDENT "
|
||||
save_command ${dev}_exists=Yes
|
||||
save_command qt tc qdisc del dev $device root
|
||||
save_command qt tc qdisc del dev $device ingress
|
||||
else
|
||||
qt ip link ls dev $device || return 1
|
||||
fi
|
||||
|
||||
defmark=$(get_defmark_for_dev $device)
|
||||
|
||||
run_tc qdisc add dev $device root handle $devnum: htb default 1$defmark
|
||||
|
||||
if [ $COMMAND = compile ]; then
|
||||
@ -1688,11 +1696,36 @@ setup_traffic_shaping()
|
||||
run_tc qdisc add dev $device handle ffff: ingress
|
||||
run_tc filter add dev $device parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate ${inband} burst 10k drop flowid :1
|
||||
eval ${dev}_devnum=$devnum
|
||||
devnum=$(($devnum + 1))
|
||||
devnum=$(($devnum + 1))
|
||||
|
||||
if [ $COMMAND = compile ]; then
|
||||
save_progress_message_short " TC Device $tcdev defined."
|
||||
INDENT="$indent"
|
||||
save_command else
|
||||
INDENT="$INDENT "
|
||||
save_command error_message "\"WARNING: Device $device not found -- traffic-shaping configuration skipped\""
|
||||
save_command "${dev}_exists="
|
||||
INDENT="$indent"
|
||||
save_command "fi"
|
||||
save_command
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
add_tc_class() {
|
||||
local full classid tospair tosmask quantum
|
||||
local full classid tospair tosmask quantum indent
|
||||
|
||||
dev=$(chain_base $device)
|
||||
|
||||
if [ $COMMAND = compile ]; then
|
||||
save_command "if [ -n \"\$${dev}_exists\" ] ; then"
|
||||
indent="$INDENT"
|
||||
INDENT="$INDENT "
|
||||
else
|
||||
qt ip link ls dev $device || return 1
|
||||
fi
|
||||
|
||||
full=$(get_outband_for_dev $device)
|
||||
full=$(rate_to_kbit $full)
|
||||
|
||||
@ -1714,7 +1747,6 @@ setup_traffic_shaping()
|
||||
;;
|
||||
esac
|
||||
|
||||
dev=$(chain_base $device)
|
||||
eval devnum=\$${dev}_devnum
|
||||
#
|
||||
# Convert HEX/OCTAL mark representation to decimal
|
||||
@ -1762,6 +1794,15 @@ setup_traffic_shaping()
|
||||
esac
|
||||
run_tc filter add dev $device parent $devnum:0 protocol ip prio 10 u32 match ip tos ${tospair%%/*} $tosmask flowid $classid
|
||||
done
|
||||
|
||||
if [ $COMMAND = compile ]; then
|
||||
save_progress_message_short " TC Class $tcdev defined."
|
||||
INDENT="$indent"
|
||||
save_command fi
|
||||
save_command
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
strip_file tcdevices $devfile
|
||||
@ -1777,8 +1818,7 @@ setup_traffic_shaping()
|
||||
while read device inband outband; do
|
||||
expandv device inband outband
|
||||
tcdev="$device $inband $outband"
|
||||
add_root_tc
|
||||
progress_message_and_save " TC Device $tcdev defined."
|
||||
add_root_tc && progress_message " TC Device $tcdev defined."
|
||||
done < $TMP_DIR/tcdevices
|
||||
fi
|
||||
|
||||
@ -1789,8 +1829,7 @@ setup_traffic_shaping()
|
||||
expandv device mark rate ceil prio options
|
||||
tcdev="$device $mark $rate $ceil $prio $options"
|
||||
options=$(separate_list $options | tr '[A-Z]' '[a-z]')
|
||||
add_tc_class
|
||||
progress_message_and_save " TC Class $tcdev defined."
|
||||
add_tc_class && progress_message " TC Class $tcdev defined."
|
||||
last_device=$device
|
||||
done < $TMP_DIR/tcclasses
|
||||
fi
|
||||
|
@ -66,6 +66,12 @@ Other changes in 3.2.0 Beta 8
|
||||
|
||||
cp -f /usr/share/shorewall/xmodules /etc/modules
|
||||
|
||||
3) Shorewall now checks to see if devices in /etc/shorewall/tcdevices
|
||||
exist. If a device does not exist, a warning message is issued and
|
||||
that device's entries in /etc/shorewall/tcclasses are ignored. This
|
||||
applies to "shorewall start", "shorewall restart" and "shorewall
|
||||
refresh".
|
||||
|
||||
Migration Considerations:
|
||||
|
||||
1) If you are upgrading from Shorewall 2.x, it is essential that you read
|
||||
|
@ -24,8 +24,10 @@
|
||||
# have multiple ppp interfaces, you need to put
|
||||
# them all in here!
|
||||
#
|
||||
# Any device listed in this column must exist at the
|
||||
# time that Shorewall is [re]started.
|
||||
# If the device doesn't exist, a warning message will
|
||||
# be issued during "shorewall [re]start" and "shorewall
|
||||
# refresh" and traffic shaping configuration will be
|
||||
# skipped for that device.
|
||||
#
|
||||
# IN-BANDWIDTH The incoming Bandwidth of that interface. Please
|
||||
# note that you are not able to do traffic shaping
|
||||
|
Loading…
Reference in New Issue
Block a user