[Click] DHCP in linuxmodule

Eddie Kohler kohler at cs.ucla.edu
Sat Feb 27 20:29:37 EST 2010


Fadjar,

Thanks for the bug report!  The fix is in.

Eddie


Fadjar Tandabawana wrote:
> Dear Mr. Kohler,
> 
> I found one error in DHCP package when I compile in linuxmodule in file
> dhcpoptionmodule.cc
> 
> This is the original version of dhcpoptionutil.cc
> 
> at line 70:
> 
> uint32_t rand_exp_backoff(uint32_t backoff_center)
> {
>     uint32_t dice = click_random();
>     if (dice <= RAND_MAX / 3)
> 	return backoff_center - 1;
>     else if (dice <= (RAND_MAX / 3) * 2)
> 	return backoff_center;
>     else
> 	return backoff_center + 1;
> }
> 
> I made some search in the click/glue.hh and I found that the RAND_MAX
> should be CLICK_RAND_MAX
> 
> uint32_t rand_exp_backoff(uint32_t backoff_center)
> {
>     uint32_t dice = click_random();
>     if (dice <= CLICK_RAND_MAX / 3)
> 	return backoff_center - 1;
>     else if (dice <= (CLICK_RAND_MAX / 3) * 2)
> 	return backoff_center;
>     else
> 	return backoff_center + 1;
> }
> 
> 
> Then, no error occured anymore.
> 
> CMIIW...
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list