diff options
Diffstat (limited to 'plugins-root')
-rw-r--r-- | plugins-root/check_dhcp.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index d8afb172..88b7ca10 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -463,10 +463,9 @@ int send_dhcp_discover(int sock){ | |||
463 | discover_packet.hlen=ETHERNET_HARDWARE_ADDRESS_LENGTH; | 463 | discover_packet.hlen=ETHERNET_HARDWARE_ADDRESS_LENGTH; |
464 | 464 | ||
465 | /* | 465 | /* |
466 | * transaction ID is supposed to be random. We won't use the address so | 466 | * transaction ID is supposed to be random. |
467 | * we don't care about high entropy here. time(2) is good enough. | ||
468 | */ | 467 | */ |
469 | srand(time(NULL)); | 468 | srand(time(NULL)^getpid()); |
470 | packet_xid=random(); | 469 | packet_xid=random(); |
471 | discover_packet.xid=htonl(packet_xid); | 470 | discover_packet.xid=htonl(packet_xid); |
472 | 471 | ||
@@ -692,17 +691,11 @@ int receive_dhcp_packet(void *buffer, int buffer_size, int sock, int timeout, st | |||
692 | } | 691 | } |
693 | 692 | ||
694 | else{ | 693 | else{ |
695 | |||
696 | /* why do we need to peek first? i don't know, its a hack. without it, the source address of the first packet received was | ||
697 | not being interpreted correctly. sigh... */ | ||
698 | bzero(&source_address,sizeof(source_address)); | 694 | bzero(&source_address,sizeof(source_address)); |
699 | address_size=sizeof(source_address); | 695 | address_size=sizeof(source_address); |
700 | recv_result=recvfrom(sock,(char *)buffer,buffer_size,MSG_PEEK,(struct sockaddr *)&source_address,&address_size); | 696 | recv_result=recvfrom(sock,(char *)buffer,buffer_size,MSG_PEEK,(struct sockaddr *)&source_address,&address_size); |
701 | if(verbose) | 697 | if(verbose) |
702 | printf("recv_result_1: %d\n",recv_result); | 698 | printf("recv_result: %d\n",recv_result); |
703 | recv_result=recvfrom(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)&source_address,&address_size); | ||
704 | if(verbose) | ||
705 | printf("recv_result_2: %d\n",recv_result); | ||
706 | 699 | ||
707 | if(recv_result==-1){ | 700 | if(recv_result==-1){ |
708 | if(verbose){ | 701 | if(verbose){ |