diff options
Diffstat (limited to 'plugins-root/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 72405fe..8559d63 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -185,6 +185,7 @@ typedef struct requested_server_struct{ | |||
185 | #define DHCP_OPTION_SERVER_IDENTIFIER 54 | 185 | #define DHCP_OPTION_SERVER_IDENTIFIER 54 |
186 | #define DHCP_OPTION_RENEWAL_TIME 58 | 186 | #define DHCP_OPTION_RENEWAL_TIME 58 |
187 | #define DHCP_OPTION_REBINDING_TIME 59 | 187 | #define DHCP_OPTION_REBINDING_TIME 59 |
188 | #define DHCP_OPTION_END 255 | ||
188 | 189 | ||
189 | #define DHCP_INFINITE_TIME 0xFFFFFFFF | 190 | #define DHCP_INFINITE_TIME 0xFFFFFFFF |
190 | 191 | ||
@@ -401,6 +402,7 @@ int get_hardware_address(int sock,char *interface_name){ | |||
401 | int send_dhcp_discover(int sock){ | 402 | int send_dhcp_discover(int sock){ |
402 | dhcp_packet discover_packet; | 403 | dhcp_packet discover_packet; |
403 | struct sockaddr_in sockaddr_broadcast; | 404 | struct sockaddr_in sockaddr_broadcast; |
405 | unsigned short opts; | ||
404 | 406 | ||
405 | 407 | ||
406 | /* clear the packet data structure */ | 408 | /* clear the packet data structure */ |
@@ -442,17 +444,20 @@ int send_dhcp_discover(int sock){ | |||
442 | discover_packet.options[2]='\x53'; | 444 | discover_packet.options[2]='\x53'; |
443 | discover_packet.options[3]='\x63'; | 445 | discover_packet.options[3]='\x63'; |
444 | 446 | ||
447 | opts = 4; | ||
445 | /* DHCP message type is embedded in options field */ | 448 | /* DHCP message type is embedded in options field */ |
446 | discover_packet.options[4]=DHCP_OPTION_MESSAGE_TYPE; /* DHCP message type option identifier */ | 449 | discover_packet.options[opts++]=DHCP_OPTION_MESSAGE_TYPE; /* DHCP message type option identifier */ |
447 | discover_packet.options[5]='\x01'; /* DHCP message option length in bytes */ | 450 | discover_packet.options[opts++]='\x01'; /* DHCP message option length in bytes */ |
448 | discover_packet.options[6]=DHCPDISCOVER; | 451 | discover_packet.options[opts++]=DHCPDISCOVER; |
449 | 452 | ||
450 | /* the IP address we're requesting */ | 453 | /* the IP address we're requesting */ |
451 | if(request_specific_address==TRUE){ | 454 | if(request_specific_address==TRUE){ |
452 | discover_packet.options[7]=DHCP_OPTION_REQUESTED_ADDRESS; | 455 | discover_packet.options[opts++]=DHCP_OPTION_REQUESTED_ADDRESS; |
453 | discover_packet.options[8]='\x04'; | 456 | discover_packet.options[opts++]='\x04'; |
454 | memcpy(&discover_packet.options[9],&requested_address,sizeof(requested_address)); | 457 | memcpy(&discover_packet.options[opts],&requested_address,sizeof(requested_address)); |
458 | opts += sizeof(requested_address); | ||
455 | } | 459 | } |
460 | discover_packet.options[opts++]=DHCP_OPTION_END; | ||
456 | 461 | ||
457 | /* send the DHCPDISCOVER packet to broadcast address */ | 462 | /* send the DHCPDISCOVER packet to broadcast address */ |
458 | sockaddr_broadcast.sin_family=AF_INET; | 463 | sockaddr_broadcast.sin_family=AF_INET; |