diff options
| -rw-r--r-- | plugins-root/check_dhcp.c | 21 | ||||
| -rw-r--r-- | plugins-root/check_icmp.c | 34 |
2 files changed, 29 insertions, 26 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index a41a86e9..9b62b3e2 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
| @@ -274,7 +274,7 @@ int main(int argc, char **argv){ | |||
| 274 | 274 | ||
| 275 | /* this plugin almost certainly needs root permissions. */ | 275 | /* this plugin almost certainly needs root permissions. */ |
| 276 | np_warn_if_not_root(); | 276 | np_warn_if_not_root(); |
| 277 | 277 | ||
| 278 | /* create socket for DHCP communications */ | 278 | /* create socket for DHCP communications */ |
| 279 | dhcp_socket=create_dhcp_socket(); | 279 | dhcp_socket=create_dhcp_socket(); |
| 280 | 280 | ||
| @@ -316,7 +316,7 @@ int get_hardware_address(int sock,char *interface_name){ | |||
| 316 | 316 | ||
| 317 | strncpy((char *)&ifr.ifr_name,interface_name,sizeof(ifr.ifr_name)-1); | 317 | strncpy((char *)&ifr.ifr_name,interface_name,sizeof(ifr.ifr_name)-1); |
| 318 | ifr.ifr_name[sizeof(ifr.ifr_name)-1]='\0'; | 318 | ifr.ifr_name[sizeof(ifr.ifr_name)-1]='\0'; |
| 319 | 319 | ||
| 320 | /* try and grab hardware address of requested interface */ | 320 | /* try and grab hardware address of requested interface */ |
| 321 | if(ioctl(sock,SIOCGIFHWADDR,&ifr)<0){ | 321 | if(ioctl(sock,SIOCGIFHWADDR,&ifr)<0){ |
| 322 | printf(_("Error: Could not get hardware address of interface '%s'\n"),interface_name); | 322 | printf(_("Error: Could not get hardware address of interface '%s'\n"),interface_name); |
| @@ -506,7 +506,7 @@ int send_dhcp_discover(int sock){ | |||
| 506 | opts += sizeof(requested_address); | 506 | opts += sizeof(requested_address); |
| 507 | } | 507 | } |
| 508 | discover_packet.options[opts++]=DHCP_OPTION_END; | 508 | discover_packet.options[opts++]=DHCP_OPTION_END; |
| 509 | 509 | ||
| 510 | /* unicast fields */ | 510 | /* unicast fields */ |
| 511 | if(unicast) | 511 | if(unicast) |
| 512 | discover_packet.giaddr.s_addr = my_ip.s_addr; | 512 | discover_packet.giaddr.s_addr = my_ip.s_addr; |
| @@ -571,7 +571,7 @@ int get_dhcp_offer(int sock){ | |||
| 571 | 571 | ||
| 572 | result=OK; | 572 | result=OK; |
| 573 | result=receive_dhcp_packet(&offer_packet,sizeof(offer_packet),sock,dhcpoffer_timeout,&source); | 573 | result=receive_dhcp_packet(&offer_packet,sizeof(offer_packet),sock,dhcpoffer_timeout,&source); |
| 574 | 574 | ||
| 575 | if(result!=OK){ | 575 | if(result!=OK){ |
| 576 | if(verbose) | 576 | if(verbose) |
| 577 | printf(_("Result=ERROR\n")); | 577 | printf(_("Result=ERROR\n")); |
| @@ -952,7 +952,7 @@ int free_requested_server_list(void){ | |||
| 952 | next_server=this_server->next; | 952 | next_server=this_server->next; |
| 953 | free(this_server); | 953 | free(this_server); |
| 954 | } | 954 | } |
| 955 | 955 | ||
| 956 | return OK; | 956 | return OK; |
| 957 | } | 957 | } |
| 958 | 958 | ||
| @@ -977,7 +977,7 @@ int get_results(void){ | |||
| 977 | /* get max lease time we were offered */ | 977 | /* get max lease time we were offered */ |
| 978 | if(temp_offer->lease_time>max_lease_time || temp_offer->lease_time==DHCP_INFINITE_TIME) | 978 | if(temp_offer->lease_time>max_lease_time || temp_offer->lease_time==DHCP_INFINITE_TIME) |
| 979 | max_lease_time=temp_offer->lease_time; | 979 | max_lease_time=temp_offer->lease_time; |
| 980 | 980 | ||
| 981 | /* see if we got the address we requested */ | 981 | /* see if we got the address we requested */ |
| 982 | if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) | 982 | if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) |
| 983 | received_requested_address=TRUE; | 983 | received_requested_address=TRUE; |
| @@ -1009,7 +1009,7 @@ int get_results(void){ | |||
| 1009 | /* get max lease time we were offered */ | 1009 | /* get max lease time we were offered */ |
| 1010 | if(temp_offer->lease_time>max_lease_time || temp_offer->lease_time==DHCP_INFINITE_TIME) | 1010 | if(temp_offer->lease_time>max_lease_time || temp_offer->lease_time==DHCP_INFINITE_TIME) |
| 1011 | max_lease_time=temp_offer->lease_time; | 1011 | max_lease_time=temp_offer->lease_time; |
| 1012 | 1012 | ||
| 1013 | /* see if we got the address we requested */ | 1013 | /* see if we got the address we requested */ |
| 1014 | if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) | 1014 | if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) |
| 1015 | received_requested_address=TRUE; | 1015 | received_requested_address=TRUE; |
| @@ -1387,7 +1387,7 @@ void print_help(void){ | |||
| 1387 | 1387 | ||
| 1388 | printf("Copyright (c) 2001-2004 Ethan Galstad (nagios@nagios.org)\n"); | 1388 | printf("Copyright (c) 2001-2004 Ethan Galstad (nagios@nagios.org)\n"); |
| 1389 | printf (COPYRIGHT, copyright, email); | 1389 | printf (COPYRIGHT, copyright, email); |
| 1390 | 1390 | ||
| 1391 | printf("%s\n", _("This plugin tests the availability of DHCP servers on a network.")); | 1391 | printf("%s\n", _("This plugin tests the availability of DHCP servers on a network.")); |
| 1392 | 1392 | ||
| 1393 | printf ("\n\n"); | 1393 | printf ("\n\n"); |
| @@ -1411,17 +1411,18 @@ void print_help(void){ | |||
| 1411 | printf (" %s\n", "-u, --unicast"); | 1411 | printf (" %s\n", "-u, --unicast"); |
| 1412 | printf (" %s\n", _("Unicast testing: mimic a DHCP relay, requires -s")); | 1412 | printf (" %s\n", _("Unicast testing: mimic a DHCP relay, requires -s")); |
| 1413 | 1413 | ||
| 1414 | printf (_(UT_SUPPORT)); | ||
| 1414 | return; | 1415 | return; |
| 1415 | } | 1416 | } |
| 1416 | 1417 | ||
| 1417 | 1418 | ||
| 1418 | void | 1419 | void |
| 1419 | print_usage(void){ | 1420 | print_usage(void){ |
| 1420 | 1421 | ||
| 1421 | printf (_("Usage:")); | 1422 | printf (_("Usage:")); |
| 1422 | printf (" %s [-v] [-u] [-s serverip] [-r requestedip] [-t timeout]\n",progname); | 1423 | printf (" %s [-v] [-u] [-s serverip] [-r requestedip] [-t timeout]\n",progname); |
| 1423 | printf (" [-i interface] [-m mac]\n"); | 1424 | printf (" [-i interface] [-m mac]\n"); |
| 1424 | 1425 | ||
| 1425 | return; | 1426 | return; |
| 1426 | } | 1427 | } |
| 1427 | 1428 | ||
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 8e7f6d0b..a059f266 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
| @@ -378,7 +378,7 @@ main(int argc, char **argv) | |||
| 378 | setlocale (LC_ALL, ""); | 378 | setlocale (LC_ALL, ""); |
| 379 | bindtextdomain (PACKAGE, LOCALEDIR); | 379 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 380 | textdomain (PACKAGE); | 380 | textdomain (PACKAGE); |
| 381 | 381 | ||
| 382 | /* print a helpful error message if geteuid != 0 */ | 382 | /* print a helpful error message if geteuid != 0 */ |
| 383 | np_warn_if_not_root(); | 383 | np_warn_if_not_root(); |
| 384 | 384 | ||
| @@ -646,7 +646,7 @@ run_checks() | |||
| 646 | table[t]->name); | 646 | table[t]->name); |
| 647 | continue; | 647 | continue; |
| 648 | } | 648 | } |
| 649 | 649 | ||
| 650 | /* we're still in the game, so send next packet */ | 650 | /* we're still in the game, so send next packet */ |
| 651 | (void)send_icmp_ping(icmp_sock, table[t]); | 651 | (void)send_icmp_ping(icmp_sock, table[t]); |
| 652 | result = wait_for_reply(icmp_sock, target_interval); | 652 | result = wait_for_reply(icmp_sock, target_interval); |
| @@ -1253,16 +1253,16 @@ print_help(void) | |||
| 1253 | { | 1253 | { |
| 1254 | 1254 | ||
| 1255 | /*print_revision (progname, revision);*/ /* FIXME: Why? */ | 1255 | /*print_revision (progname, revision);*/ /* FIXME: Why? */ |
| 1256 | 1256 | ||
| 1257 | printf ("Copyright (c) 2005 Andreas Ericsson <ae@op5.se>\n"); | 1257 | printf ("Copyright (c) 2005 Andreas Ericsson <ae@op5.se>\n"); |
| 1258 | printf (COPYRIGHT, copyright, email); | 1258 | printf (COPYRIGHT, copyright, email); |
| 1259 | 1259 | ||
| 1260 | printf ("\n\n"); | 1260 | printf ("\n\n"); |
| 1261 | 1261 | ||
| 1262 | print_usage (); | 1262 | print_usage (); |
| 1263 | 1263 | ||
| 1264 | printf (_(UT_HELP_VRSN)); | 1264 | printf (_(UT_HELP_VRSN)); |
| 1265 | 1265 | ||
| 1266 | printf (" %s\n", "-H"); | 1266 | printf (" %s\n", "-H"); |
| 1267 | printf (" %s\n", _("specify a target")); | 1267 | printf (" %s\n", _("specify a target")); |
| 1268 | printf (" %s\n", "-w"); | 1268 | printf (" %s\n", "-w"); |
| @@ -1297,23 +1297,25 @@ print_help(void) | |||
| 1297 | printf (" %s\n", _("verbose")); | 1297 | printf (" %s\n", _("verbose")); |
| 1298 | 1298 | ||
| 1299 | printf ("\n"); | 1299 | printf ("\n"); |
| 1300 | printf ("%s\n\n", _("The -H switch is optional. Naming a host (or several) to check is not.")); | 1300 | printf ("%s\n", _("Notes:")); |
| 1301 | printf ("%s\n", _("Threshold format for -w and -c is 200.25,60% for 200.25 msec RTA and 60%")); | 1301 | printf (" %s\n", _("The -H switch is optional. Naming a host (or several) to check is not.")); |
| 1302 | printf ("%s\n", _("packet loss. The default values should work well for most users.")); | 1302 | printf ("\n"); |
| 1303 | printf ("%s\n", _("You can specify different RTA factors using the standardized abbreviations")); | 1303 | printf (" %s\n", _("Threshold format for -w and -c is 200.25,60% for 200.25 msec RTA and 60%")); |
| 1304 | printf ("%s\n\n", _("us (microseconds), ms (milliseconds, default) or just plain s for seconds.")); | 1304 | printf (" %s\n", _("packet loss. The default values should work well for most users.")); |
| 1305 | printf (" %s\n", _("You can specify different RTA factors using the standardized abbreviations")); | ||
| 1306 | printf (" %s\n", _("us (microseconds), ms (milliseconds, default) or just plain s for seconds.")); | ||
| 1305 | /* -d not yet implemented */ | 1307 | /* -d not yet implemented */ |
| 1306 | /* printf ("%s\n", _("Threshold format for -d is warn,crit. 12,14 means WARNING if >= 12 hops")); | 1308 | /* printf ("%s\n", _("Threshold format for -d is warn,crit. 12,14 means WARNING if >= 12 hops")); |
| 1307 | printf ("%s\n", _("are spent and CRITICAL if >= 14 hops are spent.")); | 1309 | printf ("%s\n", _("are spent and CRITICAL if >= 14 hops are spent.")); |
| 1308 | printf ("%s\n\n", _("NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not."));*/ | 1310 | printf ("%s\n\n", _("NOTE: Some systems decrease TTL when forming ICMP_ECHOREPLY, others do not."));*/ |
| 1309 | printf ("%s\n\n", _("The -v switch can be specified several times for increased verbosity.")); | 1311 | printf ("\n"); |
| 1312 | printf (" %s\n", _("The -v switch can be specified several times for increased verbosity.")); | ||
| 1310 | 1313 | ||
| 1311 | /* printf ("%s\n", _("Long options are currently unsupported.")); | 1314 | /* printf ("%s\n", _("Long options are currently unsupported.")); |
| 1312 | printf ("%s\n", _("Options marked with * require an argument")); | 1315 | printf ("%s\n", _("Options marked with * require an argument")); |
| 1313 | */ | 1316 | */ |
| 1317 | |||
| 1314 | printf (_(UT_SUPPORT)); | 1318 | printf (_(UT_SUPPORT)); |
| 1315 | |||
| 1316 | printf (_(UT_NOWARRANTY)); | ||
| 1317 | } | 1319 | } |
| 1318 | 1320 | ||
| 1319 | 1321 | ||
| @@ -1322,5 +1324,5 @@ void | |||
| 1322 | print_usage (void) | 1324 | print_usage (void) |
| 1323 | { | 1325 | { |
| 1324 | printf (_("Usage:")); | 1326 | printf (_("Usage:")); |
| 1325 | printf(" %s [options] [-H] host1 host2 hostn\n", progname); | 1327 | printf(" %s [options] [-H] host1 host2 hostN\n", progname); |
| 1326 | } | 1328 | } |
