[Pkg-nagios-devel] Bug#784319: Bug#784319: Bug#784319: Segfault when running check_dhcp

Andreas Heinlein aheinlein at gmx.com
Tue May 5 13:53:53 UTC 2015


I switched from root to 'nagios' with 'su -s /bin/bash nagios', then ran
'/usr/lib/nagios/plugins/check_dhcp -v -s 172.16.9.3 -r 172.16.9.254 -i
eth1 -m aa:bb:cc:dd:ee:ff'

This is the result:
---
Requested server address: 172.16.9.3
Hardware address: aa:bb:cc:dd:ee:ff
DHCP socket: 3
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 901953561 (0x35C2B819)
DHCDISCOVER ciaddr:  0.0.0.0
DHCDISCOVER yiaddr:  0.0.0.0
DHCDISCOVER siaddr:  0.0.0.0
DHCDISCOVER giaddr:  0.0.0.0
send_dhcp_packet result: 548




recv_result_1: 315
recv_result_2: 315
receive_dhcp_packet() result: 315
receive_dhcp_packet() source: 172.16.9.3
Result=OK
DHCPOFFER from IP address 172.16.9.3 via 172.16.9.3
DHCPOFFER XID: 901953561 (0x35C2B819)
DHCPOFFER chaddr: AABBCCDDEEFF
DHCPOFFER ciaddr: 0.0.0.0
DHCPOFFER yiaddr: 172.16.9.254
DHCPOFFER siaddr: 172.16.9.3
DHCPOFFER giaddr: 0.0.0.0
Option: 53 (0x01)
Option: 54 (0x04)
Option: 51 (0x04)
Option: 1 (0x04)
Option: 6 (0x04)
Option: 12 (0x0F)
Option: 28 (0x04)
Option: 42 (0x04)
Option: 44 (0x04)
Option: 15 (0x0A)
Lease Time: 3600 seconds
Renewal Time: 0 seconds
Rebinding Time: 0 seconds
Added offer from server @ 172.16.9.3 of IP address 172.16.9.254


No (more) data received (nfound: 0)
Result=ERROR
Total responses seen on the wire: 1
Valid responses for this machine: 1
DHCP Server Match: Offerer=172.16.9.3 Requested=172.16.9.3
OK: Received 1 DHCPOFFER(s), 1 of 1 requested servers responded,
requested address (172.16.9.254) was offered, max lease time = 3600 sec.
---
So it works, though the "Result=ERROR" thing looks strange.

The bug report I linked above claims that this patch fixes it:
---
--- plugins-root/check_dhcp.c.orig    2014-07-06 17:55:03 UTC
+++ plugins-root/check_dhcp.c
@@ -323,7 +323,8 @@ int get_hardware_address(int sock,char *
 #elif defined(__bsd__)
                         /* King 2004    see ACKNOWLEDGEMENTS */
 
-        int                     mib[6], len;
+        int                     mib[6];
+        size_t                  len;
         char                    *buf;
         unsigned char           *ptr;
         struct if_msghdr        *ifm;
@@ -1182,7 +1183,7 @@ int call_getopt(int argc, char **argv){
                 }
             }
 
-    return i;
+    return i+1;
         }
---
I will give it a try tomorrow, no time left for today ;-)



More information about the Pkg-nagios-devel mailing list