WIP: Layer 2-Implementierung #6

Draft
thomas wants to merge 39 commits from layer2_dev into main
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 04399c0022 - Show all commits

View file

@ -104,10 +104,10 @@ void rx_data_to_tun(const layer2_data_packet_t *data_packet)
switch(data_packet->payload_type) { switch(data_packet->payload_type) {
case L2_PAYLOAD_TYPE_IPV6: case L2_PAYLOAD_TYPE_IPV6:
*(uint16_t*)(tun_packet+2) = 0x86dd; *(uint16_t*)(tun_packet+2) = htons(0x86dd);
break; break;
case L2_PAYLOAD_TYPE_IPV4: case L2_PAYLOAD_TYPE_IPV4:
*(uint16_t*)(tun_packet+2) = 0x0800; *(uint16_t*)(tun_packet+2) = htons(0x0800);
break; break;
default: default:
LOG(LVL_ERR, "Unsupported payload type: 0x%08x.", data_packet->payload_type); LOG(LVL_ERR, "Unsupported payload type: 0x%08x.", data_packet->payload_type);

View file

@ -101,10 +101,10 @@ void rx_data_to_tun(const layer2_data_packet_t *data_packet)
switch(data_packet->payload_type) { switch(data_packet->payload_type) {
case L2_PAYLOAD_TYPE_IPV6: case L2_PAYLOAD_TYPE_IPV6:
*(uint16_t*)(tun_packet+2) = 0x86dd; *(uint16_t*)(tun_packet+2) = htons(0x86dd);
break; break;
case L2_PAYLOAD_TYPE_IPV4: case L2_PAYLOAD_TYPE_IPV4:
*(uint16_t*)(tun_packet+2) = 0x0800; *(uint16_t*)(tun_packet+2) = htons(0x0800);
break; break;
default: default:
LOG(LVL_ERR, "Unsupported payload type: 0x%08x.", data_packet->payload_type); LOG(LVL_ERR, "Unsupported payload type: 0x%08x.", data_packet->payload_type);