MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ip6_stats

Function ip6_stats

tools/netstat/inet6.c:358–605  ·  view source on GitHub ↗

* Dump IP6 statistics structure. */

Source from the content-addressed store, hash-verified

356 * Dump IP6 statistics structure.
357 */
358void
359ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
360{
361 struct ip6stat ip6stat;
362 int first, i;
363
364 if (fetch_stats("net.inet6.ip6.stats", off, &ip6stat,
365 sizeof(ip6stat), kread_counters) != 0)
366 return;
367
368 xo_open_container(name);
369 xo_emit("{T:/%s}:\n", name);
370
371#define p(f, m) if (ip6stat.f || sflag <= 1) \
372 xo_emit(m, (uintmax_t)ip6stat.f, plural(ip6stat.f))
373#define p1a(f, m) if (ip6stat.f || sflag <= 1) \
374 xo_emit(m, (uintmax_t)ip6stat.f)
375
376 p(ip6s_total, "\t{:received-packets/%ju} "
377 "{N:/total packet%s received}\n");
378 p1a(ip6s_toosmall, "\t{:dropped-below-minimum-size/%ju} "
379 "{N:/with size smaller than minimum}\n");
380 p1a(ip6s_tooshort, "\t{:dropped-short-packets/%ju} "
381 "{N:/with data size < data length}\n");
382 p1a(ip6s_badoptions, "\t{:dropped-bad-options/%ju} "
383 "{N:/with bad options}\n");
384 p1a(ip6s_badvers, "\t{:dropped-bad-version/%ju} "
385 "{N:/with incorrect version number}\n");
386 p(ip6s_fragments, "\t{:received-fragments/%ju} "
387 "{N:/fragment%s received}\n");
388 p(ip6s_fragdropped, "\t{:dropped-fragment/%ju} "
389 "{N:/fragment%s dropped (dup or out of space)}\n");
390 p(ip6s_fragtimeout, "\t{:dropped-fragment-after-timeout/%ju} "
391 "{N:/fragment%s dropped after timeout}\n");
392 p(ip6s_fragoverflow, "\t{:dropped-fragments-overflow/%ju} "
393 "{N:/fragment%s that exceeded limit}\n");
394 p(ip6s_atomicfrags, "\t{:atomic-fragments/%ju} "
395 "{N:/atomic fragment%s}\n");
396 p(ip6s_reassembled, "\t{:reassembled-packets/%ju} "
397 "{N:/packet%s reassembled ok}\n");
398 p(ip6s_delivered, "\t{:received-local-packets/%ju} "
399 "{N:/packet%s for this host}\n");
400 p(ip6s_forward, "\t{:forwarded-packets/%ju} "
401 "{N:/packet%s forwarded}\n");
402 p(ip6s_cantforward, "\t{:packets-not-forwardable/%ju} "
403 "{N:/packet%s not forwardable}\n");
404 p(ip6s_redirectsent, "\t{:sent-redirects/%ju} "
405 "{N:/redirect%s sent}\n");
406 p(ip6s_localout, "\t{:sent-packets/%ju} "
407 "{N:/packet%s sent from this host}\n");
408 p(ip6s_rawout, "\t{:send-packets-fabricated-header/%ju} "
409 "{N:/packet%s sent with fabricated ip header}\n");
410 p(ip6s_odropped, "\t{:discard-no-mbufs/%ju} "
411 "{N:/output packet%s dropped due to no bufs, etc.}\n");
412 p(ip6s_noroute, "\t{:discard-no-route/%ju} "
413 "{N:/output packet%s discarded due to no route}\n");
414 p(ip6s_fragmented, "\t{:sent-fragments/%ju} "
415 "{N:/output datagram%s fragmented}\n");

Callers

nothing calls this directly

Calls 9

fetch_statsFunction · 0.85
xo_open_containerFunction · 0.85
xo_emitFunction · 0.85
xo_open_listFunction · 0.85
xo_open_instanceFunction · 0.85
xo_close_instanceFunction · 0.85
xo_close_listFunction · 0.85
if_indextonameFunction · 0.85
xo_close_containerFunction · 0.85

Tested by

no test coverage detected