summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ab3ada9)
raw | patch | inline | side by side (parent: ab3ada9)
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | |
Wed, 25 Mar 2009 01:40:06 +0000 (21:40 -0400) | ||
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | |
Wed, 25 Mar 2009 01:40:06 +0000 (21:40 -0400) |
plugins/netutils.c | patch | blob | history | |
plugins/netutils.h | patch | blob | history |
diff --git a/plugins/netutils.c b/plugins/netutils.c
index 6082cae098dc0dfec088af8ed6733b3513a476e5..1d6100abf843efd3f25a8209adbdcfa4042d8fd4 100644 (file)
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
#include "common.h"
#include "netutils.h"
-unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
int econn_refuse_state = STATE_CRITICAL;
int was_refused = FALSE;
#if USE_IPV6
socket_timeout_alarm_handler (int sig)
{
if (sig == SIGALRM)
- printf (_("CRITICAL - Socket timeout after %d seconds\n"), socket_timeout);
+ printf (_("%s - Socket timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout);
else
- printf (_("CRITICAL - Abnormal timeout after %d seconds\n"), socket_timeout);
+ printf (_("%s - Abnormal timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout);
- exit (STATE_CRITICAL);
+ exit (socket_timeout_state);
}
diff --git a/plugins/netutils.h b/plugins/netutils.h
index 6bc5386cee42a83e25e806bc1fd5d399fb147c56..b479b7411b7682beac07817e6e33c0ef2caa7e4d 100644 (file)
--- a/plugins/netutils.h
+++ b/plugins/netutils.h
# endif /* UNIX_PATH_MAX */
#endif /* HAVE_SYS_UN_H */
-RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
-
/* process_request and wrapper macros */
#define process_tcp_request(addr, port, sbuf, rbuf, rsize) \
process_request(addr, port, IPPROTO_TCP, sbuf, rbuf, rsize)
# define is_hostname(addr) resolve_host_or_addr(addr, AF_INET)
#endif
+#ifdef LOCAL_TIMEOUT_ALARM_HANDLER
extern unsigned int socket_timeout;
+extern int socket_timeout_state;
+RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
+#else
+unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
+unsigned int socket_timeout_state = STATE_CRITICAL;
+extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
+#endif
+
extern int econn_refuse_state;
extern int was_refused;
extern int address_family;