Commit 7872d4d1 authored by Mark Andrews's avatar Mark Andrews
Browse files

4443. [func] Set TCP_MAXSEG in addition to IPV6_USE_MIN_MTU on

                        TCP sockets. [RT #42864]
parent 42a14518
4443. [func] Set TCP_MAXSEG in addition to IPV6_USE_MIN_MTU on
TCP sockets. [RT #42864]
4442. [bug] Fix RPZ CIDR tree insertion bug that corrupted 4442. [bug] Fix RPZ CIDR tree insertion bug that corrupted
tree data structure with overlapping networks tree data structure with overlapping networks
(longest prefix match was ineffective). (longest prefix match was ineffective).
......
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
#endif #endif
#endif #endif
#include <netinet/tcp.h>
#include "errno2result.h" #include "errno2result.h"
/* See task.c about the following definition: */ /* See task.c about the following definition: */
...@@ -2556,6 +2558,15 @@ use_min_mtu(isc__socket_t *sock) { ...@@ -2556,6 +2558,15 @@ use_min_mtu(isc__socket_t *sock) {
#endif #endif
} }
static void
set_tcp_maxseg(isc__socket_t *sock, int size) {
#ifdef TCP_MAXSEG
if (sock->type == isc_sockettype_tcp)
(void)setsockopt(sock->fd, IPPROTO_TCP, TCP_MAXSEG,
(void *)&size, sizeof(size));
#endif
}
static isc_result_t static isc_result_t
opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
isc__socket_t *dup_socket) isc__socket_t *dup_socket)
...@@ -2761,8 +2772,10 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, ...@@ -2761,8 +2772,10 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
/* /*
* Use minimum mtu if possible. * Use minimum mtu if possible.
*/ */
if (sock->type == isc_sockettype_tcp) if (sock->type == isc_sockettype_tcp && sock->pf == AF_INET6) {
use_min_mtu(sock); use_min_mtu(sock);
set_tcp_maxseg(sock, 1280 - 20 - 40); /* 1280 - TCP - IPV6 */
}
#if defined(USE_CMSG) || defined(SO_RCVBUF) #if defined(USE_CMSG) || defined(SO_RCVBUF)
if (sock->type == isc_sockettype_udp) { if (sock->type == isc_sockettype_udp) {
...@@ -3683,6 +3696,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { ...@@ -3683,6 +3696,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
* Use minimum mtu if possible. * Use minimum mtu if possible.
*/ */
use_min_mtu(NEWCONNSOCK(dev)); use_min_mtu(NEWCONNSOCK(dev));
set_tcp_maxseg(NEWCONNSOCK(dev), 1280 - 20 - 40);
/* /*
* Ensure DSCP settings are inherited across accept. * Ensure DSCP settings are inherited across accept.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment