Skip to content

Commit

Permalink
sys/net/gnrc/netif: don't release snip with netdev_new_api
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Nov 14, 2024
1 parent b9b8c4a commit 8eef1c1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions sys/net/gnrc/netif/gnrc_netif_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,24 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif)
return pkt;
}

static gnrc_pktsnip_t *_skip_pkt_head(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
{
if (gnrc_netif_netdev_legacy_api(netif)) {
/* we don't need the netif snip: remove it */
return gnrc_pktbuf_remove_snip(pkt, pkt);
}
else {
/* _tx_done() will free the entire list */
return pkt->next;
}
}

static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
{
int res = -ENOBUFS;

if (pkt->type == GNRC_NETTYPE_NETIF) {
/* we don't need the netif snip: remove it */
pkt = gnrc_pktbuf_remove_snip(pkt, pkt);
pkt = _skip_pkt_head(netif, pkt);
}

netdev_t *dev = netif->dev;
Expand Down

0 comments on commit 8eef1c1

Please sign in to comment.