platform: parse routes of any type to handle replace
When you issue ip route replace broadcast 1.2.3.4/32 dev eth0 then this route may well replace a (unicast) route that we have in the cache. Previously, we would right away ignore such messages in _new_from_nl_route(), which means we miss the fact that a route gets replaced. Instead, we need to parse the message at least so far, that we can detect and handle the replace.
This commit is contained in:
@@ -3787,15 +3787,6 @@ _new_from_nl_route(const struct nlmsghdr *nlh, gboolean id_only, ParseNlmsgIter
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (!NM_IN_SET(rtm->rtm_type,
|
||||
RTN_UNICAST,
|
||||
RTN_LOCAL,
|
||||
RTN_BLACKHOLE,
|
||||
RTN_UNREACHABLE,
|
||||
RTN_PROHIBIT,
|
||||
RTN_THROW))
|
||||
return NULL;
|
||||
|
||||
if (nlmsg_parse_arr(nlh, sizeof(struct rtmsg), tb, policy) < 0)
|
||||
return NULL;
|
||||
|
||||
@@ -5331,6 +5322,17 @@ ip_route_is_alive(const NMPlatformIPRoute *route)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!NM_IN_SET(nm_platform_route_type_uncoerce(route->type_coerced),
|
||||
RTN_UNICAST,
|
||||
RTN_LOCAL,
|
||||
RTN_BLACKHOLE,
|
||||
RTN_UNREACHABLE,
|
||||
RTN_PROHIBIT,
|
||||
RTN_THROW)) {
|
||||
/* Certain route types are ignored and not placed into the cache. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user