mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-29 20:43:44 +00:00
Disable fragmentation for all the outgoing UDP packets
This commit is contained in:
@@ -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