netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Zagrabelny <mzagrabe@d.umn.edu>
To: netfilter <netfilter@vger.kernel.org>
Subject: counter target
Date: Fri, 25 Aug 2023 16:06:54 -0500	[thread overview]
Message-ID: <CAOLfK3WNwrokC54pspxSN89OHrfW2RTTyGsj2kBYaf-c1H-DPw@mail.gmail.com> (raw)

Greetings netfilter,

I have a question about the location of a "counter" statement.

I see from the wiki [0] that placing a counter for the default policy
comes *after* the policy:

table ip counter_demo {
    chain IN {
        type filter hook input priority filter; policy drop;

        protocol tcp counter
    }
}

That feels a little counterintuitive to place a counter after the
packet "appears" to have been dropped.

Thus, do I place other counter statements *after* their corresponding
netfilter stanzas:

table inet filter {
    chain input {
        # accept traffic originated from us
        ct state vmap {
            established: accept,
            related:     accept,
            invalid:     drop,
        }
        counter
    }
}

Or do I place the counter before:

table inet filter {
    chain input {
        counter

        # accept traffic originated from us
        ct state vmap {
            established: accept,
            related:     accept,
            invalid:     drop,
        }
    }
}

Or does it not matter?

Thanks for helping me understand.

Cheers,

-m

[0] https://wiki.nftables.org/wiki-nftables/index.php/Counters

             reply	other threads:[~2023-08-25 21:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 21:06 Matt Zagrabelny [this message]
2023-08-27 21:11 ` counter target Pablo Neira Ayuso
2023-08-31 15:25   ` Matt Zagrabelny
2023-08-31 15:32     ` Pablo Neira Ayuso
2023-08-31 15:49       ` Matt Zagrabelny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOLfK3WNwrokC54pspxSN89OHrfW2RTTyGsj2kBYaf-c1H-DPw@mail.gmail.com \
    --to=mzagrabe@d.umn.edu \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).