This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: dhcp XID generation


Hi Hugo,

If the method to generate the XID seems suitable then here follows trial
number 3 (hopefully correct this time :-/):

<patch>
Index: packages/net/tcpip/current/src/lib/dhcp_prot.c
===================================================================
RCS file: /usr/cvs/eCos/packages/net/net/tcpip/current/src/lib/dhcp_prot.c,v
retrieving revision 1.1
diff -r1.1 dhcp_prot.c
395a396
> 
397d397
<         xid = (cyg_uint32)res + (cyg_uint32)(0xffffffff & cyg_current_time());
399,400d398
<     else
<         xid = res->bp_xid; // use what's there already
446a445,446
>     xid = res->bp_xid; // default to what's there already;
> 
487a488,496
>             }
> 
>             // generates a new XID
>             {
>                 unsigned char* xp = (unsigned char*)&xid;
> 
>                 *xp++ = ifr.ifr_hwaddr.sa_data[5];
>                 *xp++ = ifr.ifr_hwaddr.sa_data[4];
>                 *((cyg_uint16*)xp) = (cyg_uint16)(arc4random() & 0xffff);
</patch>

Robin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]