Browse Source

Disable fragmentation for all the outgoing UDP packets

pull/2875/head
Max Lv 2 years ago
parent
commit
46382c23fa
1 changed files with 13 additions and 0 deletions
  1. 13
      src/udprelay.c

13
src/udprelay.c

@ -431,6 +431,13 @@ create_remote_socket(int ipv6)
}
#endif
}
#if defined(__linux__)
// Disable fragmentation
int val = IP_PMTUDISC_DO;
setsockopt(remote_sock, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val));
#endif
return remote_sock;
}
@ -545,6 +552,12 @@ create_server_socket(const char *host, const char *port)
freeaddrinfo(result);
#if defined(__linux__)
// Disable fragmentation
int val = IP_PMTUDISC_DO;
setsockopt(server_sock, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val));
#endif
return server_sock;
}

Loading…
Cancel
Save