[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DHCP Transaction ID



Hi,

On Tue, Apr 21, 2009 at 2:48 AM, Tim Cussins <timcussins at eml.cc> wrote:
> (2) use a unique transaction id for each exchange.
> ...
> My proposed patch updates the xid field using rand() in both
> dhcp_discover_req() and dhcp_request_req(). This means a new xid for
> each exchange.

Here is one of the places that the patch calls rand():

-  (*xid)++;
-  call->xid = htonl (*xid);
+  call->xid = htonl(rand());

It looks like htonl(rand()) could return the same ID that was used in
the previous exchange.  That is, uniqueness is not guaranteed.

If rand() is to be used, consider using it to generate a nonzero
offset to the previous ID.

Thanks,
 -Chris Ford
  Palo Alto, California