diff options
author | Elias Rudberg <elias.rudberg@bahnhof.net> | 2020-05-07 14:29:21 +0200 |
---|---|---|
committer | Elias Rudberg <elias.rudberg@bahnhof.net> | 2020-05-07 14:29:21 +0200 |
commit | 92e1b83a39458f98ff649883334b153f03af603b (patch) | |
tree | fe7a6accac254a3151081b5fccc27c7933d9e273 /src/plugins/lacp/input.c | |
parent | a1e03d4da71a2452c1e5da399d96c51f1b487cad (diff) |
lacp: fix regarding vm arg for vlib_time_now calls
Use thread-specific vlib_main_t *vm pointers to avoid problems with
different threads accessing the same vlib_main_t data structure.
This avoids assertion failure when vlib_time_now() is called with a vm
corresponding to a different thread.
Type: fix
Signed-off-by: Elias Rudberg <elias.rudberg@bahnhof.net>
Change-Id: I359596ecff86e03d57aa8d2330f77bf9a913485f
Diffstat (limited to 'src/plugins/lacp/input.c')
-rw-r--r-- | src/plugins/lacp/input.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/plugins/lacp/input.c b/src/plugins/lacp/input.c index ccefc20e7b2..a75c3b2aa4c 100644 --- a/src/plugins/lacp/input.c +++ b/src/plugins/lacp/input.c @@ -62,7 +62,7 @@ marker_fill_request_pdu (marker_pdu_t * marker, slave_if_t * sif) } static void -send_ethernet_marker_response_pdu (slave_if_t * sif) +send_ethernet_marker_response_pdu (vlib_main_t * vm, slave_if_t * sif) { lacp_main_t *lm = &lacp_main; u32 *to_next; @@ -71,7 +71,6 @@ send_ethernet_marker_response_pdu (slave_if_t * sif) u32 bi0; vlib_buffer_t *b0; vlib_frame_t *f; - vlib_main_t *vm = lm->vlib_main; vnet_main_t *vnm = lm->vnet_main; /* @@ -109,7 +108,7 @@ send_ethernet_marker_response_pdu (slave_if_t * sif) f->n_vectors = 1; vlib_put_frame_to_node (vm, hw->output_node_index, f); - sif->last_marker_pdu_sent_time = vlib_time_now (lm->vlib_main); + sif->last_marker_pdu_sent_time = vlib_time_now (vm); sif->marker_pdu_sent++; } @@ -126,7 +125,7 @@ handle_marker_protocol (vlib_main_t * vm, slave_if_t * sif) (marker->terminator.tlv_length != 0)) return (LACP_ERROR_BAD_TLV); - send_ethernet_marker_response_pdu (sif); + send_ethernet_marker_response_pdu (vm, sif); return LACP_ERROR_NONE; } @@ -138,7 +137,6 @@ lacp_error_t lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0) { bond_main_t *bm = &bond_main; - lacp_main_t *lm = &lacp_main; slave_if_t *sif; uword nbytes; lacp_error_t e; @@ -157,7 +155,7 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0) marker = (marker_pdu_t *) (b0->data + b0->current_data); if (marker->subtype == MARKER_SUBTYPE) { - sif->last_marker_pdu_recd_time = vlib_time_now (lm->vlib_main); + sif->last_marker_pdu_recd_time = vlib_time_now (vm); if (sif->last_marker_pkt) _vec_len (sif->last_marker_pkt) = 0; vec_validate (sif->last_marker_pkt, @@ -195,7 +193,7 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0) nbytes = vlib_buffer_contents (vm, bi0, sif->last_rx_pkt); ASSERT (nbytes <= vec_len (sif->last_rx_pkt)); - sif->last_lacpdu_recd_time = vlib_time_now (lm->vlib_main); + sif->last_lacpdu_recd_time = vlib_time_now (vm); if (nbytes < sizeof (lacp_pdu_t)) { sif->bad_pdu_received++; @@ -209,8 +207,7 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0) (sif->last_packet_signature == last_packet_signature) && ((sif->actor.state & LACP_STEADY_STATE) == LACP_STEADY_STATE)) { - lacp_start_current_while_timer (lm->vlib_main, sif, - sif->ttl_in_seconds); + lacp_start_current_while_timer (vm, sif, sif->ttl_in_seconds); e = LACP_ERROR_CACHE_HIT; } else |