From owner-svn-src-stable-7@FreeBSD.ORG Fri Oct 31 12:58:12 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93DA11065672; Fri, 31 Oct 2008 12:58:12 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 803D98FC17; Fri, 31 Oct 2008 12:58:12 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9VCwCVC081155; Fri, 31 Oct 2008 12:58:12 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9VCwCb8081154; Fri, 31 Oct 2008 12:58:12 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <200810311258.m9VCwCb8081154@svn.freebsd.org> From: Oleg Bulyzhin Date: Fri, 31 Oct 2008 12:58:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184504 - stable/7/sys/netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2008 12:58:12 -0000 Author: oleg Date: Fri Oct 31 12:58:12 2008 New Revision: 184504 URL: http://svn.freebsd.org/changeset/base/184504 Log: Direct commit (r184414 is not applicable to stable due to ABI change): Workaround possible q_time overflow (will happen after 2^32/(86400*hz) days of uptime (~50days for hz = 1000)), which may lead to: - broken shaping in 'fast' io mode. - incorrect average queue length calculation in RED/GRED algorithm. PR: kern/128401 Approved by: re (kensmith) Modified: stable/7/sys/netinet/ip_dummynet.c Modified: stable/7/sys/netinet/ip_dummynet.c ============================================================================== --- stable/7/sys/netinet/ip_dummynet.c Fri Oct 31 11:47:51 2008 (r184503) +++ stable/7/sys/netinet/ip_dummynet.c Fri Oct 31 12:58:12 2008 (r184504) @@ -1155,7 +1155,8 @@ red_drops(struct dn_flow_set *fs, struct * XXX check wraps... */ if (q->avg) { - u_int t = (curr_time - q->q_time) / fs->lookup_step; + u_int t = ((uint32_t)curr_time - q->q_time) / + fs->lookup_step; q->avg = (t < fs->lookup_depth) ? SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0; @@ -1350,7 +1351,7 @@ dummynet_io(struct mbuf **m0, int dir, s if (q->head != m) /* Flow was not idle, we are done. */ goto done; - if (q->q_time < curr_time) + if (q->q_time < (uint32_t)curr_time) q->numbytes = io_fast ? fs->pipe->bandwidth : 0; q->q_time = curr_time;