mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-05-28 04:35:40 -04:00
check_dhcp: Make xid a bit more random
Don't just use the current time(2) to seed the PRNG that generates the xid. A DHCP server might be checked multiple times per second.
This commit is contained in:
parent
99f5be2992
commit
8672529b37
1 changed files with 2 additions and 3 deletions
|
|
@ -463,10 +463,9 @@ int send_dhcp_discover(int sock){
|
|||
discover_packet.hlen=ETHERNET_HARDWARE_ADDRESS_LENGTH;
|
||||
|
||||
/*
|
||||
* transaction ID is supposed to be random. We won't use the address so
|
||||
* we don't care about high entropy here. time(2) is good enough.
|
||||
* transaction ID is supposed to be random.
|
||||
*/
|
||||
srand(time(NULL));
|
||||
srand(time(NULL)^getpid());
|
||||
packet_xid=random();
|
||||
discover_packet.xid=htonl(packet_xid);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue