Re: Possible bug in elements/userlevel/todevice.cc

Eddie Kohler <[email protected]>
Newsgroups gmane.network.routing.click
Message-ID <[email protected]>
Great catch!  Thanks, Jaeyong!  I've checked in a version of this.

Eddie


On 9/1/11 9:51 AM, jaeyong yoo wrote:
> 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
> _______________________________________________
> click mailing list
> [email protected]
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
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.