Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Frank Wunderlich <frank-w@public-files.de>
Cc: Frank Myhr <fmyhr@fhmtech.com>, Florian Westphal <fw@strlen.de>,
	netfilter@vger.kernel.org
Subject: Re: Re: nft show counter
Date: Thu, 1 Apr 2021 20:14:14 +0200	[thread overview]
Message-ID: <20210401181414.GF13699@breakpoint.cc> (raw)
In-Reply-To: <trinity-e144cb32-0c89-44a6-b0f6-5b9edcf5e457-1617264512699@3c-app-gmx-bap06>

Frank Wunderlich <frank-w@public-files.de> wrote:
> my rules-file looks like this now (just for anybody wants do do similar):
> 
> table ip filter {
>     ...
>     chain FORWARD {
>         type filter hook forward priority 0; policy drop;
>         #...
>         ip saddr $ipvoipbox udp dport 5160 counter name voip1 comment "counting packets for SIP1"
>         ip daddr $ipvoipbox udp dport 5160 counter name voip1 comment "counting packets for SIP1"
>         ip saddr $ipvoipbox udp sport 5161 counter name voip2 comment "counting packets for SIP2"
>         ip daddr $ipvoipbox udp dport 5161 counter name voip2 comment "counting packets for SIP2"
>         #...
>     }

For two counters it makes no difference but note that you can combine
named counters with maps:

map voipcounters {
 type ipv4_addr . inet_service : counter
 elements = { 10.0.1.1 . 5160 : "voip1", 10.2.1.1 . 5161 : ...

and then count with one rule only:

counter name ip saddr . udp dport map @voipcounters

> one thing:
> 
> # nft list counter filter voip2
> table ip mangle {
> }
> table ip nat {
> }
> table ip filter {
> 	counter voip2 {
> 		packets 124 bytes 7440
> 	}
> }

Can't repro so looks like this is already fixed.

> tables mangle and nat should not be printed (still have them separately from converting iptables to nft)...in json-format it is right

Yes, they should not be printed.

  parent reply	other threads:[~2021-04-01 18:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 17:47 nft show counter Frank Wunderlich
2021-03-31 21:23 ` Frank Myhr
2021-03-31 21:40 ` Florian Westphal
2021-03-31 23:08   ` Frank Myhr
2021-04-01  8:08     ` Aw: " Frank Wunderlich
2021-04-01 16:42       ` Anton Rieger
2021-04-02 17:16         ` Frank Myhr
2021-04-02 17:42           ` Frank Wunderlich
2021-04-03 17:04             ` Frank Myhr
2021-04-02 22:22           ` Anton Rieger
2021-04-01 18:14       ` Florian Westphal [this message]
2021-04-01 18:31         ` Frank Wunderlich
2021-04-01 20:03           ` Florian Westphal
2021-04-02 11:58         ` Aw: " Frank Wunderlich
2021-04-02 17:10           ` Frank Myhr
2021-04-01 18:21     ` Florian Westphal
2021-07-22 19:57   ` manual : CONNTRACK EXPRESSIONS pauloric
2021-07-23 15:00     ` Pablo Neira Ayuso

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=20210401181414.GF13699@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=fmyhr@fhmtech.com \
    --cc=frank-w@public-files.de \
    --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