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

Function mrt_stats

tools/netstat/mroute.c:412–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412void
413mrt_stats()
414{
415 struct mrtstat mrtstat;
416 u_long mstaddr;
417
418 mstaddr = nl[N_MRTSTAT].n_value;
419
420 if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat,
421 sizeof(mrtstat), kread_counters) != 0) {
422 if ((live && errno == ENOENT) || (!live && mstaddr == 0))
423 fprintf(stderr, "No IPv4 MROUTING kernel support.\n");
424 return;
425 }
426
427 xo_emit("{T:IPv4 multicast forwarding}:\n");
428
429#define p(f, m) if (mrtstat.f || sflag <= 1) \
430 xo_emit(m, (uintmax_t)mrtstat.f, plural(mrtstat.f))
431#define p2(f, m) if (mrtstat.f || sflag <= 1) \
432 xo_emit(m, (uintmax_t)mrtstat.f, plurales(mrtstat.f))
433
434 xo_open_container("multicast-statistics");
435
436 p(mrts_mfc_lookups, "\t{:cache-lookups/%ju} "
437 "{N:/multicast forwarding cache lookup%s}\n");
438 p2(mrts_mfc_misses, "\t{:cache-misses/%ju} "
439 "{N:/multicast forwarding cache miss%s}\n");
440 p(mrts_upcalls, "\t{:upcalls-total/%ju} "
441 "{N:/upcall%s to multicast routing daemon}\n");
442 p(mrts_upq_ovflw, "\t{:upcall-overflows/%ju} "
443 "{N:/upcall queue overflow%s}\n");
444 p(mrts_upq_sockfull,
445 "\t{:upcalls-dropped-full-buffer/%ju} "
446 "{N:/upcall%s dropped due to full socket buffer}\n");
447 p(mrts_cache_cleanups, "\t{:cache-cleanups/%ju} "
448 "{N:/cache cleanup%s}\n");
449 p(mrts_no_route, "\t{:dropped-no-origin/%ju} "
450 "{N:/datagram%s with no route for origin}\n");
451 p(mrts_bad_tunnel, "\t{:dropped-bad-tunnel/%ju} "
452 "{N:/datagram%s arrived with bad tunneling}\n");
453 p(mrts_cant_tunnel, "\t{:dropped-could-not-tunnel/%ju} "
454 "{N:/datagram%s could not be tunneled}\n");
455 p(mrts_wrong_if, "\t{:dropped-wrong-incoming-interface/%ju} "
456 "{N:/datagram%s arrived on wrong interface}\n");
457 p(mrts_drop_sel, "\t{:dropped-selectively/%ju} "
458 "{N:/datagram%s selectively dropped}\n");
459 p(mrts_q_overflow, "\t{:dropped-queue-overflow/%ju} "
460 "{N:/datagram%s dropped due to queue overflow}\n");
461 p(mrts_pkt2large, "\t{:dropped-too-large/%ju} "
462 "{N:/datagram%s dropped for being too large}\n");
463
464#undef p2
465#undef p
466}

Callers 1

main.cFile · 0.85

Calls 3

fetch_statsFunction · 0.85
xo_emitFunction · 0.85
xo_open_containerFunction · 0.85

Tested by

no test coverage detected