mirror of
https://github.com/espressif/openthread.git
synced 2026-09-03 15:50:06 +00:00
[linux] fix missing correct mtu (#5642)
Set correct MTU so that big IPv6 datagrams can automatically be fragmented by host IP stack.
This commit is contained in:
@@ -275,7 +275,7 @@ enum
|
||||
};
|
||||
#endif
|
||||
|
||||
static const size_t kMaxIp6Size = 1536;
|
||||
static constexpr size_t kMaxIp6Size = OPENTHREAD_CONFIG_IP6_MAX_DATAGRAM_LENGTH;
|
||||
|
||||
#define OPENTHREAD_POSIX_LOG_TUN_PACKETS 0
|
||||
|
||||
@@ -548,6 +548,7 @@ static void processReceive(otMessage *aMessage, void *aContext)
|
||||
#endif
|
||||
|
||||
assert(sInstance == aContext);
|
||||
assert(length <= kMaxIp6Size);
|
||||
|
||||
VerifyOrExit(sTunFd > 0, OT_NOOP);
|
||||
|
||||
@@ -1292,6 +1293,9 @@ static void platformConfigureTunDevice(otInstance *aInstance,
|
||||
VerifyOrDie(ioctl(sTunFd, TUNSETLINK, ARPHRD_VOID) == 0, OT_EXIT_ERROR_ERRNO);
|
||||
|
||||
strncpy(deviceName, ifr.ifr_name, deviceNameLen);
|
||||
|
||||
ifr.ifr_mtu = static_cast<int>(kMaxIp6Size);
|
||||
VerifyOrDie(ioctl(sIpFd, SIOCSIFMTU, static_cast<void *>(&ifr)) == 0, OT_EXIT_ERROR_ERRNO);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user