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

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click

Reply via email to