summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-02-02 15:31:12 +0100
committerThomas Haller <thaller@redhat.com>2022-02-09 19:13:03 +0100
commit1123d3a5fb3b1f1a36809d1ea55e1c21c99c35c4 (patch)
treea7d3fdcaf849150003b073cd7be2864809c705e0
parentb58711f20d91393ae80eef8f9716ba69b24cf2c2 (diff)
downloadNetworkManager-1123d3a5fb3b1f1a36809d1ea55e1c21c99c35c4.tar.gz
platform: don't check for valid ifindex in _vt_cmd_obj_is_alive_ipx_route()
_vt_cmd_obj_is_alive_ipx_route() is called by nmp_object_is_alive(). Non-alive objects are not put into the cache. That certainly makes sense for RTM_F_CLONED routes, because they are generated ad-hoc during the `ip route get` request. Checking for the ifindex is not necessary. For one, some route types (blackhole, unreachable, prohibit) don't have an ifindex. Also, the purpose of _vt_cmd_obj_is_alive_ipx_route() is not to validate the object. Just don't create objects without an ifindex, if you think the route needs an ifindex. Checking here is not useful. We also don't check that other fields like rt_source are valid, so there is no need to do it for the ifindex either.
-rw-r--r--src/libnm-platform/nmp-object.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libnm-platform/nmp-object.c b/src/libnm-platform/nmp-object.c
index ef94942e22..3154a23e80 100644
--- a/src/libnm-platform/nmp-object.c
+++ b/src/libnm-platform/nmp-object.c
@@ -1740,8 +1740,7 @@ _vt_cmd_obj_is_alive_ipx_route(const NMPObject *obj)
* Instead we create a dead object, and nmp_cache_update_netlink()
* will remove the old version of the update.
**/
- return NMP_OBJECT_CAST_IP_ROUTE(obj)->ifindex > 0
- && !NM_FLAGS_HAS(obj->ip_route.r_rtm_flags, RTM_F_CLONED);
+ return !NM_FLAGS_HAS(NMP_OBJECT_CAST_IP_ROUTE(obj)->r_rtm_flags, RTM_F_CLONED);
}
static gboolean