* [PATCH nft] src: netlink: fix crash when ops doesn't support udata
@ 2025-05-08 14:29 Florian Westphal
2025-05-09 22:27 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2025-05-08 14:29 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
Whenever a new version adds udata support to an expression, then old
versions of nft will crash when trying to list such a ruleset generated
by a more recent version of nftables.
Fix this by falling back to 'type' format.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/netlink.c b/src/netlink.c
index 25ee3419772b..5825a68d03bc 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -913,7 +913,7 @@ static struct expr *set_make_key(const struct nftnl_udata *attr)
etype = nftnl_udata_get_u32(ud[NFTNL_UDATA_SET_TYPEOF_EXPR]);
ops = expr_ops_by_type_u32(etype);
- if (!ops)
+ if (!ops || !ops->parse_udata)
return NULL;
expr = ops->parse_udata(ud[NFTNL_UDATA_SET_TYPEOF_DATA]);
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH nft] src: netlink: fix crash when ops doesn't support udata
2025-05-08 14:29 [PATCH nft] src: netlink: fix crash when ops doesn't support udata Florian Westphal
@ 2025-05-09 22:27 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2025-05-09 22:27 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Thu, May 08, 2025 at 04:29:04PM +0200, Florian Westphal wrote:
> Whenever a new version adds udata support to an expression, then old
> versions of nft will crash when trying to list such a ruleset generated
> by a more recent version of nftables.
>
> Fix this by falling back to 'type' format.
Fixes: 6e48df5329ea ('src: add "typeof" build/parse/print support')
> Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
Thanks.
> ---
> src/netlink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/netlink.c b/src/netlink.c
> index 25ee3419772b..5825a68d03bc 100644
> --- a/src/netlink.c
> +++ b/src/netlink.c
> @@ -913,7 +913,7 @@ static struct expr *set_make_key(const struct nftnl_udata *attr)
>
> etype = nftnl_udata_get_u32(ud[NFTNL_UDATA_SET_TYPEOF_EXPR]);
> ops = expr_ops_by_type_u32(etype);
> - if (!ops)
> + if (!ops || !ops->parse_udata)
> return NULL;
>
> expr = ops->parse_udata(ud[NFTNL_UDATA_SET_TYPEOF_DATA]);
> --
> 2.49.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-09 22:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-08 14:29 [PATCH nft] src: netlink: fix crash when ops doesn't support udata Florian Westphal
2025-05-09 22:27 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.