From 39eb7a3d1f474af1271c2c1a482d6ec48f27e8ce Mon Sep 17 00:00:00 2001 From: teastep Date: Mon, 21 Apr 2008 20:09:31 +0000 Subject: [PATCH] Fix rate calculation; restore line inadvertently removed yesterday git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8471 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Chains.pm | 1 + Shorewall-perl/Shorewall/Tc.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Shorewall-perl/Shorewall/Chains.pm b/Shorewall-perl/Shorewall/Chains.pm index 62ee4db21..649a193bc 100644 --- a/Shorewall-perl/Shorewall/Chains.pm +++ b/Shorewall-perl/Shorewall/Chains.pm @@ -1427,6 +1427,7 @@ sub match_source_net( $;$ ) { validate_range $addr1, $addr2; iprange_match . "${invert}--src-range $net "; } elsif ( $net =~ /^(!?)~(.*)$/ ) { + fatal_error "MAC address cannot be used in this context" if $restriction >= OUTPUT_RESTRICT; mac_match $net; } elsif ( $net =~ /^(!?)\+/ ) { require_capability( 'IPSET_MATCH' , 'ipset names in Shorewall configuration files' , '' ); diff --git a/Shorewall-perl/Shorewall/Tc.pm b/Shorewall-perl/Shorewall/Tc.pm index c7bec5bd9..ce7d827af 100644 --- a/Shorewall-perl/Shorewall/Tc.pm +++ b/Shorewall-perl/Shorewall/Tc.pm @@ -311,7 +311,7 @@ sub rate_to_kbit( $ ) { return $1 * 1000 if $rate =~ /^(\d+)mbit$/i; return $1 * 8000 if $rate =~ /^(\d+)mbps$/i; return $1 * 8 if $rate =~ /^(\d+)kbps$/i; - return $1 / 125 if $rate =~ /^(\d+)(bps)?$/; + return int($1/125) if $rate =~ /^(\d+)(bps)?$/; fatal_error "Invalid Rate ($rate)"; }