Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Jozsef Kadlecsik <kadlec@netfilter.org>
To: "U.Mutlu" <um@mutluit.com>
Cc: netfilter@vger.kernel.org
Subject: Re: [libipset] How to read packet counter of a single item?
Date: Fri, 13 Oct 2023 21:05:09 +0200 (CEST)	[thread overview]
Message-ID: <64f2f344-e83a-cbbe-b8e8-a81dfacbca98@netfilter.org> (raw)
In-Reply-To: <65289DC7.9090603@mutluit.com>

Hi,

On Fri, 13 Oct 2023, U.Mutlu wrote:

> 1) Which libipset function can be used for getting
> the packet counter value of a single entry in the set/list?
> 
> Using the function ipset_parse_line(ips, line) I can issue most of the 
> ipset functions, but I need also a method for getting the packet counter 
> for just a single item only, ie. not the output of all items as "ipset 
> save" does. I need to do this in C/C++ (hence libipset in Linux), ie. 
> not in script.

There is no such functionality in ipset. You can test the existence of an 
element in a set or list/save all of them with all of the attached 
attributes.

> 2) man ipset says
> "test SETNAME TEST-ENTRY [ TEST-OPTIONS ]
>    Test whether an entry is in a set or not. Exit status number is zero if the
> tested entry is in the set and nonzero if it is missing from the set."
> 
> But the TEST-OPTIONS are not further described or documented.
> What test options are possible?

There's a single one in the case of list:set: to test the element before 
or after a reference one.

Best regards,
Jozsef
-- 
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.hu
PGP key : https://wigner.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics
          H-1525 Budapest 114, POB. 49, Hungary

  reply	other threads:[~2023-10-13 19:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-13  1:30 [libipset] How to read packet counter of a single item? U.Mutlu
2023-10-13 19:05 ` Jozsef Kadlecsik [this message]
2023-10-14 10:37   ` U.Mutlu
2023-10-14 14:24     ` Jozsef Kadlecsik

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=64f2f344-e83a-cbbe-b8e8-a81dfacbca98@netfilter.org \
    --to=kadlec@netfilter.org \
    --cc=netfilter@vger.kernel.org \
    --cc=um@mutluit.com \
    /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