diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2016-09-14 11:57:31 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2016-09-14 11:57:31 +0200 |
| commit | 99f5be29927de6863849441b8af4b794033cc8bd (patch) | |
| tree | 0839cf61bcb12022573af8e9a17b469c83440043 /plugins-root | |
| parent | 6fcf0fbbee1fb902bfebf8de00ac1981f11be70d (diff) | |
| download | monitoring-plugins-99f5be29927de6863849441b8af4b794033cc8bd.tar.gz | |
check_dhcp: Don't peek before reading response
Omit a recvfrom(3) call which has the MSG_PEEK flag set and should have
no effect at all. According to a comment in the code, this call was
meant to be a workaround to an opaque issue. If anyone runs into that
issue, we should fix it properly instead.
Diffstat (limited to 'plugins-root')
| -rw-r--r-- | plugins-root/check_dhcp.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index d8afb172..445ddbc1 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
| @@ -692,17 +692,11 @@ int receive_dhcp_packet(void *buffer, int buffer_size, int sock, int timeout, st | |||
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | else{ | 694 | 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)); | 695 | bzero(&source_address,sizeof(source_address)); |
| 699 | address_size=sizeof(source_address); | 696 | address_size=sizeof(source_address); |
| 700 | recv_result=recvfrom(sock,(char *)buffer,buffer_size,MSG_PEEK,(struct sockaddr *)&source_address,&address_size); | 697 | recv_result=recvfrom(sock,(char *)buffer,buffer_size,MSG_PEEK,(struct sockaddr *)&source_address,&address_size); |
| 701 | if(verbose) | 698 | if(verbose) |
| 702 | printf("recv_result_1: %d\n",recv_result); | 699 | 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 | 700 | ||
| 707 | if(recv_result==-1){ | 701 | if(recv_result==-1){ |
| 708 | if(verbose){ | 702 | if(verbose){ |
