From ea6a2ef4940f7b6ac7e8ec25d8dac4dd83816351 Mon Sep 17 00:00:00 2001
From: Koen Zandberg <koen@bergzand.net>
Date: Thu, 12 Jul 2018 16:15:00 +0200
Subject: [PATCH] gnrc_netif_ieee802154: drop frame on buffer error

This adds a netdev recv call to indicate that the received frame should be
dropped when there is no buffer space available to store the frame.
---
 sys/net/gnrc/netif/gnrc_netif_ieee802154.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/net/gnrc/netif/gnrc_netif_ieee802154.c b/sys/net/gnrc/netif/gnrc_netif_ieee802154.c
index f72f6ff1d4..cb9c629d6c 100644
--- a/sys/net/gnrc/netif/gnrc_netif_ieee802154.c
+++ b/sys/net/gnrc/netif/gnrc_netif_ieee802154.c
@@ -88,6 +88,8 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif)
         pkt = gnrc_pktbuf_add(NULL, NULL, bytes_expected, GNRC_NETTYPE_UNDEF);
         if (pkt == NULL) {
             DEBUG("_recv_ieee802154: cannot allocate pktsnip.\n");
+            /* Discard packet on netdev device */
+            dev->driver->recv(dev, NULL, bytes_expected, NULL);
             return NULL;
         }
         nread = dev->driver->recv(dev, pkt->data, bytes_expected, &rx_info);
-- 
GitLab