Skip to content

Commit

Permalink
[SQUASH ME] debugged some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Mar 17, 2015
1 parent 735f854 commit 644d9c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cpu/native/ng_tapnet/ng_tapnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 644d9c3

Please sign in to comment.