DHCP Transaction ID

Chris Ford chris at island2.com
Tue Apr 21 14:41:01 UTC 2009


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



More information about the users mailing list