* [PATCH nf] netfilter: nft_osf: restrict it to ipv6
@ 2026-04-14 11:08 Pablo Neira Ayuso
2026-04-14 11:15 ` Florian Westphal
2026-04-14 11:53 ` Fernando Fernandez Mancera
0 siblings, 2 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2026-04-14 11:08 UTC (permalink / raw)
To: netfilter-devel
This expression only supports for ipv4, restrict it.
Fixes: b96af92d6eaf ("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nft_osf.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c
index 1c0b493ef0a9..bdc2f6c90e2f 100644
--- a/net/netfilter/nft_osf.c
+++ b/net/netfilter/nft_osf.c
@@ -28,6 +28,11 @@ static void nft_osf_eval(const struct nft_expr *expr, struct nft_regs *regs,
struct nf_osf_data data;
struct tcphdr _tcph;
+ if (nft_pf(pkt) != NFPROTO_IPV4) {
+ regs->verdict.code = NFT_BREAK;
+ return;
+ }
+
if (pkt->tprot != IPPROTO_TCP) {
regs->verdict.code = NFT_BREAK;
return;
@@ -114,7 +119,6 @@ static int nft_osf_validate(const struct nft_ctx *ctx,
switch (ctx->family) {
case NFPROTO_IPV4:
- case NFPROTO_IPV6:
case NFPROTO_INET:
hooks = (1 << NF_INET_LOCAL_IN) |
(1 << NF_INET_PRE_ROUTING) |
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH nf] netfilter: nft_osf: restrict it to ipv6
2026-04-14 11:08 [PATCH nf] netfilter: nft_osf: restrict it to ipv6 Pablo Neira Ayuso
@ 2026-04-14 11:15 ` Florian Westphal
2026-04-14 11:53 ` Fernando Fernandez Mancera
1 sibling, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2026-04-14 11:15 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> This expression only supports for ipv4, restrict it.
:-O
Acked-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH nf] netfilter: nft_osf: restrict it to ipv6
2026-04-14 11:08 [PATCH nf] netfilter: nft_osf: restrict it to ipv6 Pablo Neira Ayuso
2026-04-14 11:15 ` Florian Westphal
@ 2026-04-14 11:53 ` Fernando Fernandez Mancera
1 sibling, 0 replies; 3+ messages in thread
From: Fernando Fernandez Mancera @ 2026-04-14 11:53 UTC (permalink / raw)
To: Pablo Neira Ayuso, netfilter-devel
On 4/14/26 1:08 PM, Pablo Neira Ayuso wrote:
> This expression only supports for ipv4, restrict it.
>
> Fixes: b96af92d6eaf ("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf")
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> net/netfilter/nft_osf.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c
> index 1c0b493ef0a9..bdc2f6c90e2f 100644
> --- a/net/netfilter/nft_osf.c
> +++ b/net/netfilter/nft_osf.c
> @@ -28,6 +28,11 @@ static void nft_osf_eval(const struct nft_expr *expr, struct nft_regs *regs,
> struct nf_osf_data data;
> struct tcphdr _tcph;
>
> + if (nft_pf(pkt) != NFPROTO_IPV4) {
> + regs->verdict.code = NFT_BREAK;
> + return;
> + }
> +
> if (pkt->tprot != IPPROTO_TCP) {
> regs->verdict.code = NFT_BREAK;
> return;
> @@ -114,7 +119,6 @@ static int nft_osf_validate(const struct nft_ctx *ctx,
>
> switch (ctx->family) {
> case NFPROTO_IPV4:
> - case NFPROTO_IPV6:
> case NFPROTO_INET:
> hooks = (1 << NF_INET_LOCAL_IN) |
> (1 << NF_INET_PRE_ROUTING) |
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
I have the feeling I should re-review everything I did 7 years ago :-)
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-14 11:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14 11:08 [PATCH nf] netfilter: nft_osf: restrict it to ipv6 Pablo Neira Ayuso
2026-04-14 11:15 ` Florian Westphal
2026-04-14 11:53 ` Fernando Fernandez Mancera
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox