netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Phil Sutter <phil@nwl.cc>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>, Eric Garver <e@erig.me>,
	netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH v2] src: Convert ip {s,d}addr to IPv4-mapped as needed
Date: Wed, 10 Dec 2025 16:14:49 +0100	[thread overview]
Message-ID: <aTmOaUEmL0P_h0sy@strlen.de> (raw)
In-Reply-To: <20251210150333.14654-1-phil@nwl.cc>

Phil Sutter <phil@nwl.cc> wrote:
> Note that adding IPv4 addresses to sets of type ip6addr_type is still
> rejected although easily enabled by passing AI_V4MAPPED flag to
> getaddrinfo(): Since this also resolves DNS names, users may
> unexpectedly add a host's IPv4 address in mapped notation if the name
> doesn't resolve to an IPv6 address for whatever reason. If we really
> want to open this can of worms, it deserves a separate patch anyway.

I think we should force AI_NUMERICHOST when AI_V4MAPPED gets added, i.e.
never autofill in a v4mapped address for ip6addr_type when all we had
was a name.

> +# ip saddr ::ffff:1.2.3.4
> +ip test-ip4 input
> +  [ payload load 4b @ network header + 12 => reg 1 ]
> +  [ cmp eq reg 1 0x04030201 ]

Makes sense, no expansion.

> +# ip saddr @ip6addrset
> +ip test-ip4 input
> +  [ immediate reg 1 0x00000000 0x00000000 0xffff0000 ]
> +  [ payload load 4b @ network header + 12 => reg 11 ]
> +  [ lookup reg 1 set ip6addrset ]

Looks good to me, thanks for working on this.

  reply	other threads:[~2025-12-10 15:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 15:03 [nft PATCH v2] src: Convert ip {s,d}addr to IPv4-mapped as needed Phil Sutter
2025-12-10 15:14 ` Florian Westphal [this message]
2025-12-10 15:28   ` Phil Sutter
2025-12-10 16:03     ` 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=aTmOaUEmL0P_h0sy@strlen.de \
    --to=fw@strlen.de \
    --cc=e@erig.me \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    /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 NNTP newsgroup(s).