diff --git a/cpu/native/ng_tapnet/ng_tapnet.c b/cpu/native/ng_tapnet/ng_tapnet.c index cdfcb2f0341b..3ae1dbc5f529 100644 --- a/cpu/native/ng_tapnet/ng_tapnet.c +++ b/cpu/native/ng_tapnet/ng_tapnet.c @@ -100,12 +100,14 @@ const ng_netdev_driver_t ng_tapnet_driver = { static inline bool _has_src(ng_pktsnip_t *pkt) { - return (pkt->size != (sizeof(ng_netif_hdr_t) + (2 * NG_ETHERNET_ADDR_LEN))); + return ((pkt->size > sizeof(ng_netif_hdr_t)) && + ((ng_netif_hdr_t *)pkt->data)->src_l2addr_len == NG_ETHERNET_ADDR_LEN); } static inline bool _for_ethernet(ng_pktsnip_t *pkt) { - return ((pkt->size != (sizeof(ng_netif_hdr_t) + NG_ETHERNET_ADDR_LEN)) || + return (((pkt->size == (sizeof(ng_netif_hdr_t)) && + ((ng_netif_hdr_t *)pkt->data)->dst_l2addr_len)) || _has_src(pkt)); } @@ -629,7 +631,7 @@ static void _rx_event(ng_tapnet_t *dev) DEBUG("from %02x:%02x:%02x:%02x:%02x:%02x of length %zu\n", hdr->src[0], hdr->src[1], hdr->src[2], hdr->src[3], hdr->src[4], - hdr->src[5], data_len - ng_netif_hdr_sizeof(pkt->data)); + hdr->src[5], data_len - ng_netif_hdr_sizeof(netif_hdr->data)); #if defined(MODULE_OD) && ENABLE_DEBUG od_hex_dump(hdr, data_len, OD_WIDTH_DEFAULT); #endif