Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Frank Wunderlich <frank-w@public-files.de>
Cc: Florian Westphal <fw@strlen.de>, Frank Myhr <fmyhr@fhmtech.com>,
	netfilter@vger.kernel.org
Subject: Re: Re: nft show counter
Date: Thu, 1 Apr 2021 22:03:33 +0200	[thread overview]
Message-ID: <20210401200333.GH13699@breakpoint.cc> (raw)
In-Reply-To: <902B82E6-79AE-4C04-B2CA-C860662911EC@public-files.de>

Frank Wunderlich <frank-w@public-files.de> wrote:
> Am 1. April 2021 20:14:14 MESZ schrieb Florian Westphal <fw@strlen.de>:
> >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
> 
> Have seen maps,but have not understood them :(

Its just a set that returns a value instead of simple 'in set/not in
set'.

> The ip is always same ($ipvoipbox),only port differs (sip1+sip2) and this bidirectional (saddr/daddr,sport/dport) to catch traffic from/to this ip separated by sip-streams.
> 
> Your example seems to match only source-addr and destination port.

Yes, it was an example.

> Maybe its possible to match "addr" (saddr or daddr) and "port" (sport or dport),so i can have only 2 rules...with map maybe only 1

There is no 'or', so you will need two rules at a minimum if you want to
match in either direction.

map voipcounters {
	type inet_service : counter
	elements = { 5160 : "voip1", 5161 : "voip2" }
}

ip saddr $ipvoipbox counter name udp sport map @voipcounters
ip daddr $ipvoipbox counter name udp dport map @voipcounters

This says 'fetch name of counter to use from @voipcounters, with 'udp
sport/udp dport' as search key.

but with just two counters its not worth it.

  reply	other threads:[~2021-04-01 20:03 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
2021-04-01 18:31         ` Frank Wunderlich
2021-04-01 20:03           ` Florian Westphal [this message]
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=20210401200333.GH13699@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