3 * The Regents of the University of California. All rights reserved.
4 * Michael Tuexen. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the University nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include <sys/cdefs.h>
32 #include <sys/param.h>
33 #include <sys/types.h>
34 #include <sys/socket.h>
35 #include <sys/sysctl.h>
37 #include <netinet/sctp.h>
46 static struct sctpstat curstat, initstat, oldstat;
50 --0123456789012345678901234567890123456789012345678901234567890123456789012345
51 00 SCTP Associations SCTP Packets
52 01999999999999 associations initiated 999999999999 packets sent
53 02999999999999 associations accepted 999999999999 packets received
54 03999999999999 associations restarted 999999999999 - out of the blue
55 04999999999999 associations terminated 999999999999 - bad vtag
56 05999999999999 associations aborted 999999999999 - bad crc32c
58 07 SCTP Timers SCTP Chunks
59 08999999999999 init timeouts 999999999999 control chunks sent
60 09999999999999 cookie timeouts 999999999999 data chunks sent
61 10999999999999 data timeouts 999999999999 - ordered
62 11999999999999 delayed sack timeouts 999999999999 - unordered
63 12999999999999 shutdown timeouts 999999999999 control chunks received
64 13999999999999 shutdown-ack timeouts 999999999999 data chunks received
65 14999999999999 shutdown guard timeouts 999999999999 - ordered
66 15999999999999 heartbeat timeouts 999999999999 - unordered
67 16999999999999 path MTU timeouts
68 17999999999999 autoclose timeouts SCTP user messages
69 18999999999999 asconf timeouts 999999999999 fragmented
70 19999999999999 stream reset timeouts 999999999999 reassembled
71 --0123456789012345678901234567890123456789012345678901234567890123456789012345
78 return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
94 wmove(wnd, 0, 0); wclrtoeol(wnd);
95 #define L(row, str) mvwprintw(wnd, row, 13, str)
96 #define R(row, str) mvwprintw(wnd, row, 51, str);
97 L(0, "SCTP Associations"); R(0, "SCTP Packets");
98 L(1, "associations initiated"); R(1, "packets sent");
99 L(2, "associations accepted"); R(2, "packets received");
100 L(3, "associations restarted"); R(3, "- out of the blue");
101 L(4, "associations terminated"); R(4, "- bad vtag");
102 L(5, "associations aborted"); R(5, "- bad crc32c");
104 L(7, "SCTP Timers"); R(7, "SCTP Chunks");
105 L(8, "init timeouts"); R(8, "control chunks sent");
106 L(9, "cookie timeouts"); R(9, "data chunks sent");
107 L(10, "data timeouts"); R(10, "- ordered");
108 L(11, "delayed sack timeouts"); R(11, "- unordered");
109 L(12, "shutdown timeouts"); R(12, "control chunks received");
110 L(13, "shutdown-ack timeouts"); R(13, "data chunks received");
111 L(14, "shutdown guard timeouts"); R(14, "- ordered");
112 L(15, "heartbeat timeouts"); R(15, "- unordered");
113 L(16, "path MTU timeouts");
114 L(17, "autoclose timeouts"); R(17, "SCTP User Messages");
115 L(18, "asconf timeouts"); R(18, "fragmented");
116 L(19, "stream reset timeouts"); R(19, "reassembled");
122 domode(struct sctpstat *ret)
124 const struct sctpstat *sub;
127 switch(currentmode) {
130 divisor = (delay > 1000000) ? delay / 1000000 : 1;
142 #define DO(stat) ret->stat = (curstat.stat - sub->stat) / divisor
144 DO(sctps_activeestab);
145 DO(sctps_restartestab);
146 DO(sctps_collisionestab);
147 DO(sctps_passiveestab);
150 DO(sctps_outoftheblue);
151 DO(sctps_checksumerrors);
152 DO(sctps_outcontrolchunks);
153 DO(sctps_outorderchunks);
154 DO(sctps_outunorderchunks);
155 DO(sctps_incontrolchunks);
156 DO(sctps_inorderchunks);
157 DO(sctps_inunorderchunks);
158 DO(sctps_fragusrmsgs);
159 DO(sctps_reasmusrmsgs);
160 DO(sctps_outpackets);
163 DO(sctps_recvpackets);
164 DO(sctps_recvdatagrams);
165 DO(sctps_recvpktwithdata);
168 DO(sctps_recvdupdata);
169 DO(sctps_recvheartbeat);
170 DO(sctps_recvheartbeatack);
173 DO(sctps_recvauthmissing);
174 DO(sctps_recvivalhmacid);
175 DO(sctps_recvivalkeyid);
176 DO(sctps_recvauthfailed);
177 DO(sctps_recvexpress);
178 DO(sctps_recvexpressm);
182 DO(sctps_sendpackets);
185 DO(sctps_sendretransdata);
186 DO(sctps_sendfastretrans);
187 DO(sctps_sendmultfastretrans);
188 DO(sctps_sendheartbeat);
191 DO(sctps_senderrors);
210 DO(sctps_timoiterator);
212 DO(sctps_timowindowprobe);
215 DO(sctps_timoshutdown);
216 DO(sctps_timoheartbeat);
217 DO(sctps_timocookie);
218 DO(sctps_timosecret);
219 DO(sctps_timopathmtu);
220 DO(sctps_timoshutdownack);
221 DO(sctps_timoshutdownguard);
222 DO(sctps_timostrmrst);
223 DO(sctps_timoearlyfr);
224 DO(sctps_timoasconf);
225 DO(sctps_timodelprim);
226 DO(sctps_timoautoclose);
227 DO(sctps_timoassockill);
228 DO(sctps_timoinpkill);
236 DO(sctps_fastretransinrtt);
237 DO(sctps_markedretrans);
239 DO(sctps_naglequeued);
240 DO(sctps_maxburstqueued);
241 DO(sctps_ifnomemqueued);
242 DO(sctps_windowprobed);
243 DO(sctps_lowlevelerr);
244 DO(sctps_lowlevelerrusr);
245 DO(sctps_datadropchklmt);
246 DO(sctps_datadroprwnd);
247 DO(sctps_ecnereducedcwnd);
248 DO(sctps_vtagexpress);
250 DO(sctps_primary_randry);
251 DO(sctps_cmt_randry);
252 DO(sctps_slowpath_sack);
253 DO(sctps_wu_sacks_sent);
254 DO(sctps_sends_with_flags);
255 DO(sctps_sends_with_unord);
256 DO(sctps_sends_with_eof);
257 DO(sctps_sends_with_abort);
258 DO(sctps_protocol_drain_calls);
259 DO(sctps_protocol_drains_done);
260 DO(sctps_read_peeks);
261 DO(sctps_cached_chk);
262 DO(sctps_cached_strmoq);
263 DO(sctps_left_abandon);
264 DO(sctps_send_burst_avoid);
265 DO(sctps_send_cwnd_avoid);
266 DO(sctps_fwdtsn_map_over);
267 DO(sctps_queue_upd_ecne);
274 struct sctpstat stats;
276 memset(&stats, 0, sizeof stats);
279 #define DO(stat, row, col) \
280 mvwprintw(wnd, row, col, "%12lu", stats.stat)
281 #define L(row, stat) DO(stat, row, 0)
282 #define R(row, stat) DO(stat, row, 38)
283 L(1, sctps_activeestab); R(1, sctps_outpackets);
284 L(2, sctps_passiveestab); R(2, sctps_inpackets);
285 L(3, sctps_restartestab); R(3, sctps_outoftheblue);
286 L(4, sctps_shutdown); R(4, sctps_badvtag);
287 L(5, sctps_aborted); R(5, sctps_checksumerrors);
290 L(8, sctps_timoinit); R(8, sctps_outcontrolchunks);
291 L(9, sctps_timocookie); R(9, sctps_senddata);
292 L(10, sctps_timodata); R(10, sctps_outorderchunks);
293 L(11, sctps_timosack); R(11, sctps_outunorderchunks);
294 L(12, sctps_timoshutdown); R(12, sctps_incontrolchunks);
295 L(13, sctps_timoshutdownack); R(13, sctps_recvdata);
296 L(14, sctps_timoshutdownguard); R(14, sctps_inorderchunks);
297 L(15, sctps_timoheartbeat); R(15, sctps_inunorderchunks);
298 L(16, sctps_timopathmtu);
299 L(17, sctps_timoautoclose);
300 L(18, sctps_timoasconf); R(18, sctps_fragusrmsgs);
301 L(19, sctps_timostrmrst); R(19, sctps_reasmusrmsgs);
311 const char *name = "net.inet.sctp.stats";
314 if (sysctlbyname(name, NULL, &len, NULL, 0) < 0) {
315 error("sysctl getting sctpstat size failed");
318 if (len > sizeof curstat) {
319 error("sctpstat structure has grown--recompile systat!");
322 if (sysctlbyname(name, &initstat, &len, NULL, 0) < 0) {
323 error("sysctl getting sctpstat failed");
334 const char *name = "net.inet.sctp.stats";
336 len = sizeof initstat;
337 if (sysctlbyname(name, &initstat, &len, NULL, 0) < 0) {
338 error("sysctl getting sctpstat failed");
347 const char *name = "net.inet.sctp.stats";
350 len = sizeof curstat;
351 if (sysctlbyname(name, &curstat, &len, NULL, 0) < 0) {
352 error("sysctl getting sctpstat failed");