aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bfd
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2018-10-11 14:09:58 +0300
committerJohn Lo <loj@cisco.com>2018-10-11 19:37:43 +0000
commit0db9b04cf0f9c892a00988e7a61ae703aa83b721 (patch)
tree6f055db0d0a9a7e8d8d691349cf8943ca8a6d35c /src/vnet/bfd
parentd29cc8893e4736f18d0fd21b0407527621886d1a (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>
Diffstat (limited to 'src/vnet/bfd')
-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);