From 78e0aa2a773e5ee802f1cf2a3ac612620901e9ab Mon Sep 17 00:00:00 2001
From: Gunar Schorcht <gunar@schorcht.net>
Date: Wed, 23 Jan 2019 10:19:28 +0100
Subject: [PATCH] cpu/esp8266: usage of _esp_wifi_recv_cb

Overriding ethernet_input function _esp_wifi_recv_cb is only used when the WiFi interface is in connected state.
---
 cpu/esp8266/esp-wifi/esp_wifi_netdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cpu/esp8266/esp-wifi/esp_wifi_netdev.c b/cpu/esp8266/esp-wifi/esp_wifi_netdev.c
index e03f48d49e..ac923b2001 100644
--- a/cpu/esp8266/esp-wifi/esp_wifi_netdev.c
+++ b/cpu/esp8266/esp-wifi/esp_wifi_netdev.c
@@ -514,7 +514,12 @@ extern err_t __real_ethernet_input(struct pbuf *pb, struct netif* netif);
 err_t __wrap_ethernet_input(struct pbuf *pb, struct netif* netif)
 {
     ESP_WIFI_DEBUG("%p %p", pb, netif);
-    _esp_wifi_recv_cb(pb, netif);
+    if (_esp_wifi_dev.state == ESP_WIFI_CONNECTED) {
+        _esp_wifi_recv_cb(pb, netif);
+    }
+    else {
+        __real_ethernet_input(pb, netif);
+    }
     return ERR_OK;
 }
 
-- 
GitLab