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;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to