diff options
author | Chun Li <chunl2@cisco.com> | 2018-02-06 15:17:20 +0800 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2018-02-09 09:08:01 +0000 |
commit | 15e598c76e815786dea8e964db7b6de35a2fc4ca (patch) | |
tree | f0e11fc2a5c66732d18f08c3a26ddad844ac4aa2 /src/plugins/memif/socket.c | |
parent | 08118f00e113424ca8ae22d83c766b14297a15f8 (diff) |
memif: fix crash caused by zero pkt len in memif and clear dirty cache while interface reconnect.
Change-Id: Ifc7eb2494a22c334d8899422545fca1a4bba4d05
Signed-off-by: Chun Li <chunl2@cisco.com>
Diffstat (limited to 'src/plugins/memif/socket.c')
-rw-r--r-- | src/plugins/memif/socket.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/memif/socket.c b/src/plugins/memif/socket.c index 5e14f08ac93..384a7b173c5 100644 --- a/src/plugins/memif/socket.c +++ b/src/plugins/memif/socket.c @@ -351,11 +351,16 @@ memif_msg_receive_add_ring (memif_if_t * mif, memif_msg_t * msg, int fd) mif->run.num_m2s_rings = vec_len (mif->tx_queues); } + // clear previous cache data if interface reconncected + memset (mq, 0, sizeof (memif_queue_t)); mq->int_fd = fd; mq->int_clib_file_index = ~0; mq->log2_ring_size = ar->log2_ring_size; mq->region = ar->region; mq->offset = ar->offset; + mq->type = + (ar->flags & MEMIF_MSG_ADD_RING_FLAG_S2M) ? MEMIF_RING_S2M : + MEMIF_RING_M2S; return 0; } |