]> git.ipfire.org Git - thirdparty/iproute2.git/commit
get_rate: detect 32bit overflows
authorEric Dumazet <eric.dumazet@gmail.com>
Mon, 3 Jun 2013 05:51:33 +0000 (05:51 +0000)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 7 Jun 2013 16:24:56 +0000 (09:24 -0700)
commita303853e844ce4eb755399f811b0d8a8c71c6b88
tree585dc7b561af2ea18ea96362e6c40a52c9d552a4
parent22fa92e3671ccf5165ee1582641054a58bb9718c
get_rate: detect 32bit overflows

On Mon, 2013-06-03 at 16:36 +0100, Ben Hutchings wrote:

> Oops, I read this as being strtol() currently, not strtod().  Currently
> '1.5gbit' will work, but this change will break that.  So I think you
> need to keep bps as a double.

Arg

> Then here I think the check should be *rate != floor(bps), i.e. accept
> rounding down of a non-integer number of bytes but any other change is
> assumed to be overflow.

Thanks Ben, here is v4 then ;)

[PATCH v4] get_rate: detect 32bit overflows

Current rate limit is 34.359.738.360 bit per second, and
unfortunately 40Gbps links are above it.

overflows in get_rate() are currently not detected, and some
users are confused. Let's detect this and complain.

Note that some qdisc are ready to get extended range, but this will
need additional attributes and new iproute2

With help from Ben Hutchings

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
tc/tc_util.c