mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 21:47:59 +00:00
3411. [tuning] Use IPV6_USE_MIN_MTU or equivalent with TCP in addition to UDP. [RT #31690]
Squashed commit of the following: commit bcbe9ae7a99e1f7f4236a22739a793b51ace8684 Author: Mark Andrews <marka@isc.org> Date: Wed Oct 31 15:10:53 2012 +1100 Use IPV6_USE_MIN_MTU for TCP as well as UDP
This commit is contained in:
parent
b3f23e7a7d
commit
c2e80cf47e
3
CHANGES
3
CHANGES
@ -1,3 +1,6 @@
|
|||||||
|
3411. [tuning] Use IPV6_USE_MIN_MTU or equivalent with TCP in addition
|
||||||
|
to UDP. [RT #31690]
|
||||||
|
|
||||||
3410. [bug] Addressed Coverity warnings. [RT #31626]
|
3410. [bug] Addressed Coverity warnings. [RT #31626]
|
||||||
|
|
||||||
3409. [contrib] contrib/dane/mkdane.sh: Tool to generate TLSA RR's
|
3409. [contrib] contrib/dane/mkdane.sh: Tool to generate TLSA RR's
|
||||||
|
@ -2262,6 +2262,28 @@ clear_bsdcompat(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
use_min_mtu(isc__socket_t *sock) {
|
||||||
|
#ifdef IPV6_USE_MIN_MTU
|
||||||
|
/* use minimum MTU */
|
||||||
|
if (sock->pf == AF_INET6) {
|
||||||
|
int on = 1;
|
||||||
|
(void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
|
||||||
|
(void *)&on, sizeof(on));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(IPV6_MTU)
|
||||||
|
/*
|
||||||
|
* Use minimum MTU on IPv6 sockets.
|
||||||
|
*/
|
||||||
|
if (sock->pf == AF_INET6) {
|
||||||
|
int mtu = 1280;
|
||||||
|
(void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_MTU,
|
||||||
|
&mtu, sizeof(mtu));
|
||||||
|
}
|
||||||
|
#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)
|
||||||
@ -2270,7 +2292,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
|
|||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
const char *err = "socket";
|
const char *err = "socket";
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
#if defined(USE_CMSG) || defined(SO_BSDCOMPAT)
|
#if defined(USE_CMSG) || defined(SO_BSDCOMPAT) || defined(SO_NOSIGPIPE)
|
||||||
int on = 1;
|
int on = 1;
|
||||||
#endif
|
#endif
|
||||||
#if defined(SO_RCVBUF)
|
#if defined(SO_RCVBUF)
|
||||||
@ -2426,6 +2448,11 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use minimum mtu if possible.
|
||||||
|
*/
|
||||||
|
use_min_mtu(sock);
|
||||||
|
|
||||||
#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) {
|
||||||
|
|
||||||
@ -2490,32 +2517,6 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
|
|||||||
}
|
}
|
||||||
#endif /* IPV6_RECVPKTINFO */
|
#endif /* IPV6_RECVPKTINFO */
|
||||||
#endif /* ISC_PLATFORM_HAVEIN6PKTINFO */
|
#endif /* ISC_PLATFORM_HAVEIN6PKTINFO */
|
||||||
#ifdef IPV6_USE_MIN_MTU /* RFC 3542, not too common yet*/
|
|
||||||
/* use minimum MTU */
|
|
||||||
if (sock->pf == AF_INET6 &&
|
|
||||||
setsockopt(sock->fd, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
|
|
||||||
(void *)&on, sizeof(on)) < 0) {
|
|
||||||
isc__strerror(errno, strbuf, sizeof(strbuf));
|
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
|
||||||
"setsockopt(%d, IPV6_USE_MIN_MTU) "
|
|
||||||
"%s: %s", sock->fd,
|
|
||||||
isc_msgcat_get(isc_msgcat,
|
|
||||||
ISC_MSGSET_GENERAL,
|
|
||||||
ISC_MSG_FAILED,
|
|
||||||
"failed"),
|
|
||||||
strbuf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined(IPV6_MTU)
|
|
||||||
/*
|
|
||||||
* Use minimum MTU on IPv6 sockets.
|
|
||||||
*/
|
|
||||||
if (sock->pf == AF_INET6) {
|
|
||||||
int mtu = 1280;
|
|
||||||
(void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_MTU,
|
|
||||||
&mtu, sizeof(mtu));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DONT)
|
#if defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DONT)
|
||||||
/*
|
/*
|
||||||
* Turn off Path MTU discovery on IPv6/UDP sockets.
|
* Turn off Path MTU discovery on IPv6/UDP sockets.
|
||||||
@ -3312,6 +3313,11 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
|||||||
NEWCONNSOCK(dev)->bound = 1;
|
NEWCONNSOCK(dev)->bound = 1;
|
||||||
NEWCONNSOCK(dev)->connected = 1;
|
NEWCONNSOCK(dev)->connected = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use minimum mtu if possible.
|
||||||
|
*/
|
||||||
|
use_min_mtu(NEWCONNSOCK(dev));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save away the remote address
|
* Save away the remote address
|
||||||
*/
|
*/
|
||||||
|
@ -1431,6 +1431,18 @@ startio_send(isc_socket_t *sock, isc_socketevent_t *dev, int *nbytes,
|
|||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
use_min_mtu(isc__socket_t *sock) {
|
||||||
|
#ifdef IPV6_USE_MIN_MTU
|
||||||
|
/* use minimum MTU */
|
||||||
|
if (sock->pf == AF_INET6) {
|
||||||
|
int on = 1;
|
||||||
|
(void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
|
||||||
|
(void *)&on, sizeof(on));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
||||||
isc_socket_t **socketp) {
|
isc_socket_t **socketp) {
|
||||||
@ -1737,6 +1749,10 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use minimum mtu if possible.
|
||||||
|
*/
|
||||||
|
use_min_mtu(sock);
|
||||||
|
|
||||||
#if defined(USE_CMSG) || defined(SO_RCVBUF)
|
#if defined(USE_CMSG) || defined(SO_RCVBUF)
|
||||||
if (type == isc_sockettype_udp) {
|
if (type == isc_sockettype_udp) {
|
||||||
@ -1774,14 +1790,6 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
|||||||
strbuf);
|
strbuf);
|
||||||
}
|
}
|
||||||
#endif /* IPV6_RECVPKTINFO */
|
#endif /* IPV6_RECVPKTINFO */
|
||||||
#ifdef IPV6_USE_MIN_MTU /*2292bis, not too common yet*/
|
|
||||||
/* use minimum MTU */
|
|
||||||
if (pf == AF_INET6) {
|
|
||||||
(void)setsockopt(sock->fd, IPPROTO_IPV6,
|
|
||||||
IPV6_USE_MIN_MTU,
|
|
||||||
(char *)&on, sizeof(on));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* ISC_PLATFORM_HAVEIPV6 */
|
#endif /* ISC_PLATFORM_HAVEIPV6 */
|
||||||
#endif /* defined(USE_CMSG) */
|
#endif /* defined(USE_CMSG) */
|
||||||
|
|
||||||
@ -2068,6 +2076,11 @@ internal_accept(isc_socket_t *sock, IoCompletionInfo *lpo, int accept_errno) {
|
|||||||
result = make_nonblock(adev->newsocket->fd);
|
result = make_nonblock(adev->newsocket->fd);
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
INSIST(result == ISC_R_SUCCESS);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use minimum mtu if possible.
|
||||||
|
*/
|
||||||
|
use_min_mtu(adev->newsocket);
|
||||||
|
|
||||||
INSIST(setsockopt(nsock->fd, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT,
|
INSIST(setsockopt(nsock->fd, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT,
|
||||||
(char *)&sock->fd, sizeof(sock->fd)) == 0);
|
(char *)&sock->fd, sizeof(sock->fd)) == 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user