diff options
author | 2024-01-24 12:09:47 +1100 | |
---|---|---|
committer | 2025-02-25 16:57:59 +0000 | |
commit | 3979037173d4054bdff3be236cd33514c809ff85 (patch) | |
tree | 9f8d643fe0c04500ce12bd35e9da89e3499f5998 | |
parent | 94f61d294f4083bf78a0e1dad763fa5990e0ed6d (diff) |
ping: Check only PING_RESPONSE_IP4 and PING_RESPONSE_IP6 events
Check only PING_RESPONSE_IP4 and PING_RESPONSE_IP6
in ping binary API so it doesn't block other binary API
requests while working. (current version of ping binary API
can read other events like SOCKET_READ_EVENT, for example).
Type: fix
Change-Id: Ie7c5c92322af28633680c9c0d60fed739d4e65a0
Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
-rw-r--r-- | src/plugins/ping/ping_api.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/ping/ping_api.c b/src/plugins/ping/ping_api.c index 5578fa560f2..a5af1033d0e 100644 --- a/src/plugins/ping/ping_api.c +++ b/src/plugins/ping/ping_api.c @@ -122,16 +122,22 @@ vl_api_want_ping_finished_events_t_handler ( while ((sleep_interval = time_ping_sent + ping_interval - vlib_time_now (vm)) > 0.0) { - uword event_type; + uword event_count; vlib_process_wait_for_event_or_clock (vm, sleep_interval); - event_type = vlib_process_get_events (vm, 0); - if (event_type == ~0) + if (dst_addr.version == AF_IP4) + event_count = + vlib_process_get_events_with_type (vm, 0, PING_RESPONSE_IP4); + else if (dst_addr.version == AF_IP6) + event_count = + vlib_process_get_events_with_type (vm, 0, PING_RESPONSE_IP6); + else break; - if (event_type == PING_RESPONSE_IP4 || - event_type == PING_RESPONSE_IP6) - reply_count += 1; + if (event_count == 0) + break; + + reply_count += 1; } } |