Re: delay_pools.c is buggy in 2.3.STABLE3 :-(

From: <david@dont-contact.us>
Date: Tue, 13 Jun 2000 07:58:30 +1000

> Hmm.. I do not quite understand this patch.
>
> To me it looks like you are patching away the correct functionality,
> making it only check the 255 network/host if used. If you start at 255
> and count upwards towards 255, then your will only reach 255.

The initial value in a for loop is not checked against the guard.

Also remember i and j are unsigned 8-bit entities so 255+1=0.

[or at least they were originally 8-bit unsigned and I'm assuming nobody has
changed them since... in fact I haven't liked this code at all since it was
changed some time ago without any actual proof of how the original could have
been wrong]

I'll download 2.4stable2 and check the code again.

David.

> /Henrik
>
>
> david@luyer.net wrote:
> >
> > 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 >>
> > ----------------------------------------------

-- 
----------------------------------------------
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 >>
----------------------------------------------
Received on Mon Jun 12 2000 - 17:36:05 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:29 MST