mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 07:40:08 +01:00
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:
parent
854f2cc1fc
commit
4ec2123aa2
1 changed files with 11 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue