diff options
author | Pim van Pelt <pim@ipng.nl> | 2023-10-06 11:26:33 +0200 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2024-01-10 14:49:25 +0000 |
commit | 2c9b128e1b3732f9dd62699922480f9206a02b2d (patch) | |
tree | c298875846843f34828269346adaa02f160e3e15 /src/plugins/linux-cp/lcp_interface_sync.c | |
parent | 2fa69effc844d7a27d46c0f163c0840df961eb2d (diff) |
linux-cp: Fix looping netlink messages
Signal when consuming a batch of netlink messages, in order to inhibit
lcp_sync from generating new netlink messages. This avoids link up/down
state changess from triggering an infinite loop.
Do this in the regular case of nl_route_process_msgs()
and in the special case of re-synchronizing in lcp_nl_recv_dump_replies().
Type: fix
Change-Id: I419d3f9aa350c119b3778b644c65165cb4cc1bef
Signed-off-by: Pim van Pelt <pim@ipng.nl>
Diffstat (limited to 'src/plugins/linux-cp/lcp_interface_sync.c')
-rw-r--r-- | src/plugins/linux-cp/lcp_interface_sync.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/linux-cp/lcp_interface_sync.c b/src/plugins/linux-cp/lcp_interface_sync.c index bd26ebbc354..ca7638e1799 100644 --- a/src/plugins/linux-cp/lcp_interface_sync.c +++ b/src/plugins/linux-cp/lcp_interface_sync.c @@ -37,7 +37,7 @@ lcp_itf_pair_sync_state (lcp_itf_pair_t *lip) u32 mtu; u32 netlink_mtu; - if (!lcp_sync ()) + if (!lcp_sync () || lcp_get_netlink_processing_active ()) return; sw = @@ -176,7 +176,7 @@ lcp_itf_admin_state_change (vnet_main_t *vnm, u32 sw_if_index, u32 flags) vnet_hw_interface_t *hi; vnet_sw_interface_t *si; - if (!lcp_sync ()) + if (!lcp_sync () || lcp_get_netlink_processing_active ()) return 0; LCP_ITF_PAIR_DBG ("admin_state_change: sw %U %u", @@ -223,7 +223,8 @@ lcp_itf_mtu_change (vnet_main_t *vnm, u32 sw_if_index, u32 flags) { vnet_sw_interface_t *si; vnet_hw_interface_t *hi; - if (!lcp_sync ()) + + if (!lcp_sync () || lcp_get_netlink_processing_active ()) return NULL; LCP_ITF_PAIR_DBG ("mtu_change: sw %U %u", format_vnet_sw_if_index_name, vnm, @@ -271,7 +272,7 @@ lcp_itf_ip4_add_del_interface_addr (ip4_main_t *im, uword opaque, int curr_ns_fd = -1; int vif_ns_fd = -1; - if (!lcp_sync ()) + if (!lcp_sync () || lcp_get_netlink_processing_active ()) return; LCP_ITF_PAIR_DBG ("ip4_addr_%s: si:%U %U/%u", is_del ? "del" : "add", @@ -320,7 +321,7 @@ lcp_itf_ip6_add_del_interface_addr (ip6_main_t *im, uword opaque, int curr_ns_fd = -1; int vif_ns_fd = -1; - if (!lcp_sync ()) + if (!lcp_sync () || lcp_get_netlink_processing_active ()) return; LCP_ITF_PAIR_DBG ("ip6_addr_%s: si:%U %U/%u", is_del ? "del" : "add", |