From: Yuya Kusakabe <yuya.kusakabe@gmail.com>
To: David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Justin Iurman <justin.iurman@gmail.com>,
Alexander Aring <alex.aring@gmail.com>,
Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Nikolay Aleksandrov <razor@blackwall.org>,
Eyal Birger <eyal.birger@gmail.com>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
Xin Long <lucien.xin@gmail.com>, Shuah Khan <shuah@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Yuya Kusakabe <yuya.kusakabe@gmail.com>
Subject: [PATCH net 2/4] xfrm: lwtunnel: accept RTA_ENCAP without NLA_F_NESTED
Date: Wed, 23 Sep 2026 09:36:57 +0900 [thread overview]
Message-ID: <20260923-lwt-encap-noflag-v1-2-8de7ab6c86e9@gmail.com> (raw)
In-Reply-To: <20260923-lwt-encap-noflag-v1-0-8de7ab6c86e9@gmail.com>
xfrmi_build_state() parses RTA_ENCAP with nla_parse_nested(), which
requires NLA_F_NESTED, but lwtunnel_fill_encap() dumps RTA_ENCAP
without it. As a result, "ip route restore" cannot restore the routes
saved by "ip route save":
# ip -6 route add 2001:db8:3::/64 dev ipsec0 encap xfrm if_id 1
# ip -6 route save 2001:db8:3::/64 > route.bin
# ip -6 route del 2001:db8:3::/64
# ip -6 route restore < route.bin
Error: NLA_F_NESTED is missing.
Use lwtunnel_nla_parse().
Fixes: 2c2493b9da91 ("xfrm: lwtunnel: add lwtunnel support for xfrm interfaces in collect_md mode")
Assisted-by: LLM
Signed-off-by: Yuya Kusakabe <yuya.kusakabe@gmail.com>
---
net/xfrm/xfrm_interface_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_interface_core.c b/net/xfrm/xfrm_interface_core.c
index 688306bf62c5..2fcfbfac315a 100644
--- a/net/xfrm/xfrm_interface_core.c
+++ b/net/xfrm/xfrm_interface_core.c
@@ -80,7 +80,8 @@ static int xfrmi_build_state(struct net *net, struct nlattr *nla,
struct xfrm_md_info *info;
int ret;
- ret = nla_parse_nested(tb, LWT_XFRM_MAX, nla, xfrm_lwt_policy, extack);
+ ret = lwtunnel_nla_parse(tb, LWT_XFRM_MAX, nla, xfrm_lwt_policy,
+ extack);
if (ret < 0)
return ret;
--
2.50.1
next prev parent reply other threads:[~2026-09-23 0:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 0:36 [PATCH net 0/4] net: lwtunnel: accept encap attributes without NLA_F_NESTED Yuya Kusakabe
2026-09-23 0:36 ` [PATCH net 1/4] net: lwtunnel: accept RTA_ENCAP " Yuya Kusakabe
2026-09-27 1:24 ` netdev-bot+sashiko
2026-09-23 0:36 ` Yuya Kusakabe [this message]
2026-09-23 0:36 ` [PATCH net 3/4] net: ip_tunnel: accept tunnel options " Yuya Kusakabe
2026-09-27 1:25 ` netdev-bot+sashiko
2026-09-23 0:36 ` [PATCH net 4/4] selftests: net: add lwtunnel route save and restore test Yuya Kusakabe
2026-09-27 1:25 ` netdev-bot+sashiko
2026-09-23 11:29 ` [PATCH net 0/4] net: lwtunnel: accept encap attributes without NLA_F_NESTED Ido Schimmel
2026-09-23 11:59 ` Yuya Kusakabe
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=20260923-lwt-encap-noflag-v1-2-8de7ab6c86e9@gmail.com \
--to=yuya.kusakabe@gmail.com \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=eyal.birger@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=justin.iurman@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=shuah@kernel.org \
--cc=steffen.klassert@secunet.com \
/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