Skip to content

Commit

Permalink
[SQUASH ME] ng_tapnet: use translation functions
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Mar 24, 2015
1 parent ec6ddfc commit 7ba0fd0
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions cpu/native/ng_tapnet/ng_tapnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,20 +507,7 @@ static int _marshall_ethernet(ng_tapnet_t *dev, uint8_t *buffer, ng_pktsnip_t *p
return -EBADMSG;
}

switch (pkt->next->type) {
#ifdef MODULE_NG_IPV6

case NG_NETTYPE_IPV6:
DEBUG("ng_tapnet: use Ethertype IPV6\n");
hdr->type = byteorder_htons(NG_ETHERTYPE_IPV6);
break;
#endif

default:
DEBUG("ng_tapnet: Ethertype unknown, use 0xffff\n");
hdr->type = byteorder_htons(0xffff);
break;
}
hdr->type = byteorder_htons(ng_nettype_to_ethertype(pkt->next->type));

netif_hdr = pkt->data;

Expand Down Expand Up @@ -616,20 +603,10 @@ static void _rx_event(ng_tapnet_t *dev)
ng_netif_hdr_set_dst_addr(netif_hdr->data, hdr->dst, NG_ETHERNET_ADDR_LEN);
((ng_netif_hdr_t *)netif_hdr->data)->if_pid = thread_getpid();

switch (byteorder_ntohs(hdr->type)) {
#ifdef MODULE_NG_IPV6

case NG_ETHERTYPE_IPV6:
DEBUG("ng_tapnet: received IPv6 packet ");
receive_type = NG_NETTYPE_IPV6;
#endif

default:
DEBUG("ng_tapnet: received packet of unknown type ");
break;
}
receive_type = ng_nettype_from_ethertype(byteorder_ntohs(hdr->type));

DEBUG("from %02x:%02x:%02x:%02x:%02x:%02x of length %zu\n",
DEBUG("ng_tapnet: received packet 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);
#if defined(MODULE_OD) && ENABLE_DEBUG
Expand Down

0 comments on commit 7ba0fd0

Please sign in to comment.