Netdev List
 help / color / mirror / Atom feed
From: Dave Seddon <dave.seddon.ca@gmail.com>
To: netdev@vger.kernel.org
Cc: Dave Seddon <dave.seddon.ca@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	David Ahern <dsahern@kernel.org>,
	Eyal Birger <eyal.birger@gmail.com>
Subject: [PATCH iproute2] iproute_lwtunnel: stop encap xfrm parsing at an unknown word
Date: Mon, 23 Nov 2026 22:01:41 -0800	[thread overview]
Message-ID: <20261124060141.3393569-1-dave.seddon.ca@gmail.com> (raw)

parse_encap_xfrm() consumes every word after "encap xfrm" and drops the
route options that follow without an error:

  ip route add 198.51.100.0/24 dev lo encap xfrm if_id 7 table 100 metric 7

adds the route to table main with no metric. Break at the first unknown
word, as the other encap parsers do.

Fixes: 75776cf2472d ("ip: xfrm: support adding xfrm metadata as lwtunnel info in routes")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 ip/iproute_lwtunnel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 9a1e747c..6b110552 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -2276,6 +2276,8 @@ static int parse_encap_xfrm(struct rtattr *rta, size_t len,
 			ret = rta_addattr32(rta, len, LWT_XFRM_LINK, link);
 		} else if (!strcmp(*argv, "help")) {
 			lwt_xfrm_usage();
+		} else {
+			break;
 		}
 		if (ret)
 			break;
-- 
2.56.0


                 reply	other threads:[~2026-11-24  6:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261124060141.3393569-1-dave.seddon.ca@gmail.com \
    --to=dave.seddon.ca@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=eyal.birger@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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