diff --git a/cpu/native/ng_tapnet/ng_tapnet.c b/cpu/native/ng_tapnet/ng_tapnet.c index b73affce8b64..d136d41319c8 100644 --- a/cpu/native/ng_tapnet/ng_tapnet.c +++ b/cpu/native/ng_tapnet/ng_tapnet.c @@ -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; @@ -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