mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-10-29 20:22:52 +10:00
netfilter: nft_tunnel: fix geneve_opt dump
[ Upstream commit22a9613de4] When dumping a nft_tunnel with more than one geneve_opt configured the netlink attribute hierarchy should be as follow: NFTA_TUNNEL_KEY_OPTS | |--NFTA_TUNNEL_KEY_OPTS_GENEVE | | | |--NFTA_TUNNEL_KEY_GENEVE_CLASS | |--NFTA_TUNNEL_KEY_GENEVE_TYPE | |--NFTA_TUNNEL_KEY_GENEVE_DATA | |--NFTA_TUNNEL_KEY_OPTS_GENEVE | | | |--NFTA_TUNNEL_KEY_GENEVE_CLASS | |--NFTA_TUNNEL_KEY_GENEVE_TYPE | |--NFTA_TUNNEL_KEY_GENEVE_DATA | |--NFTA_TUNNEL_KEY_OPTS_GENEVE ... Otherwise, userspace tools won't be able to fetch the geneve options configured correctly. Fixes:925d844696("netfilter: nft_tunnel: add support for geneve opts") Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
4c6fa65ab2
commit
68b69b50df
@ -617,10 +617,10 @@ static int nft_tunnel_opts_dump(struct sk_buff *skb,
|
||||
struct geneve_opt *opt;
|
||||
int offset = 0;
|
||||
|
||||
inner = nla_nest_start_noflag(skb, NFTA_TUNNEL_KEY_OPTS_GENEVE);
|
||||
if (!inner)
|
||||
goto failure;
|
||||
while (opts->len > offset) {
|
||||
inner = nla_nest_start_noflag(skb, NFTA_TUNNEL_KEY_OPTS_GENEVE);
|
||||
if (!inner)
|
||||
goto failure;
|
||||
opt = (struct geneve_opt *)(opts->u.data + offset);
|
||||
if (nla_put_be16(skb, NFTA_TUNNEL_KEY_GENEVE_CLASS,
|
||||
opt->opt_class) ||
|
||||
@ -630,8 +630,8 @@ static int nft_tunnel_opts_dump(struct sk_buff *skb,
|
||||
opt->length * 4, opt->opt_data))
|
||||
goto inner_failure;
|
||||
offset += sizeof(*opt) + opt->length * 4;
|
||||
nla_nest_end(skb, inner);
|
||||
}
|
||||
nla_nest_end(skb, inner);
|
||||
}
|
||||
nla_nest_end(skb, nest);
|
||||
return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user