mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-28 10:44:43 +08:00
Disable fragmentation for all the outgoing UDP packets
This commit is contained in:
1 parent
3654658111
commit
46382c23fa
1 file changed
+13
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user