[Click] Off-by-one buglet in LinuxIPLookup element, Click 1.5.0

Eddie Kohler kohler at cs.ucla.edu
Wed May 16 01:12:17 EDT 2007


Thanks Christian!  I've finally checked in a (slightly different) fix.  Wanna 
check & make sure it still works for you?

Eddie


Christian Kreibich wrote:
> Hi,
> 
> I think there's an off-by-one in elements/ip/lookupiproutelinux.c:
> 
> --- lookupiproutelinux.cc       2006-05-19 00:12:21.000000000 -0700
> +++ lookupiproutelinux.cc.new   2007-04-09 11:27:48.000000000 -0700
> @@ -59,7 +59,7 @@
>  {
>    _out2devname = conf;
>    _nout = _out2devname.size();
> -  if (_nout + 1 >= noutputs())
> +  if (_nout + 1 > noutputs())
>        return errh->error("need %d or more output ports", _nout + 1);
>    return 0;
>  }
> 
> Basically, when you configure the element with n devices and use n+1
> output ports (as should be), then you still get the error because n+1 ==
> noutputs(). Adding discarders works around the problem:
> 
>   r : LinuxIPLookup(eth0, eth1)
>   r[0] -> ... -> ToDevice(eth0)
>   r[1] -> ... -> ToDevice(eth1)
>   r[2] -> ICMPError(18.26.4.24, 3, 0) -> ...
>   r[3] -> Discard
> 


More information about the click mailing list