diff options
Diffstat (limited to 'plugins-root/check_dhcp.c')
-rw-r--r-- | plugins-root/check_dhcp.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 5781f75..35874a9 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -79,8 +79,8 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
79 | 79 | ||
80 | #elif defined(__sun__) || defined(__solaris__) || defined(__hpux__) | 80 | #elif defined(__sun__) || defined(__solaris__) || defined(__hpux__) |
81 | 81 | ||
82 | #define INSAP 22 | 82 | #define INSAP 22 |
83 | #define OUTSAP 24 | 83 | #define OUTSAP 24 |
84 | 84 | ||
85 | #include <signal.h> | 85 | #include <signal.h> |
86 | #include <ctype.h> | 86 | #include <ctype.h> |
@@ -90,17 +90,17 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
90 | 90 | ||
91 | #define bcopy(source, destination, length) memcpy(destination, source, length) | 91 | #define bcopy(source, destination, length) memcpy(destination, source, length) |
92 | 92 | ||
93 | #define AREA_SZ 5000 /* buffer length in bytes */ | 93 | #define AREA_SZ 5000 /* buffer length in bytes */ |
94 | static u_long ctl_area[AREA_SZ]; | 94 | static u_long ctl_area[AREA_SZ]; |
95 | static u_long dat_area[AREA_SZ]; | 95 | static u_long dat_area[AREA_SZ]; |
96 | static struct strbuf ctl = {AREA_SZ, 0, (char *)ctl_area}; | 96 | static struct strbuf ctl = {AREA_SZ, 0, (char *)ctl_area}; |
97 | static struct strbuf dat = {AREA_SZ, 0, (char *)dat_area}; | 97 | static struct strbuf dat = {AREA_SZ, 0, (char *)dat_area}; |
98 | 98 | ||
99 | #define GOT_CTRL 1 | 99 | #define GOT_CTRL 1 |
100 | #define GOT_DATA 2 | 100 | #define GOT_DATA 2 |
101 | #define GOT_BOTH 3 | 101 | #define GOT_BOTH 3 |
102 | #define GOT_INTR 4 | 102 | #define GOT_INTR 4 |
103 | #define GOT_ERR 128 | 103 | #define GOT_ERR 128 |
104 | 104 | ||
105 | #define u_int8_t uint8_t | 105 | #define u_int8_t uint8_t |
106 | #define u_int16_t uint16_t | 106 | #define u_int16_t uint16_t |
@@ -222,7 +222,7 @@ dhcp_offer *dhcp_offer_list=NULL; | |||
222 | requested_server *requested_server_list=NULL; | 222 | requested_server *requested_server_list=NULL; |
223 | 223 | ||
224 | int valid_responses=0; /* number of valid DHCPOFFERs we received */ | 224 | int valid_responses=0; /* number of valid DHCPOFFERs we received */ |
225 | int requested_servers=0; | 225 | int requested_servers=0; |
226 | int requested_responses=0; | 226 | int requested_responses=0; |
227 | 227 | ||
228 | int request_specific_address=FALSE; | 228 | int request_specific_address=FALSE; |
@@ -382,7 +382,7 @@ int get_hardware_address(int sock,char *interface_name){ | |||
382 | unit = atoi(p) ; | 382 | unit = atoi(p) ; |
383 | *p = '\0' ; | 383 | *p = '\0' ; |
384 | strncat(dev, interface_name, 6) ; | 384 | strncat(dev, interface_name, 6) ; |
385 | } | 385 | } |
386 | else{ | 386 | else{ |
387 | printf(_("Error: can't find unit number in interface_name (%s) - expecting TypeNumber eg lnc0.\n"), interface_name); | 387 | printf(_("Error: can't find unit number in interface_name (%s) - expecting TypeNumber eg lnc0.\n"), interface_name); |
388 | exit(STATE_UNKNOWN); | 388 | exit(STATE_UNKNOWN); |
@@ -535,7 +535,7 @@ int send_dhcp_discover(int sock){ | |||
535 | /* send the DHCPDISCOVER packet out */ | 535 | /* send the DHCPDISCOVER packet out */ |
536 | send_dhcp_packet(&discover_packet,sizeof(discover_packet),sock,&sockaddr_broadcast); | 536 | send_dhcp_packet(&discover_packet,sizeof(discover_packet),sock,&sockaddr_broadcast); |
537 | 537 | ||
538 | if(verbose) | 538 | if(verbose) |
539 | printf("\n\n"); | 539 | printf("\n\n"); |
540 | 540 | ||
541 | return OK; | 541 | return OK; |
@@ -564,7 +564,7 @@ int get_dhcp_offer(int sock){ | |||
564 | if((current_time-start_time)>=dhcpoffer_timeout) | 564 | if((current_time-start_time)>=dhcpoffer_timeout) |
565 | break; | 565 | break; |
566 | 566 | ||
567 | if(verbose) | 567 | if(verbose) |
568 | printf("\n\n"); | 568 | printf("\n\n"); |
569 | 569 | ||
570 | bzero(&source,sizeof(source)); | 570 | bzero(&source,sizeof(source)); |
@@ -581,7 +581,7 @@ int get_dhcp_offer(int sock){ | |||
581 | continue; | 581 | continue; |
582 | } | 582 | } |
583 | else{ | 583 | else{ |
584 | if(verbose) | 584 | if(verbose) |
585 | printf(_("Result=OK\n")); | 585 | printf(_("Result=OK\n")); |
586 | 586 | ||
587 | responses++; | 587 | responses++; |
@@ -626,7 +626,7 @@ int get_dhcp_offer(int sock){ | |||
626 | printf("\n"); | 626 | printf("\n"); |
627 | 627 | ||
628 | if(result==ERROR){ | 628 | if(result==ERROR){ |
629 | if(verbose) | 629 | if(verbose) |
630 | printf(_("DHCPOFFER hardware address did not match our own - ignoring packet\n")); | 630 | printf(_("DHCPOFFER hardware address did not match our own - ignoring packet\n")); |
631 | 631 | ||
632 | continue; | 632 | continue; |
@@ -660,7 +660,7 @@ int send_dhcp_packet(void *buffer, int buffer_size, int sock, struct sockaddr_in | |||
660 | 660 | ||
661 | result=sendto(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)dest,sizeof(*dest)); | 661 | result=sendto(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)dest,sizeof(*dest)); |
662 | 662 | ||
663 | if(verbose) | 663 | if(verbose) |
664 | printf(_("send_dhcp_packet result: %d\n"),result); | 664 | printf(_("send_dhcp_packet result: %d\n"),result); |
665 | 665 | ||
666 | if(result<0) | 666 | if(result<0) |
@@ -853,7 +853,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ | |||
853 | /* get option length */ | 853 | /* get option length */ |
854 | option_length=offer_packet->options[x++]; | 854 | option_length=offer_packet->options[x++]; |
855 | 855 | ||
856 | if(verbose) | 856 | if(verbose) |
857 | printf("Option: %d (0x%02X)\n",option_type,option_length); | 857 | printf("Option: %d (0x%02X)\n",option_type,option_length); |
858 | 858 | ||
859 | /* get option data */ | 859 | /* get option data */ |
@@ -989,7 +989,7 @@ int get_results(void){ | |||
989 | if(verbose){ | 989 | if(verbose){ |
990 | printf(_("DHCP Server Match: Offerer=%s"),inet_ntoa(temp_offer->server_address)); | 990 | printf(_("DHCP Server Match: Offerer=%s"),inet_ntoa(temp_offer->server_address)); |
991 | printf(_(" Requested=%s"),inet_ntoa(temp_server->server_address)); | 991 | printf(_(" Requested=%s"),inet_ntoa(temp_server->server_address)); |
992 | if(temp_server->answered) | 992 | if(temp_server->answered) |
993 | printf(_(" (duplicate)")); | 993 | printf(_(" (duplicate)")); |
994 | printf(_("\n")); | 994 | printf(_("\n")); |
995 | } | 995 | } |
@@ -1090,7 +1090,7 @@ int call_getopt(int argc, char **argv){ | |||
1090 | 1090 | ||
1091 | int option_index = 0; | 1091 | int option_index = 0; |
1092 | static struct option long_options[] = | 1092 | static struct option long_options[] = |
1093 | { | 1093 | { |
1094 | {"serverip", required_argument,0,'s'}, | 1094 | {"serverip", required_argument,0,'s'}, |
1095 | {"requestedip", required_argument,0,'r'}, | 1095 | {"requestedip", required_argument,0,'r'}, |
1096 | {"timeout", required_argument,0,'t'}, | 1096 | {"timeout", required_argument,0,'t'}, |
@@ -1306,7 +1306,7 @@ static int dl_bind(int fd, int sap, u_char *addr){ | |||
1306 | 1306 | ||
1307 | /*********************************************************************** | 1307 | /*********************************************************************** |
1308 | * interface: | 1308 | * interface: |
1309 | * function mac_addr_dlpi - get the mac address of the interface with | 1309 | * function mac_addr_dlpi - get the mac address of the interface with |
1310 | * type dev (eg lnc, hme) and unit (0, 1 ..) | 1310 | * type dev (eg lnc, hme) and unit (0, 1 ..) |
1311 | * | 1311 | * |
1312 | * parameter: addr: an array of six bytes, has to be allocated by the caller | 1312 | * parameter: addr: an array of six bytes, has to be allocated by the caller |