kern/128401: dummynet does not shape traffic with fast io enabled

Mihail Balikov mgb.fbsd at
Sun Oct 26 19:20:02 UTC 2008

>Number:         128401
>Category:       kern
>Synopsis:       dummynet does not shape traffic with fast io enabled
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 26 19:20:01 UTC 2008
>Originator:     Mihail Balikov
>Release:        FreeBSD6, FreeBSD7
Megalan Network
FreeBSD 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Thu Oct 23 10:51:58 EEST 2008     root at  i386

On freebsd7 with hz=2000 dummynet stops shaping traffic after 25 days uptime.
I have tracked down the problem in dummynet io fast code at ip_dummynet.c:1353

        if (q->q_time < curr_time)
                q->numbytes = io_fast ? fs->pipe->bandwidth : 0;

This comparision is incorrect. q->q_time is u_int32_t and curr_time is u_int64_t.
After (1<<32) / hz seconds (~24days when hz=2000) q->q_time is always smaller than curr_time.

This is long standing bug, which also affects on RED.


1) workaround: disable io fast
sysctl net.inet.ip.dummynet.io_fast=0

2) change q_time type to dn_key in ip_dummynet.h. ipfw userland program needs to be recompiled.

3) compare q_time with (curr_time & 0xffffffff). RED code (red_drops()) also should be revised.


More information about the freebsd-bugs mailing list