[Nagiosplug-devel] check_dhcp.c incorrectly setting source ip address as siaddr
Jason Ellison
infotek at gmail.com
Wed Mar 14 00:11:19 CET 2012
nagios-plugins-1.4.15
plugins-root/check_dhcp.c
Sets dhcp server source ip to the next server (siaddr) IP address,
causing -s to fail to operate as expected.
-s, --serverip=IPADDRESS
IP address of DHCP server that we must hear from
root at nagios:/usr/local/src/nagios-plugins-1.4.15# ./plugins-root/check_dhcp -v
DHCP socket: 3
Hardware address: 00:22:19:56:99:48
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 275057756 (0x10650C5C)
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: 300
recv_result_2: 300
receive_dhcp_packet() result: 300
receive_dhcp_packet() source: 10.10.10.15
Result=OK
DHCPOFFER from IP address 10.10.10.15 via 10.10.10.15
DHCPOFFER XID: 275057756 (0x10650C5C)
DHCPOFFER chaddr: 002219569948
DHCPOFFER ciaddr: 0.0.0.0
DHCPOFFER yiaddr: 10.10.10.166
DHCPOFFER siaddr: 10.10.10.24
DHCPOFFER giaddr: 0.0.0.0
Option: 53 (0x01)
Option: 1 (0x04)
Option: 58 (0x04)
Option: 59 (0x04)
Lease Time: 0 seconds
Renewal Time: 14400 seconds
Rebinding Time: 25200 seconds
Added offer from server @ 10.10.10.15 of IP address 10.10.10.166
No (more) data received (nfound: 0)
Result=ERROR
Total responses seen on the wire: 1
Valid responses for this machine: 1
OK: Received 1 DHCPOFFER(s), max lease time = 0 sec.
17:58:55.805403 IP (tos 0x0, ttl 128, id 20477, offset 0, flags
[none], proto UDP (17), length 328)
10.10.10.15.67 > 255.255.255.255.68: [udp sum ok] BOOTP/DHCP,
Reply, length 300, xid 0x10650c5c, Flags [none] (0x0000)
Your-IP 10.10.10.166
Server-IP 10.10.10.24
Client-Ethernet-Address 00:22:19:56:99:48
file "kbox2000.0"
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Offer
Subnet-Mask Option 1, length 4: 255.255.255.0
RN Option 58, length 4: 14400
RB Option 59, length 4: 25200
Lease-Time Option 51, length 4: 28800
Server-ID Option 54, length 4: 10.10.10.15
0x0000: 4500 0148 4ffd 0000 8011 d58f 0a0a 0a0f
0x0010: ffff ffff 0043 0044 0134 2e43 0201 0600
0x0020: 1065 0c5c 0000 0000 0000 0000 0a0a 0aa6
0x0030: 0a0a 0a18 0000 0000 0022 1956 9948 0000
0x0040: 0000 0000 0000 0000 0000 0000 0000 0000
0x0050: 0000 0000 0000 0000 0000 0000 0000 0000
0x0060: 0000 0000 0000 0000 0000 0000 0000 0000
0x0070: 0000 0000 0000 0000 0000 0000 0000 0000
0x0080: 0000 0000 0000 0000 6b62 6f78 3230 3030
0x0090: 2e30 0000 0000 0000 0000 0000 0000 0000
0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000
0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000
0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000
0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000
0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000
0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000
0x0100: 0000 0000 0000 0000 6382 5363 3501 0201
0x0110: 04ff ffff 003a 0400 0038 403b 0400 0062
0x0120: 7033 0400 0070 8036 040a 0a0a 0fff 0000
0x0130: 0000 0000 0000 0000 0000 0000 0000 0000
0x0140: 0000 0000 0000 0000
plugins-root/check_dhcp.c
FIX
/* If siaddr is non-zero, set "source" to siaddr */
/* don't set the source to next boot server (siaddr) 591 infotek at gmail.com
if(offer_packet.siaddr.s_addr != 0L){
source.sin_addr.s_addr = offer_packet.siaddr.s_addr ;
}
*/
More information about the Devel
mailing list