Skip to content

Commit

Permalink
[SQUASH ME] ng_tapnet: fix header building
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Mar 20, 2015
1 parent f82fa87 commit bb0116d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cpu/native/ng_tapnet/ng_tapnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ static void _rx_event(ng_tapnet_t *dev)
ng_pktsnip_t *netif_hdr, *pkt;
ng_nettype_t receive_type = NG_NETTYPE_UNDEF;
size_t data_len = (nread - sizeof(ng_ethernet_hdr_t));
data_len += sizeof(ng_netif_hdr_t) + (2 * NG_ETHERNET_ADDR_LEN);

if (!(dev->promiscous) && (memcmp(hdr->dst, dev->addr, NG_ETHERNET_ADDR_LEN) != 0) &&
(!_addr_broadcast(hdr->dst))) {
Expand Down Expand Up @@ -632,14 +631,14 @@ 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(netif_hdr->data));
hdr->src[5], data_len);
#if defined(MODULE_OD) && ENABLE_DEBUG
od_hex_dump(hdr, data_len, OD_WIDTH_DEFAULT);
od_hex_dump(hdr, nread, OD_WIDTH_DEFAULT);
#endif

/* Mark netif header and payload for next layer */
if ((pkt = ng_pktbuf_add(netif_hdr, NULL, data_len - sizeof(ng_ethernet_hdr_t),
receive_type)) == NULL) {
if ((pkt = ng_pktbuf_add(netif_hdr, recv_buffer + sizeof(ng_ethernet_hdr_t),
data_len, receive_type)) == NULL) {
ng_pktbuf_release(netif_hdr);
DEBUG("ng_tapnet: no space left in packet buffer\n");
return;
Expand Down

0 comments on commit bb0116d

Please sign in to comment.