Fix byte order in TUN packet header
All checks were successful
/ build-hamnet70 (push) Successful in 39s
/ build-doc (push) Successful in 31s
/ deploy-doc (push) Has been skipped

This commit is contained in:
Thomas Kolb 2024-12-18 21:01:14 +01:00
parent b2df27bb92
commit 04399c0022
2 changed files with 4 additions and 4 deletions

View file

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