public inbox for netfilter@vger.kernel.org
 help / color / mirror / Atom feed
From: Ian Pilcher <arequipeno@gmail.com>
To: "netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: How to determine type of nftables set
Date: Mon, 8 Dec 2025 17:32:27 -0600	[thread overview]
Message-ID: <067a7b31-699f-4642-af16-9062c69e9fe2@gmail.com> (raw)

I am working on an application that will be working with pre-existing
(created by the system administrator) netfilter sets.  These sets should
contain either IPv4 of IPv6 addresses.

How can my application determine what type of address a particular set
holds?  I can query the set and get a NFT_MSG_GETSET message back, but
it's murky after that.

The message contains a NFTA_SET_KEY_TYPE attribute, which looks
promising, but I can't find anything telling me how to interpret it.
ChatGPT says that I should just look at the NFTA_SET_KEY_LEN attribute,
but that doesn't seem reliable; how would I distinguish a 32-bit IPv4
address from 2 16-bit ports?

Short of digging through the source code of nft, how am I supposed to do
this?

TIA!

-- 
========================================================================
If your user interface is intuitive in retrospect ... it isn't intuitive
========================================================================


             reply	other threads:[~2025-12-08 23:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-08 23:32 Ian Pilcher [this message]
2025-12-11 12:55 ` How to determine type of nftables set Florian Westphal

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=067a7b31-699f-4642-af16-9062c69e9fe2@gmail.com \
    --to=arequipeno@gmail.com \
    --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