mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Set TCP maximum segment size to minimum size of 1220
Previously the socket code would set the TCPv6 maximum segment size to minimum value to prevent IP fragmentation for TCP. This was not yet implemented for the network manager. Implement network manager functions to set and use minimum MTU socket option and set the TCP_MAXSEG socket option for both IPv4 and IPv6 and use those to clamp the TCP maximum segment size for TCP, TCPDNS and TLSDNS layers in the network manager to 1220 bytes, that is 1280 (IPv6 minimum link MTU) minus 40 (IPv6 fixed header) minus 20 (TCP fixed header) We already rely on a similar value for UDP to prevent IP fragmentation and it make sense to use the same value for IPv4 and IPv6 because the modern networks are required to support IPv6 packet sizes. If there's need for small TCP segment values, the MTU on the interfaces needs to be properly configured.
This commit is contained in:
@@ -3263,6 +3263,22 @@ isc__nm_socket_tcp_nodelay(uv_os_sock_t fd) {
|
||||
#endif
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__nm_socket_tcp_maxseg(uv_os_sock_t fd, int size) {
|
||||
#ifdef TCP_MAXSEG
|
||||
if (setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, (void *)&size,
|
||||
sizeof(size))) {
|
||||
return (ISC_R_FAILURE);
|
||||
} else {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
#else
|
||||
UNUSED(fd);
|
||||
UNUSED(size);
|
||||
return (ISC_R_SUCCESS);
|
||||
#endif
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__nm_socket_min_mtu(uv_os_sock_t fd, sa_family_t sa_family) {
|
||||
if (sa_family != AF_INET6) {
|
||||
|
Reference in New Issue
Block a user