pf: Show pf fragment reassembly counters.
Framgent count and statistics are stored in struct pf_status. From there pfctl(8) and systat(1) collect and show them. Note that pfctl -s info needs the -v switch to show fragments. input claudio@; OK henning@ Obtained from: OpenBSD, bluhm <bluhm@openbsd.org>, 19e99d0613 Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
@@ -391,6 +391,8 @@ static const struct snl_attr_parser ap_getstatus[] = {
|
||||
{ .type = PF_GS_CHKSUM, .off = _OUT(pf_chksum), .arg_u32 = PF_MD5_DIGEST_LENGTH, .cb = snl_attr_get_bytes },
|
||||
{ .type = PF_GS_BCOUNTERS, .off = _OUT(bcounters), .arg_u32 = 2 * 2, .cb = snl_attr_get_uint64_array },
|
||||
{ .type = PF_GS_PCOUNTERS, .off = _OUT(pcounters), .arg_u32 = 2 * 2 * 2, .cb = snl_attr_get_uint64_array },
|
||||
{ .type = PF_GS_NCOUNTERS, .off = _OUT(ncounters), .cb = snl_attr_get_counters },
|
||||
{ .type = PF_GS_FRAGMENTS, .off = _OUT(fragments), .cb = snl_attr_get_uint64 },
|
||||
};
|
||||
SNL_DECLARE_PARSER(getstatus_parser, struct genlmsghdr, snl_f_p_empty, ap_getstatus);
|
||||
#undef _OUT
|
||||
@@ -429,6 +431,7 @@ pfctl_get_status_h(struct pfctl_handle *h)
|
||||
TAILQ_INIT(&status->lcounters);
|
||||
TAILQ_INIT(&status->fcounters);
|
||||
TAILQ_INIT(&status->scounters);
|
||||
TAILQ_INIT(&status->ncounters);
|
||||
|
||||
while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) {
|
||||
if (! snl_parse_nlmsg(&h->ss, hdr, &getstatus_parser, status))
|
||||
|
||||
@@ -62,6 +62,8 @@ struct pfctl_status {
|
||||
struct pfctl_status_counters lcounters;
|
||||
struct pfctl_status_counters fcounters;
|
||||
struct pfctl_status_counters scounters;
|
||||
struct pfctl_status_counters ncounters;
|
||||
uint64_t fragments;
|
||||
uint64_t pcounters[2][2][2];
|
||||
uint64_t bcounters[2][2];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user