[Click] DHCP in linuxmodule

Fadjar Tandabawana fadjar at tst-indonesia.com
Wed Jul 15 11:33:05 EDT 2009


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...


-- 
Regards,
Fadjar Tandabawana
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://amsterdam.lcs.mit.edu/pipermail/click/attachments/20090715/18a29b18/attachment.pgp 


More information about the click mailing list