[Click] problem at runtime

JS njeanseb at gmail.com
Wed Aug 8 18:15:15 EDT 2007


here is the code of my push function. I am still looking to see if I found
any breaking of these rules but I haven't find any...

void Blue::push(int, Packet *p)
{
    bool dropped=false;
    double _random= (-(double) random() / (RAND_MAX + 1))*100;
    if (_random <= _marking_probability) //mark or drop the packet
    {
        const click_ip *iph = p->ip_header();
//check if it is a IP packet and if ECN is enable
        if (iph && ((iph->ip_tos & IP_ECNMASK) != IP_ECN_NOT_ECT))
        {
            setECNbit(p);
            printf("packet marked \n");
        }
        else
        {
            drop(p);
            dropped=true;
            printf("packet dropped \n");
        }
    }
    if (dropped==false) //checking for buffer overflow
    {
        int maxbuffer = _queue->capacity();
        if (_queue->size() == maxbuffer)
        {
            inc_marking_probability();
            drop(p);
        }
        output(0).push(p);
        printf("packet enqueued\n");
    }
}

void Blue::drop(Packet *p)
{
    if (noutputs() == 1)
    {
        p->kill();
    }
    else
    {
        output(1).push(p);
    }
    nbrdrop++;
}


2007/8/9, Beyers Cronje <bcronje at gmail.com>:
>
> I have to agree with Adam, you have broken one of the rules in the url
> below.
>
> Seeing the crash occurred in Discard run task which basically does a
> p->kill() mean in one of your elements you have broken one of the following
> rules:
>
> 1) Pushed the same packet out more than once from the same element without
> cloning it
> 2) Used uniquify on a packet and still pushed out the original packet
> 3) Some other memory bug in your code like a corrupt queue
>
>
>
> On 8/8/07, Adam M <click at irotas.net> wrote:
>
> > Have you followed the rules documented here:
> > http://www.read.cs.ucla.edu/click/element
> >
> > "Every push or pull method must account for every packet it receives by
> > freeing it, emitting it on some output, or perhaps explicitly storing it
> > for later."
> >
> > Try running it through valgrind with '--tool=memcheck --leak-check=yes
> > -v'
> >
> > -Adam
> >
> >
> > On Wed, 8 Aug 2007 19:16:34 +0200, "JS" < njeanseb at gmail.com> said:
> > > Hi everyone,
> > > I am trying to perform some tests on my new elements. and I am getting
> > > something weird when I run click
> > _______________________________________________
> > click mailing list
> > click at amsterdam.lcs.mit.edu
> > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> >
>
>


More information about the click mailing list