summaryrefslogtreecommitdiffstats
path: root/web/attachments/209934-check_ping-1.4.5-filtered-packets.diff
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/209934-check_ping-1.4.5-filtered-packets.diff')
-rw-r--r--web/attachments/209934-check_ping-1.4.5-filtered-packets.diff40
1 files changed, 40 insertions, 0 deletions
diff --git a/web/attachments/209934-check_ping-1.4.5-filtered-packets.diff b/web/attachments/209934-check_ping-1.4.5-filtered-packets.diff
new file mode 100644
index 0000000..e738d27
--- /dev/null
+++ b/web/attachments/209934-check_ping-1.4.5-filtered-packets.diff
@@ -0,0 +1,40 @@
1diff -r -u nagios-plugins-1.4.5.old/plugins/check_ping.c nagios-plugins-1.4.5/plugins/check_ping.c
2--- nagios-plugins-1.4.5.old/plugins/check_ping.c 2006-10-19 01:25:16.000000000 +0100
3+++ nagios-plugins-1.4.5/plugins/check_ping.c 2007-01-05 18:17:12.000000000 +0000
4@@ -503,6 +503,27 @@
5 int
6 error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
7 {
8+ /*
9+ * This constant shouldn't be here. It is bad practice, and just
10+ * generally offensive to the sensibilities. Unfortunately, the
11+ * relevant constant, MAX_HOST_ADDRESS_LENGTH, is an enum, which means
12+ * I can't compile-time cat it into a scanf format string.
13+ *
14+ * I could change the common header to work around this, but that's
15+ * invasive. I could sprintf a scanf string, but then I need about 5
16+ * times the memory (for a sprintf buffer of unknown length). Since I
17+ * intend to report my problem as a bug to the Nagios maintainers I'll
18+ * just leave it for them to fix as they feel best fits the
19+ * application -- they're the experts, after all, I'm just a device
20+ * for ensuring RFC1925 Section 2(1) compliancy, and this does it. I
21+ * would never put this in my own code, got it? I'm just not sure
22+ * what the house style dictates in this case.
23+ *
24+ * Maybe this variable shouldn't even be here -- it looks awfully
25+ * lonely, doesn't it? Dunno. It works for me, though.
26+ */
27+ char filter_host[256+1];
28+
29 if (strstr (buf, "Network is unreachable"))
30 die (STATE_CRITICAL, _("CRITICAL - Network unreachable (%s)"), addr);
31 else if (strstr (buf, "Destination Host Unreachable"))
32@@ -511,6 +532,8 @@
33 die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr);
34 else if (strstr (buf, "Time to live exceeded"))
35 die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)"), addr);
36+ else if (sscanf (buf, "From %256s %*s Packet filtered", filter_host) == 1)
37+ die (STATE_CRITICAL, _("CRITICAL - Packet filtered by %s (%s)"), filter_host, addr);
38
39 if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) {
40 if (warn_text == NULL)