Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Oct 2008 13:01:32 +0000 (UTC)
From:      Oleg Bulyzhin <oleg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r184506 - releng/6.4/sys/netinet
Message-ID:  <200810311301.m9VD1WeJ081306@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oleg
Date: Fri Oct 31 13:01:31 2008
New Revision: 184506
URL: http://svn.freebsd.org/changeset/base/184506

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:
  releng/6.4/sys/netinet/ip_dummynet.c

Modified: releng/6.4/sys/netinet/ip_dummynet.c
==============================================================================
--- releng/6.4/sys/netinet/ip_dummynet.c	Fri Oct 31 13:00:34 2008	(r184505)
+++ releng/6.4/sys/netinet/ip_dummynet.c	Fri Oct 31 13:01:31 2008	(r184506)
@@ -1186,7 +1186,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;
@@ -1382,7 +1383,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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810311301.m9VD1WeJ081306>