ng_netdev_eth: default to NG_ETHERTYPE_UNKNOWN when no payload avail.

This commit is contained in:
Cenk Gündoğan 2015-05-28 18:20:32 +02:00
parent 9a063b9225
commit 4bda0f6f54

View File

@ -373,7 +373,12 @@ static int _marshall_ethernet(ng_netdev_eth_t *dev, uint8_t *buffer, ng_pktsnip_
return -EBADMSG; return -EBADMSG;
} }
hdr->type = byteorder_htons(ng_nettype_to_ethertype(pkt->next->type)); if (payload) {
hdr->type = byteorder_htons(ng_nettype_to_ethertype(payload->type));
}
else {
hdr->type = byteorder_htons(NG_ETHERTYPE_UNKNOWN);
}
netif_hdr = pkt->data; netif_hdr = pkt->data;