netdev
[Top] [All Lists]

A small bug in net/sched/cls_u32.c

To: netdev@xxxxxxxxxxx
Subject: A small bug in net/sched/cls_u32.c
From: Zam <zam@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 14 Mar 2000 11:03:50 +0800 (CST)
Cc: kuznet@xxxxxxxxxxxxx
In-reply-to: <200003072257.WAA18346@gw.chygwyn.com>
Reply-to: zam_ustc@xxxxxxx
Sender: owner-netdev@xxxxxxxxxxx
Hi,
   Recently I am studying the code of packet scheduling but it is a bit
hard for me to understand the filter expecially u32 classifier.
   Today I find some strange codes in file cls_u32.c. The code goes as
follows(My kernel version is 2.2.13):

static u32 gen_new_htid(struct tc_u_common *tp_c)
{
    int i = 0x800;
    do {
        if (++tp_c->hgenerator == 0x7FF)
            tp_c->hgenerator = 1;
    } while (i>0 && u32_lookup_ht(tp_c, (tp_c->hgenerator|0x800)<<20));
  return i > 0 ? (tp_c->hgenerator|0x800)<<20 : 0;
}

What the use of variable "i" here? And further more,if the handle is used
up a dead loop is generated. Maybe the author has forgotten to add "i--". 
The bug still exists in kernel 2.2.14.
    Does anybody knows where to get materials explaining the mechanism of
u32 classifier and the usage of tc? It is too complicated for me to
understand.

Thanks a lot.

  Zam

















Join us in the Linux world!

 


<Prev in Thread] Current Thread [Next in Thread>