DHCP Transaction ID

Tim Cussins timcussins at eml.cc
Tue Apr 21 15:58:30 UTC 2009


Hi Chris,

On Tue, 21 Apr 2009 07:41 -0700, "Chris Ford" <chris at island2.com> wrote:
> 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.

Outstanding catch - thanks mate.

Cheers,
Tim



More information about the users mailing list