mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-25 23:19:03 +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() {
|
add_root_tc() {
|
||||||
local defmark dev
|
local defmark dev indent
|
||||||
|
|
||||||
dev=$(chain_base $device)
|
dev=$(chain_base $device)
|
||||||
defmark=$(get_defmark_for_dev $device)
|
|
||||||
|
|
||||||
if [ $COMMAND = compile ]; then
|
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 root
|
||||||
save_command qt tc qdisc del dev $device ingress
|
save_command qt tc qdisc del dev $device ingress
|
||||||
|
else
|
||||||
|
qt ip link ls dev $device || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
defmark=$(get_defmark_for_dev $device)
|
||||||
|
|
||||||
run_tc qdisc add dev $device root handle $devnum: htb default 1$defmark
|
run_tc qdisc add dev $device root handle $devnum: htb default 1$defmark
|
||||||
|
|
||||||
if [ $COMMAND = compile ]; then
|
if [ $COMMAND = compile ]; then
|
||||||
@ -1689,10 +1697,35 @@ setup_traffic_shaping()
|
|||||||
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
|
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
|
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() {
|
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=$(get_outband_for_dev $device)
|
||||||
full=$(rate_to_kbit $full)
|
full=$(rate_to_kbit $full)
|
||||||
|
|
||||||
@ -1714,7 +1747,6 @@ setup_traffic_shaping()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dev=$(chain_base $device)
|
|
||||||
eval devnum=\$${dev}_devnum
|
eval devnum=\$${dev}_devnum
|
||||||
#
|
#
|
||||||
# Convert HEX/OCTAL mark representation to decimal
|
# Convert HEX/OCTAL mark representation to decimal
|
||||||
@ -1762,6 +1794,15 @@ setup_traffic_shaping()
|
|||||||
esac
|
esac
|
||||||
run_tc filter add dev $device parent $devnum:0 protocol ip prio 10 u32 match ip tos ${tospair%%/*} $tosmask flowid $classid
|
run_tc filter add dev $device parent $devnum:0 protocol ip prio 10 u32 match ip tos ${tospair%%/*} $tosmask flowid $classid
|
||||||
done
|
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
|
strip_file tcdevices $devfile
|
||||||
@ -1777,8 +1818,7 @@ setup_traffic_shaping()
|
|||||||
while read device inband outband; do
|
while read device inband outband; do
|
||||||
expandv device inband outband
|
expandv device inband outband
|
||||||
tcdev="$device $inband $outband"
|
tcdev="$device $inband $outband"
|
||||||
add_root_tc
|
add_root_tc && progress_message " TC Device $tcdev defined."
|
||||||
progress_message_and_save " TC Device $tcdev defined."
|
|
||||||
done < $TMP_DIR/tcdevices
|
done < $TMP_DIR/tcdevices
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1789,8 +1829,7 @@ setup_traffic_shaping()
|
|||||||
expandv device mark rate ceil prio options
|
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]')
|
||||||
add_tc_class
|
add_tc_class && progress_message " TC Class $tcdev defined."
|
||||||
progress_message_and_save " TC Class $tcdev defined."
|
|
||||||
last_device=$device
|
last_device=$device
|
||||||
done < $TMP_DIR/tcclasses
|
done < $TMP_DIR/tcclasses
|
||||||
fi
|
fi
|
||||||
|
@ -66,6 +66,12 @@ Other changes in 3.2.0 Beta 8
|
|||||||
|
|
||||||
cp -f /usr/share/shorewall/xmodules /etc/modules
|
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:
|
Migration Considerations:
|
||||||
|
|
||||||
1) If you are upgrading from Shorewall 2.x, it is essential that you read
|
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
|
# have multiple ppp interfaces, you need to put
|
||||||
# them all in here!
|
# them all in here!
|
||||||
#
|
#
|
||||||
# Any device listed in this column must exist at the
|
# If the device doesn't exist, a warning message will
|
||||||
# time that Shorewall is [re]started.
|
# 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
|
# IN-BANDWIDTH The incoming Bandwidth of that interface. Please
|
||||||
# note that you are not able to do traffic shaping
|
# note that you are not able to do traffic shaping
|
||||||
|
Loading…
Reference in New Issue
Block a user