Skip to content
Snippets Groups Projects
Commit 107e196b authored by Gunar Schorcht's avatar Gunar Schorcht Committed by Schorcht
Browse files

cpu/esp8266: fix of maximum frame length in esp_wif

Since complete MAC frames are handled, ETHERNET_MAX_LEN has to be used instead of ETHERNET_DATA_LEN for receive buffer size and length check.
parent 0e46869e
No related branches found
No related tags found
No related merge requests found
......@@ -145,6 +145,17 @@ void _esp_wifi_recv_cb(struct pbuf *pb, struct netif *netif)
return;
}
/* check whether packet buffer fits into receive buffer */
if (pb->len > ETHERNET_MAX_LEN) {
ESP_WIFI_DEBUG("frame length is greater than the maximum size of an "
"Ethernet frame (%u > %u)", pb->len, ETHERNET_MAX_LEN);
pbuf_free(pb);
_in_esp_wifi_recv_cb = false;
critical_exit();
mutex_unlock(&_esp_wifi_dev.dev_lock);
return;
}
/* store the frame in the buffer and free lwIP pbuf */
_esp_wifi_dev.rx_len = pb->tot_len;
pbuf_copy_partial(pb, _esp_wifi_dev.rx_buf, _esp_wifi_dev.rx_len, 0);
......@@ -277,7 +288,7 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
/* limit checks */
if (iol_len > ETHERNET_MAX_LEN) {
ESP_WIFI_DEBUG("frame length exceeds maximum (%u > %u)",
ESP_WIFI_DEBUG("frame length exceeds the maximum (%u > %u)",
iol_len, ETHERNET_MAX_LEN);
_in_send = false;
critical_exit();
......
......@@ -36,7 +36,7 @@ typedef struct
uint8_t mac[ETHERNET_ADDR_LEN]; /**< MAC address of the device */
ip_addr_t ip; /**< IPv4 address of the device */
uint8_t rx_buf[ETHERNET_DATA_LEN];/**< receive buffer */
uint8_t rx_buf[ETHERNET_MAX_LEN]; /**< receive buffer */
uint16_t rx_len; /**< number of bytes received from lwIP */
bool connected; /**< indicates the connection state to the AP */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment