From 3045fa6a0f39efe02d5b57a7f7082165d1ed1565 Mon Sep 17 00:00:00 2001 From: staphen Date: Sat, 1 Jan 2022 05:29:12 -0500 Subject: [PATCH] Lock calls to netif->input() in VirtualTap --- src/VirtualTap.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/VirtualTap.cpp b/src/VirtualTap.cpp index a13dcbd..f0b2260 100644 --- a/src/VirtualTap.cpp +++ b/src/VirtualTap.cpp @@ -454,18 +454,22 @@ void zts_lwip_eth_rx( if (Utils::ntoh(ethhdr.type) == 0x800 || Utils::ntoh(ethhdr.type) == 0x806) { if (tap->netif4) { + LOCK_TCPIP_CORE(); if ((err = ((struct netif*)tap->netif4)->input(p, (struct netif*)tap->netif4)) != ERR_OK) { // DEBUG_ERROR("packet input error (%d)", err); pbuf_free(p); } + UNLOCK_TCPIP_CORE(); } } if (Utils::ntoh(ethhdr.type) == 0x86DD) { if (tap->netif6) { + LOCK_TCPIP_CORE(); if ((err = ((struct netif*)tap->netif6)->input(p, (struct netif*)tap->netif6)) != ERR_OK) { // DEBUG_ERROR("packet input error (%d)", err); pbuf_free(p); } + UNLOCK_TCPIP_CORE(); } } }