Skip to contentSkip to conversation

iproute_lwtunnel: stop encap xfrm parsing at an unknown word

PATCH New Dave Seddon 1 participant 1 message Nov 24

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iproute_lwtunnel: stop encap xfrm parsing at an unknown word

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
---
 ip/iproute_lwtunnel.c | 2 ++
 1 file changed, 2 insertions(+)
ip/iproute_lwtunnel.c +2 -0
index 9a1e747c..6b110552 100644
@@ -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;
Signature · 1 line
2.56.0