Possible bug in elements/userlevel/todevice.cc

jaeyong yoo <[email protected]>
Newsgroups gmane.network.routing.click
Message-ID <CANud0TEC390i1bfxsxw0FF+6Bn1WaXWEyqBZN-k5hMkgHTCFaA@mail.gmail.com>
Hello,

In Click 2.0, I think there is a bug in userlevel/todevice.cc function
"find_from_device"

The function "find_from_device" is as follows

FromDevice *
ToDevice::find_fromdevice() const
{
    Router *r = router();
    for (int ei = 0; ei < r->nelements(); ++ei)
        if (FromDevice *fd = (FromDevice *) r->element(ei)->cast

("FromDevice"))
            return fd;
    return 0;
}


would it be the following? because the above code would result fromdevice
and todevice binded although they have different interface names.


FromDevice *
ToDevice::find_fromdevice() const
{
    Router *r = router();
    for (int ei = 0; ei < r->nelements(); ++ei)
        if (FromDevice *fd = (FromDevice *) r->element(ei)->cast

("FromDevice"))
        {
            if (fd && fd->ifname() == _ifname && fd->fd() >= 0) // check if

the ifname is the same between fromdevice and todevice.
                return fd;
        }
    return 0;
}


best,
Jae-Yong
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.