core: don't create dependent onlink route for onlink routes

If the route with a next hop is already onlink, we don't need to add a
direct route to the gateway.

It also wouldn't work previously, because the onlink route to the
gateway that we would add, would have no gateway and the RTNH_F_ONLINK
set. Kernel would reject that with an error. We would have to clear the
RTNH_F_ONLINK flag, if there is no gateway.
This commit is contained in:
Thomas Haller
2023-02-01 21:33:06 +01:00
parent 8b14849877
commit 93b46c8906

View File

@@ -2563,6 +2563,9 @@ nm_l3_config_data_add_dependent_onlink_routes(NML3ConfigData *self, int addr_fam
if (nm_ip_addr_is_null(addr_family, p_gateway))
continue;
if (NM_FLAGS_HAS(route_src->rx.r_rtm_flags, (unsigned) RTNH_F_ONLINK))
continue;
if (_data_get_direct_route_for_host(self, addr_family, p_gateway))
continue;