From 090ff4ae95f5a04c0bfbb636cd0d70611c7c3ee4 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 16 Feb 2023 13:25:17 +0100 Subject: [PATCH] platform: limit retry count on link change This is a nice safeguard, also consistent with ip_route_get(). --- src/libnm-platform/nm-linux-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index dbc3ec4b34..367faa9ceb 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -8251,6 +8251,7 @@ do_change_link(NMPlatform *platform, const char *log_detail; gs_free char *log_detail_free = NULL; const NMPObject *obj_cache; + int try_count = 0; if (!nm_platform_netns_push(platform, &netns)) { log_level = LOGL_ERR; @@ -8329,7 +8330,7 @@ out: wait_for_nl_response_to_string(seq_result, extack_msg, s_buf, sizeof(s_buf)), log_detail); - if (result == -EAGAIN) + if (result == -EAGAIN && ++try_count < RESYNC_RETRIES) goto retry; return result;