From ba89ec39b53a8f158252356f844d704ca87b670e Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 15 Sep 2010 11:56:14 -0700 Subject: [PATCH] Add : to /etc/shorewall/tcdevices --- Shorewall/Perl/Shorewall/Tc.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Tc.pm b/Shorewall/Perl/Shorewall/Tc.pm index 8188d9ab2..e640f1d18 100644 --- a/Shorewall/Perl/Shorewall/Tc.pm +++ b/Shorewall/Perl/Shorewall/Tc.pm @@ -1307,11 +1307,26 @@ sub setup_traffic_shaping() { qq(fi) ); } - my $inband = rate_to_kbit $devref->{in_bandwidth}; + my $in_burst = '10kb'; + my $inband; + + if ( $devref->{in_bandwidth} =~ /:/ ) { + my ( $in_band, $burst ) = split /:/, $devref->{in_bandwidth}, 2; + + if ( defined $burst && $burst ne '' ) { + fatal_error "Invalid IN-BANDWIDTH" if $burst =~ /:/; + fatal_error "Invalid burst ($burst)" unless $burst =~ /^\d+(k|kb|m|mb|mbit|kbit|b)?$/; + $in_burst = $burst; + } + + $inband = rate_to_kbit( $in_band ); + } else { + $inband = rate_to_kbit $devref->{in_bandwidth}; + } if ( $inband ) { emit ( "run_tc qdisc add dev $device handle ffff: ingress", - "run_tc filter add dev $device parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${inband}kbit burst 10kb drop flowid :1" + "run_tc filter add dev $device parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${inband}kbit burst $in_burst drop flowid :1" ); }