Hello,
I am the above mentioned colleague trying it on a Ubuntu machine with the needed kernel modules for the TUN/TAP interface.
I managed to solve the "TUN write" error, but I am still not able to create a network and join with a second FRDM-KW41Z running the "Thread router eligible device" demo.
I am compiling with the following Macro definitions: SERIAL_TUN_IF 1, BR_ROUTER_MODE 0, BR_HOST_MODE 1.
The TUN device is created and configured with the "make_tun.sh" script and during program execution the threadtun0 link status is UP.
I modified these functions to remove the Ethernet header from the network frame as written in Chapter 6 to enable TUN mode (both are located in ip_if_serial_tun.c):
- IP_SerialTunSend6: content of the "if(pEnetDstInf)" condition commented out
-IP_serialtunRecv:
enetHdr_t enetpkt;
uint16_t protocol;
//EDITED -- start
uint8_t protocolFix[] = {134, 221};//ADDED, HEX DUMP WAS: 86 dd
/* check if interface is initialized and packet has correct size */
if ((NULL != mIpSerialtunInterfaceHandle) && (size > ENET_HEADER_SIZE))
{
// FLib_MemCpy(&enetpkt, pInData, ENET_HEADER_SIZE);
// protocol = ntohas(enetpkt.type);
protocol = ntohas(protocolFix);//ADDED
// /* Make sure IP packet is aligned */
// size -= ENET_HEADER_SIZE;
// FLib_MemInPlaceCpy(pInData, (uint8_t *) pInData + ENET_HEADER_SIZE, size);
//EDITED -- end
IPIF_STATS_ENABLED((*mIpSerialtunInterfaceHandle)->stats.commonStats.rxTotal++);
IPIF_STATS_ENABLED((*mIpSerialtunInterfaceHandle)->stats.rxOctets += size);
Attached you find a Wireshark log, the output of the Thread_KW_Tun program and the Uart log of the "Thread router eligible device" running on a second FRDM-KW41Z.
Regards,
Fynn