summaryrefslogtreecommitdiffstats
path: root/plugins/check_icmp.c
diff options
context:
space:
mode:
authorBenoit Mortier <opensides@users.sourceforge.net>2004-12-05 00:54:09 (GMT)
committerBenoit Mortier <opensides@users.sourceforge.net>2004-12-05 00:54:09 (GMT)
commit2ab4d8fc278413b01ff9c4e4496f892398f80a4c (patch)
tree6d402f5bf1b4673d00f97bbb84b1ea6b4badd060 /plugins/check_icmp.c
parente9e1fe6ef5720adf355b605ffdbe94cd608cc46c (diff)
downloadmonitoring-plugins-2ab4d8fc278413b01ff9c4e4496f892398f80a4c.tar.gz
fix patch 998291
fix patch 1078934 expect check_ssh fix and check_nt perfdata should stay on one word like in nagios git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1004 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_icmp.c')
-rw-r--r--plugins/check_icmp.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/plugins/check_icmp.c b/plugins/check_icmp.c
index 45bfcc5..361e924 100644
--- a/plugins/check_icmp.c
+++ b/plugins/check_icmp.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * check_icmp - A hack of fping2 to work with nagios. 2 * $Id$
3 * This way we don't have to use the output parser. 3 *
4 * This is a hack of fping2 made to work with nagios.
5 * It's fast and removes the necessity of parsing another programs output.
4 * 6 *
5 * VIEWING NOTES: 7 * VIEWING NOTES:
6 * This file was formatted with tab indents at a tab stop of 4. 8 * This file was formatted with tab indents at a tab stop of 4.
@@ -40,14 +42,8 @@
40#include <netinet/in_systm.h> 42#include <netinet/in_systm.h>
41#include <netinet/in.h> 43#include <netinet/in.h>
42 44
43/* Linux has bizarre ip.h and ip_icmp.h */
44/* Taken from the fping distro. Thank you. */
45#if defined( __linux__ )
46#include "linux.h"
47#else
48#include <netinet/ip.h> 45#include <netinet/ip.h>
49#include <netinet/ip_icmp.h> 46#include <netinet/ip_icmp.h>
50#endif /* defined(__linux__) */
51 47
52#include <arpa/inet.h> 48#include <arpa/inet.h>
53#include <netdb.h> 49#include <netdb.h>
@@ -70,9 +66,8 @@ extern char *optarg;
70extern int optind, opterr; 66extern int optind, opterr;
71 67
72/*** Constants ***/ 68/*** Constants ***/
73#define REV_DATE "2004-09-06"
74#define EMAIL "ae@op5.se" 69#define EMAIL "ae@op5.se"
75#define VERSION "0.8" 70#define VERSION "0.8.1"
76 71
77#ifndef INADDR_NONE 72#ifndef INADDR_NONE
78# define INADDR_NONE 0xffffffU 73# define INADDR_NONE 0xffffffU
@@ -441,7 +436,7 @@ int main(int argc, char **argv)
441 break; 436 break;
442 437
443 case 'v': 438 case 'v':
444 printf("%s: Version %s $Date$\n", prog, VERSION, REV_DATE); 439 printf("%s: Version %s $Date$\n", prog, VERSION);
445 printf("%s: comments to %s\n", prog, EMAIL); 440 printf("%s: comments to %s\n", prog, EMAIL);
446 exit(STATE_OK); 441 exit(STATE_OK);
447 442
@@ -1275,7 +1270,7 @@ void u_sleep(int u_sec)
1275 * crash on any other errrors 1270 * crash on any other errrors
1276 ************************************************************/ 1271 ************************************************************/
1277/* TODO: add MSG_DONTWAIT to recvfrom flags (currently 0) */ 1272/* TODO: add MSG_DONTWAIT to recvfrom flags (currently 0) */
1278int recvfrom_wto(int sock, char *buf, int len, struct sockaddr *saddr, int timo) 1273int recvfrom_wto(int lsock, char *buf, int len, struct sockaddr *saddr, int timo)
1279{ 1274{
1280 int nfound = 0, slen, n; 1275 int nfound = 0, slen, n;
1281 struct timeval to; 1276 struct timeval to;
@@ -1289,8 +1284,8 @@ int recvfrom_wto(int sock, char *buf, int len, struct sockaddr *saddr, int timo)
1289 1284
1290 FD_ZERO(&readset); 1285 FD_ZERO(&readset);
1291 FD_ZERO(&writeset); 1286 FD_ZERO(&writeset);
1292 FD_SET(sock, &readset); 1287 FD_SET(lsock, &readset);
1293 nfound = select(sock + 1, &readset, &writeset, NULL, &to); 1288 nfound = select(lsock + 1, &readset, &writeset, NULL, &to);
1294 if(nfound < 0) crash("select() in recvfrom_wto"); 1289 if(nfound < 0) crash("select() in recvfrom_wto");
1295 1290
1296 if(nfound == 0) return -1; /* timeout */ 1291 if(nfound == 0) return -1; /* timeout */