- Moved mtu check for Ipv6 to be earlier
This commit is contained in:
Tristan Brice Velloza Kildaire 2024-12-15 17:45:37 +02:00
parent f61b4a0193
commit 7024d05d0e

16
TAP.c
View File

@ -100,14 +100,6 @@ void trySixSet
interfaceIndex
);
// linux IPv6 mtu check
if(mtu < 1280)
{
printf("MTU must be 1280 bytes or more for IPv6\n");
cleanup();
exit(1);
}
int dummySock = socket(AF_INET6, SOCK_DGRAM, 0);
struct in6_ifreq paramReq;
@ -318,6 +310,14 @@ int open_tap(void) {
if(set_ipv6 || link_local_v6)
{
// linux IPv6 mtu check
if(mtu < 1280)
{
printf("MTU must be 1280 bytes or more for IPv6\n");
cleanup();
exit(1);
}
// Firstly, obtain the interface index by `ifr_name`
int dummySock = socket(AF_INET6, SOCK_DGRAM, 0);
if(ioctl(dummySock, SIOCGIFINDEX, &ifr) < 0)