From: Fernando Fernandez Mancera <fmancera@suse.de>
To: netfilter-devel@vger.kernel.org
Cc: coreteam@netfilter.org, pablo@netfilter.org, fw@strlen.de,
phil@nwl.cc, Fernando Fernandez Mancera <fmancera@suse.de>
Subject: [PATCH nf-next] netfilter: nft_nat: use the right enum members for nat type switch
Date: Tue, 22 Sep 2026 18:40:59 +0200 [thread overview]
Message-ID: <20260922164059.4320-1-fmancera@suse.de> (raw)
The member 'type' from struct 'nft_nat' is of type enum
nf_nat_manip_type but at the switch statements for
nft_nat_setup_netmap() and nft_nat_validate() functions the members from
nft_nat_types enum were used instead.
This does not cause any problem but is worth fixing for correctness.
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
---
Note: found this while working on something else but confused for a
bit.. so I guess it is worth fixing.
---
net/netfilter/nft_nat.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index e32cd9fbc7c2..2691cfb10290 100644
--- a/net/netfilter/nft_nat.c
+++ b/net/netfilter/nft_nat.c
@@ -70,7 +70,7 @@ static void nft_nat_setup_netmap(struct nf_nat_range2 *range,
int i, len = 0;
switch (priv->type) {
- case NFT_NAT_SNAT:
+ case NF_NAT_MANIP_SRC:
if (nft_pf(pkt) == NFPROTO_IPV4) {
new_addr.ip = ip_hdr(skb)->saddr;
len = sizeof(struct in_addr);
@@ -79,7 +79,7 @@ static void nft_nat_setup_netmap(struct nf_nat_range2 *range,
len = sizeof(struct in6_addr);
}
break;
- case NFT_NAT_DNAT:
+ case NF_NAT_MANIP_DST:
if (nft_pf(pkt) == NFPROTO_IPV4) {
new_addr.ip = ip_hdr(skb)->daddr;
len = sizeof(struct in_addr);
@@ -152,12 +152,12 @@ static int nft_nat_validate(const struct nft_ctx *ctx,
return err;
switch (priv->type) {
- case NFT_NAT_SNAT:
+ case NF_NAT_MANIP_SRC:
err = nft_chain_validate_hooks(ctx->chain,
(1 << NF_INET_POST_ROUTING) |
(1 << NF_INET_LOCAL_IN));
break;
- case NFT_NAT_DNAT:
+ case NF_NAT_MANIP_DST:
err = nft_chain_validate_hooks(ctx->chain,
(1 << NF_INET_PRE_ROUTING) |
(1 << NF_INET_LOCAL_OUT));
--
2.55.0
next reply other threads:[~2026-09-22 16:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 16:40 Fernando Fernandez Mancera [this message]
2026-09-22 16:51 ` [PATCH nf-next] netfilter: nft_nat: use the right enum members for nat type switch Phil Sutter
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=20260922164059.4320-1-fmancera@suse.de \
--to=fmancera@suse.de \
--cc=coreteam@netfilter.org \
--cc=fw@strlen.de \
--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