Skip to content

Commit

Permalink
netfilter: nft_nat: allow to specify layer 4 protocol NAT only
Browse files Browse the repository at this point in the history
nft_nat reports a bogus EAFNOSUPPORT if no layer 3 information is specified.

Fixes: d07db98 ("netfilter: nf_tables: introduce nft_validate_register_load()")
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
ummakynes committed Jul 23, 2021
1 parent 30a56a2 commit a33f387
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/netfilter/nft_nat.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
alen = sizeof_field(struct nf_nat_range, min_addr.ip6);
break;
default:
return -EAFNOSUPPORT;
if (tb[NFTA_NAT_REG_ADDR_MIN])
return -EAFNOSUPPORT;
break;
}
priv->family = family;

Expand Down

0 comments on commit a33f387

Please sign in to comment.