diff options
Diffstat (limited to 'web/attachments/56819-ping.diff')
-rw-r--r-- | web/attachments/56819-ping.diff | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/web/attachments/56819-ping.diff b/web/attachments/56819-ping.diff new file mode 100644 index 0000000..8a849a1 --- /dev/null +++ b/web/attachments/56819-ping.diff | |||
@@ -0,0 +1,120 @@ | |||
1 | *** check_ping.c.orig Mon Jan 13 20:15:16 2003 | ||
2 | --- check_ping.c Wed Jul 23 14:38:19 2003 | ||
3 | *************** | ||
4 | *** 19,25 **** | ||
5 | |||
6 | #define OPTIONS "\ | ||
7 | -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ | ||
8 | ! [-p packets] [-t timeout] [-L]\n" | ||
9 | |||
10 | #define LONGOPTIONS "\ | ||
11 | -H, --hostname=HOST\n\ | ||
12 | --- 19,26 ---- | ||
13 | |||
14 | #define OPTIONS "\ | ||
15 | -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ | ||
16 | ! [-p packets] [-t timeout] [-6] [-L]\n" | ||
17 | ! | ||
18 | |||
19 | #define LONGOPTIONS "\ | ||
20 | -H, --hostname=HOST\n\ | ||
21 | *************** | ||
22 | *** 32,37 **** | ||
23 | --- 33,40 ---- | ||
24 | number of ICMP ECHO packets to send (Default: %d)\n\ | ||
25 | -t, --timeout=INTEGER\n\ | ||
26 | optional specified timeout in second (Default: %d)\n\ | ||
27 | + -6, --use-ping6\n\ | ||
28 | + use ping6 for ICMPv6 instead of ping for IPv4\n\ | ||
29 | -L, --link\n\ | ||
30 | show HTML in the plugin output (obsoleted by urlize)\n\ | ||
31 | THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel\n\ | ||
32 | *************** | ||
33 | *** 70,81 **** | ||
34 | --- 73,87 ---- | ||
35 | char *server_address = NULL; | ||
36 | int max_packets = -1; | ||
37 | int verbose = FALSE; | ||
38 | + int ipv6 = FALSE; | ||
39 | |||
40 | float rta = UNKNOWN_TRIP_TIME; | ||
41 | int pl = UNKNOWN_PACKET_LOSS; | ||
42 | |||
43 | char *warn_text = NULL; | ||
44 | |||
45 | + #define PING6_COMMAND "/sbin/ping6 -n -c %d %s" | ||
46 | + | ||
47 | int | ||
48 | main (int argc, char **argv) | ||
49 | { | ||
50 | *************** | ||
51 | *** 86,98 **** | ||
52 | usage ("Could not parse arguments"); | ||
53 | exit; | ||
54 | |||
55 | /* does the host address of number of packets argument come first? */ | ||
56 | #ifdef PING_PACKETS_FIRST | ||
57 | asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
58 | #else | ||
59 | asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
60 | #endif | ||
61 | ! | ||
62 | /* Set signal handling and alarm */ | ||
63 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
64 | printf ("Cannot catch SIGALRM"); | ||
65 | --- 92,108 ---- | ||
66 | usage ("Could not parse arguments"); | ||
67 | exit; | ||
68 | |||
69 | + #ifdef PING6_COMMAND | ||
70 | + asprintf (&command_line, ipv6 ? PING6_COMMAND : PING_COMMAND, max_packets, server_address); | ||
71 | + #else | ||
72 | + | ||
73 | /* does the host address of number of packets argument come first? */ | ||
74 | #ifdef PING_PACKETS_FIRST | ||
75 | asprintf (&command_line, PING_COMMAND, max_packets, server_address); | ||
76 | #else | ||
77 | asprintf (&command_line, PING_COMMAND, server_address, max_packets); | ||
78 | #endif | ||
79 | ! #endif | ||
80 | /* Set signal handling and alarm */ | ||
81 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | ||
82 | printf ("Cannot catch SIGALRM"); | ||
83 | *************** | ||
84 | *** 157,167 **** | ||
85 | {"packets", required_argument, 0, 'p'}, | ||
86 | {"nohtml", no_argument, 0, 'n'}, | ||
87 | {"link", no_argument, 0, 'L'}, | ||
88 | {0, 0, 0, 0} | ||
89 | }; | ||
90 | #endif | ||
91 | |||
92 | ! #define OPTCHARS "Vvht:c:w:H:p:nL" | ||
93 | |||
94 | if (argc < 2) | ||
95 | return ERROR; | ||
96 | --- 167,178 ---- | ||
97 | {"packets", required_argument, 0, 'p'}, | ||
98 | {"nohtml", no_argument, 0, 'n'}, | ||
99 | {"link", no_argument, 0, 'L'}, | ||
100 | + {"use-ping6", no_argument, 0, '6'}, | ||
101 | {0, 0, 0, 0} | ||
102 | }; | ||
103 | #endif | ||
104 | |||
105 | ! #define OPTCHARS "Vvht:c:w:H:p:n6L" | ||
106 | |||
107 | if (argc < 2) | ||
108 | return ERROR; | ||
109 | *************** | ||
110 | *** 213,218 **** | ||
111 | --- 224,232 ---- | ||
112 | break; | ||
113 | case 'L': /* show HTML */ | ||
114 | display_html = TRUE; | ||
115 | + break; | ||
116 | + case '6': | ||
117 | + ipv6 = TRUE; | ||
118 | break; | ||
119 | case 'c': | ||
120 | get_threshold (optarg, &crta, &cpl); | ||