[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squid-dev
Subject:    delay_pools.c is buggy in 2.3.STABLE3 :-(
From:       david () luyer ! net
Date:       2000-05-24 18:29:34
Message-ID: 200005241829.EAA10692 () typhaon ! pacific ! net ! au
[Download RAW message or body]


Was reading through the code in 2.3.STABLE3, it's buggy.  It will cause
no traffic to be allocated for host/net 255 in Class3 - Class2 is OK
(and is as I remember coding things... I thought I did them both that
way).

The relevant routines are delayUpdateClass2 and delayUpdateClass3.
Since the "for" loop conditions right above the assert()s guarantee
the assert()s I've removed them from that routine only in the below
patch.

(even though I think they're all a waste :) ... I've only taken out
the 3 extremely obviously never possibly broken ones)

--- delay_pools.c.ORIG  Sat May 13 08:49:07 2000
+++ delay_pools.c       Thu May 25 04:19:52 2000
@@ -486,16 +486,13 @@
        return;
     individual_restore_bytes *= incr;
     network_restore_bytes *= incr;
-    for (i = 0; i < ((class3->network_255_used) ? NET_MAP_SZ : NET_MAP_SZ - 1); ++i) {
-       assert(i < NET_MAP_SZ);
+    for (i = (class3->network_255_used ? 255 : 0); i < (NET_MAP_SZ - 1); ++i) {
        if (i != 255 && class3->network_map[i] == 255)
            return;
        if (individual_restore_bytes != -incr) {
            mpos = i << 8;
            individual_255_used = class3->individual_255_used[i / 8] & (1 << (i % 8));
-           for (j = 0; j < ((individual_255_used) ? IND_MAP_SZ : IND_MAP_SZ - 1); ++j, ++mpos) {
-               assert(i < NET_MAP_SZ);
-               assert(j < IND_MAP_SZ);
+           for (j = (individual_255_used ? 255 : 0); j < (IND_MAP_SZ - 1); ++j, ++mpos) {
                if (j != 255 && class3->individual_map[i][j] == 255)
                    break;
                assert(mpos < C3_IND_SZ);

begin 644 delay-pools-patch.gz
M'XL(`#D>+#D"`X517T^#,!Q\AD]Q/KB`6`6V*8.A,VK,'C:-^N1B"-MJ+,ZQ
M%*99_/*V97^8@<@#M/1^=]<[0@BF=!:OHD6:SK*3R<G]8_].>XIS#.(5G"9L
MSV]U?/L<KFW;NF59^WCM^7VIH&X;=LMW.G[;+:"]'DC+.SMVSF"I;Q.]G@Z-
MTWS)YX$.^;#YE'VQZ3*>19QF><II-%[E-,-1*,XF?`V;T_P[Y1]U&"(Q;RF'
MP1#"#L#0A6%,9G&6-<G%9MIMMZ-E1J<F+C&\?8X&5P_1TPO\\H;`,0-8%C/Q
MHQ--$%">&Y)O!S(#W=I3K%420F(I%&QS;:I."AI[DV0'H9IH-/"7\S->C-@K
M0@4PQ8"TL`VS&*]+4[`2&56A)`<_%VDFG`M/77C!^F=I?GN#<&NDXG3$<`KO
M%0T8CF02%SB$9XJ`B+9-*"DZ250G%22RCO[P9E=':;/)*#D6+^FYJ*6VE]V1
ME-L1R<KV'54YV:M+^?W/"C05?%+16XF_J&Z4E-M3;L:<QA\R_8UK54L7U\U(
,*BO?O^08&7&C`P``
`
end

David.
-- 
----------------------------------------------
David Luyer
Senior Network Engineer
Pacific Internet (Aust) Pty Ltd
Phone:  +61 3 9674 7525
Fax:    +61 3 9699 8693
Mobile: +61 4 1064 2258, +61 4 1114 2258
http://www.pacific.net.au        NASDAQ: PCNTF
<< fast 'n easy >>
----------------------------------------------



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic