summaryrefslogtreecommitdiffstats
path: root/web/attachments/436432-check_fping_ipv6_support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/436432-check_fping_ipv6_support.patch')
-rw-r--r--web/attachments/436432-check_fping_ipv6_support.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/web/attachments/436432-check_fping_ipv6_support.patch b/web/attachments/436432-check_fping_ipv6_support.patch
new file mode 100644
index 0000000..121a527
--- /dev/null
+++ b/web/attachments/436432-check_fping_ipv6_support.patch
@@ -0,0 +1,106 @@
1diff --git a/configure.in b/configure.in
2index 1d16bcd..fec55a0 100644
3--- a/configure.in
4+++ b/configure.in
5@@ -1364,6 +1364,17 @@ else
6 AC_MSG_WARN([Get fping from http://www.fping.com in order to make check_fping plugin])
7 fi
8
9+AC_PATH_PROG(PATH_TO_FPING6,fping6)
10+AC_ARG_WITH(fping6_command,
11+ ACX_HELP_STRING([--with-fping6-command=PATH],
12+ [Path to fping6 command]), PATH_TO_FPING6=$withval)
13+if test -n "$PATH_TO_FPING6"
14+then
15+ AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6])
16+else
17+ AC_MSG_WARN([Get fping6 from http://www.fping.com in order to make check_fping plugin])
18+fi
19+
20 AC_PATH_PROG(PATH_TO_SSH,ssh)
21 AC_ARG_WITH(ssh_command,
22 ACX_HELP_STRING([--with-ssh-command=PATH],
23diff --git a/plugins/check_fping.c b/plugins/check_fping.c
24index dd3f86d..d45e76b 100644
25--- a/plugins/check_fping.c
26+++ b/plugins/check_fping.c
27@@ -72,6 +72,7 @@ main (int argc, char **argv)
28 /* normaly should be int result = STATE_UNKNOWN; */
29
30 int status = STATE_UNKNOWN;
31+ char *fping_prog = NULL;
32 char *server = NULL;
33 char *command_line = NULL;
34 char *input_buffer = NULL;
35@@ -96,7 +97,16 @@ main (int argc, char **argv)
36 if (packet_interval)
37 asprintf(&option_string, "%s-p %d ", option_string, packet_interval);
38
39- asprintf (&command_line, "%s %s-b %d -c %d %s", PATH_TO_FPING,
40+#ifdef USE_IPV6
41+ if (address_family == AF_INET6)
42+ fping_prog = strdup(PATH_TO_FPING6);
43+ else
44+ fping_prog = strdup(PATH_TO_FPING);
45+#else
46+ fping_prog = strdup(PATH_TO_FPING);
47+#endif
48+
49+ asprintf (&command_line, "%s %s-b %d -c %d %s", fping_prog,
50 option_string, packet_size, packet_count, server);
51
52 if (verbose)
53@@ -241,6 +251,8 @@ process_arguments (int argc, char **argv)
54 {"verbose", no_argument, 0, 'v'},
55 {"version", no_argument, 0, 'V'},
56 {"help", no_argument, 0, 'h'},
57+ {"use-ipv4", no_argument, 0, '4'},
58+ {"use-ipv6", no_argument, 0, '6'},
59 {0, 0, 0, 0}
60 };
61
62@@ -258,7 +270,7 @@ process_arguments (int argc, char **argv)
63 }
64
65 while (1) {
66- c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:", longopts, &option);
67+ c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:46", longopts, &option);
68
69 if (c == -1 || c == EOF || c == 1)
70 break;
71@@ -281,6 +293,16 @@ process_arguments (int argc, char **argv)
72 }
73 server_name = strscpy (server_name, optarg);
74 break;
75+ case '4': /* IPv4 only */
76+ address_family = AF_INET;
77+ break;
78+ case '6': /* IPv6 only */
79+#ifdef USE_IPV6
80+ address_family = AF_INET6;
81+#else
82+ usage (_("IPv6 support not available\n"));
83+#endif
84+ break;
85 case 'c':
86 get_threshold (optarg, rv);
87 if (rv[RTA]) {
88@@ -402,6 +424,8 @@ print_help (void)
89 printf (UT_HELP_VRSN);
90 printf (UT_EXTRA_OPTS);
91
92+ printf (UT_IPv46);
93+
94 printf (" %s\n", "-H, --hostname=HOST");
95 printf (" %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)"));
96 printf (" %s\n", "-w, --warning=THRESHOLD");
97@@ -422,6 +446,9 @@ print_help (void)
98 printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of"));
99 printf (" %s\n", _("packet loss to trigger an alarm state."));
100
101+ printf ("\n");
102+ printf (" %s\n", _("IPv4 is used by default. Specify -6 to use IPv6."));
103+
104 printf (UT_SUPPORT);
105 }
106