From ad4aae7a3262460137c9a287819ee2957e882581 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 18 Sep 2025 18:32:16 +0200 Subject: netlink: Drop nexthop state flags from routes we duplicate The kernel doesn't like those (EINVAL) on RTM_NEWROUTE, as they are flags representing states, not configuration. Link: https://github.com/containers/podman/discussions/27104 Signed-off-by: Stefano Brivio Reviewed-by: David Gibson Reviewed-by: Paul Holzinger --- netlink.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netlink.c b/netlink.c index 8f82e73..c436780 100644 --- a/netlink.c +++ b/netlink.c @@ -565,6 +565,11 @@ int nl_route_dup(int s_src, unsigned int ifi_src, if (nh->nlmsg_type != RTM_NEWROUTE) continue; + /* nexthop state flags don't apply to freshly created routes, + * and the kernel will refuse our route if they are set. + */ + rtm->rtm_flags &= ~RTNH_COMPARE_MASK; + for (rta = RTM_RTA(rtm), na = RTM_PAYLOAD(nh); RTA_OK(rta, na); rta = RTA_NEXT(rta, na)) { /* RTA_OIF and RTA_MULTIPATH attributes carry the -- cgit v1.2.3