detect MTU for some known ipv6 tunnel brokers

This commit is contained in:
orignal 2022-07-14 13:48:28 -04:00
parent 14a6947b02
commit 014e4b0e1d
3 changed files with 24 additions and 3 deletions

View file

@ -12,6 +12,7 @@
#include "util.h"
#include "Log.h"
#include "I2PEndian.h"
#if not defined (__FreeBSD__)
#include <pthread.h>
@ -423,6 +424,25 @@ namespace net
#endif
}
int GetMaxMTU (const boost::asio::ip::address_v6& localAddress)
{
uint32_t prefix = bufbe32toh (localAddress.to_bytes ().data ());
switch (prefix)
{
case 0x20010470:
case 0x260070ff:
// Hurricane Electric
return 1480;
break;
case 0x2a06a004:
// route48
return 1420;
break;
default: ;
}
return 1500;
}
static bool IsYggdrasilAddress (const uint8_t addr[16])
{
return addr[0] == 0x02 || addr[0] == 0x03;