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

Function print_espstats

tools/netstat/ipsec.c:323–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323static void
324print_espstats(const struct espstat *espstat)
325{
326 xo_open_container("esp-statictics");
327#define p(f, n, m) if (espstat->f || sflag <= 1) \
328 xo_emit("\t{:" n "/%ju} {N:/" m "}\n", \
329 (uintmax_t)espstat->f, plural(espstat->f))
330#define hist(f, n, t, c) \
331 ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t), (c));
332
333 p(esps_hdrops, "dropped-short-header",
334 "packet%s shorter than header shows");
335 p(esps_nopf, "dropped-bad-protocol",
336 "packet%s dropped; protocol family not supported");
337 p(esps_notdb, "dropped-no-tdb", "packet%s dropped; no TDB");
338 p(esps_badkcr, "dropped-bad-kcr", "packet%s dropped; bad KCR");
339 p(esps_qfull, "dropped-queue-full", "packet%s dropped; queue full");
340 p(esps_noxform, "dropped-no-transform",
341 "packet%s dropped; no transform");
342 p(esps_badilen, "dropped-bad-length", "packet%s dropped; bad ilen");
343 p(esps_wrap, "replay-counter-wraps", "replay counter wrap%s");
344 p(esps_badenc, "dropped-bad-crypto",
345 "packet%s dropped; bad encryption detected");
346 p(esps_badauth, "dropped-bad-auth",
347 "packet%s dropped; bad authentication detected");
348 p(esps_replay, "possible-replay-detected",
349 "possible replay packet%s detected");
350 p(esps_input, "received-packets", "packet%s in");
351 p(esps_output, "sent-packets", "packet%s out");
352 p(esps_invalid, "dropped-bad-tdb", "packet%s dropped; invalid TDB");
353 p(esps_ibytes, "receieve-bytes", "byte%s in");
354 p(esps_obytes, "sent-bytes", "byte%s out");
355 p(esps_toobig, "dropped-too-large",
356 "packet%s dropped; larger than IP_MAXPACKET");
357 p(esps_pdrops, "dropped-policy-violation",
358 "packet%s blocked due to policy");
359 p(esps_crypto, "crypto-failures", "crypto processing failure%s");
360 p(esps_tunnel, "tunnel-failures", "tunnel sanity check failure%s");
361 hist(espstat->esps_hist, ipsec_espnames,
362 "ESP output", "esp-output-histogram");
363
364#undef p
365#undef hist
366 xo_close_container("esp-statictics");
367}
368
369void
370esp_stats(u_long off, const char *name, int family __unused, int proto __unused)

Callers 1

esp_statsFunction · 0.85

Calls 2

xo_open_containerFunction · 0.85
xo_close_containerFunction · 0.85

Tested by

no test coverage detected