aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2018-10-11 14:09:58 +0300
committerDamjan Marion <dmarion@me.com>2018-10-11 23:38:24 +0000
commit125760947a642f0cd5a016deb899a78d83340379 (patch)
treee9867ef68e18b200a0096325cab6b242d71b1340
parent0d222f88edb0ba7011f0d717f075e579beef3570 (diff)
bfd:fix handling session creation batch
when multiple session creating script is ran (via exec) only the first one actually starts Change-Id: I0fc36f65795c8921cf180e0b555c446e5a80be45 Signed-off-by: Eyal Bari <ebari@cisco.com> (cherry picked from commit 0db9b04cf0f9c892a00988e7a61ae703aa83b721)
-rw-r--r--src/vnet/bfd/bfd_main.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/src/vnet/bfd/bfd_main.c b/src/vnet/bfd/bfd_main.c
index 55ea23dea41..bd2addf3b0f 100644
--- a/src/vnet/bfd/bfd_main.c
+++ b/src/vnet/bfd/bfd_main.c
@@ -1165,6 +1165,7 @@ bfd_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
}
}
now = clib_cpu_time_now ();
+ uword *session_index;
switch (event_type)
{
case ~0: /* no events => timeout */
@@ -1180,35 +1181,41 @@ bfd_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
* each event or timeout */
break;
case BFD_EVENT_NEW_SESSION:
- bfd_lock (bm);
- if (!pool_is_free_index (bm->sessions, *event_data))
- {
- bfd_session_t *bs =
- pool_elt_at_index (bm->sessions, *event_data);
- bfd_send_periodic (vm, rt, bm, bs, now);
- bfd_set_timer (bm, bs, now, 1);
- }
- else
- {
- BFD_DBG ("Ignoring event for non-existent session index %u",
- (u32) * event_data);
- }
- bfd_unlock (bm);
+ vec_foreach (session_index, event_data)
+ {
+ bfd_lock (bm);
+ if (!pool_is_free_index (bm->sessions, *session_index))
+ {
+ bfd_session_t *bs =
+ pool_elt_at_index (bm->sessions, *session_index);
+ bfd_send_periodic (vm, rt, bm, bs, now);
+ bfd_set_timer (bm, bs, now, 1);
+ }
+ else
+ {
+ BFD_DBG ("Ignoring event for non-existent session index %u",
+ (u32) * session_index);
+ }
+ bfd_unlock (bm);
+ }
break;
case BFD_EVENT_CONFIG_CHANGED:
- bfd_lock (bm);
- if (!pool_is_free_index (bm->sessions, *event_data))
- {
- bfd_session_t *bs =
- pool_elt_at_index (bm->sessions, *event_data);
- bfd_on_config_change (vm, rt, bm, bs, now);
- }
- else
- {
- BFD_DBG ("Ignoring event for non-existent session index %u",
- (u32) * event_data);
- }
- bfd_unlock (bm);
+ vec_foreach (session_index, event_data)
+ {
+ bfd_lock (bm);
+ if (!pool_is_free_index (bm->sessions, *session_index))
+ {
+ bfd_session_t *bs =
+ pool_elt_at_index (bm->sessions, *session_index);
+ bfd_on_config_change (vm, rt, bm, bs, now);
+ }
+ else
+ {
+ BFD_DBG ("Ignoring event for non-existent session index %u",
+ (u32) * session_index);
+ }
+ bfd_unlock (bm);
+ }
break;
default:
vlib_log_err (bm->log_class, "BUG: event type 0x%wx", event_type);