mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-13 15:30:00 -04:00
Merge branch '1713-use-default-buffer-sizes' into 'master'
Don't set recv/send buffer sizes for sockets. Closes #1713 See merge request isc-projects/bind9!3476
This commit is contained in:
commit
e051abe515
4 changed files with 33 additions and 29 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
5403. [func] Don't set udp recv/send buffer sizes, sockets will
|
||||
use system defaults. [GL #1713]
|
||||
|
||||
5402. [bug] Enable SO_REUSEADDR on all platforms, and either
|
||||
SO_REUSEPORT_LB on FreeBSD, or SO_REUSEPORT on Linux.
|
||||
[GL !3365]
|
||||
|
|
|
|||
|
|
@ -89,6 +89,12 @@
|
|||
[GL #1674]
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
BIND 9 no longer sets the recv and send buffer sizes for sockets, relying
|
||||
on system defaults instead. [GL #1713]
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -167,11 +167,14 @@ isc__nm_async_udplisten(isc__networker_t *worker, isc__netievent_t *ev0) {
|
|||
if (r < 0) {
|
||||
isc__nm_incstats(sock->mgr, sock->statsindex[STATID_BINDFAIL]);
|
||||
}
|
||||
|
||||
#ifdef ISC_RECV_BUFFER_SIZE
|
||||
uv_recv_buffer_size(&sock->uv_handle.handle,
|
||||
&(int){ 16 * 1024 * 1024 });
|
||||
&(int){ ISC_RECV_BUFFER_SIZE });
|
||||
#endif
|
||||
#ifdef ISC_SEND_BUFFER_SIZE
|
||||
uv_send_buffer_size(&sock->uv_handle.handle,
|
||||
&(int){ 16 * 1024 * 1024 });
|
||||
&(int){ ISC_SEND_BUFFER_SIZE });
|
||||
#endif
|
||||
uv_udp_recv_start(&sock->uv_handle.udp, isc__nm_alloc_cb, udp_recv_cb);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -271,21 +271,13 @@ typedef isc_event_t intev_t;
|
|||
#endif /* ifndef USE_CMSG */
|
||||
#endif /* ifdef SO_TIMESTAMP */
|
||||
|
||||
/*%
|
||||
* The size to raise the receive buffer to (from BIND 8).
|
||||
*/
|
||||
#ifdef TUNE_LARGE
|
||||
#ifdef sun
|
||||
#define RCVBUFSIZE (1 * 1024 * 1024)
|
||||
#define SNDBUFSIZE (1 * 1024 * 1024)
|
||||
#else /* ifdef sun */
|
||||
#define RCVBUFSIZE (16 * 1024 * 1024)
|
||||
#define SNDBUFSIZE (16 * 1024 * 1024)
|
||||
#endif /* ifdef sun */
|
||||
#else /* ifdef TUNE_LARGE */
|
||||
#define RCVBUFSIZE (32 * 1024)
|
||||
#define SNDBUFSIZE (32 * 1024)
|
||||
#endif /* TUNE_LARGE */
|
||||
#if defined(SO_RCVBUF) && defined(ISC_RECV_BUFFER_SIZE)
|
||||
#define SET_RCVBUF
|
||||
#endif
|
||||
|
||||
#if defined(SO_SNDBUF) && defined(ISC_SEND_BUFFER_SIZE)
|
||||
#define SET_SNDBUF
|
||||
#endif
|
||||
|
||||
/*%
|
||||
* Instead of calculating the cmsgbuf lengths every time we take
|
||||
|
|
@ -1942,9 +1934,9 @@ free_socket(isc__socket_t **socketp) {
|
|||
isc_mem_put(sock->manager->mctx, sock, sizeof(*sock));
|
||||
}
|
||||
|
||||
#ifdef SO_RCVBUF
|
||||
#if defined(SET_RCVBUF)
|
||||
static isc_once_t rcvbuf_once = ISC_ONCE_INIT;
|
||||
static int rcvbuf = RCVBUFSIZE;
|
||||
static int rcvbuf = ISC_RECV_BUFFER_SIZE;
|
||||
|
||||
static void
|
||||
set_rcvbuf(void) {
|
||||
|
|
@ -2000,9 +1992,9 @@ cleanup:
|
|||
}
|
||||
#endif /* ifdef SO_RCVBUF */
|
||||
|
||||
#ifdef SO_SNDBUF
|
||||
#if defined(SET_SNDBUF)
|
||||
static isc_once_t sndbuf_once = ISC_ONCE_INIT;
|
||||
static int sndbuf = SNDBUFSIZE;
|
||||
static int sndbuf = ISC_SEND_BUFFER_SIZE;
|
||||
|
||||
static void
|
||||
set_sndbuf(void) {
|
||||
|
|
@ -2105,10 +2097,10 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
|
|||
#if defined(USE_CMSG) || defined(SO_NOSIGPIPE)
|
||||
int on = 1;
|
||||
#endif /* if defined(USE_CMSG) || defined(SO_NOSIGPIPE) */
|
||||
#if defined(SO_RCVBUF) || defined(SO_SNDBUF)
|
||||
#if defined(SET_RCVBUF) || defined(SET_SNDBUF)
|
||||
socklen_t optlen;
|
||||
int size = 0;
|
||||
#endif /* if defined(SO_RCVBUF) || defined(SO_SNDBUF) */
|
||||
#endif
|
||||
|
||||
again:
|
||||
if (dup_socket == NULL) {
|
||||
|
|
@ -2271,7 +2263,7 @@ again:
|
|||
set_tcp_maxseg(sock, 1280 - 20 - 40); /* 1280 - TCP - IPV6 */
|
||||
}
|
||||
|
||||
#if defined(USE_CMSG) || defined(SO_RCVBUF) || defined(SO_SNDBUF)
|
||||
#if defined(USE_CMSG) || defined(SET_RCVBUF) || defined(SET_SNDBUF)
|
||||
if (sock->type == isc_sockettype_udp) {
|
||||
#if defined(USE_CMSG)
|
||||
#if defined(SO_TIMESTAMP)
|
||||
|
|
@ -2360,7 +2352,7 @@ again:
|
|||
}
|
||||
#endif /* if defined(IP_DONTFRAG) */
|
||||
|
||||
#if defined(SO_RCVBUF)
|
||||
#if defined(SET_RCVBUF)
|
||||
optlen = sizeof(size);
|
||||
if (getsockopt(sock->fd, SOL_SOCKET, SO_RCVBUF, (void *)&size,
|
||||
&optlen) == 0 &&
|
||||
|
|
@ -2378,9 +2370,9 @@ again:
|
|||
sock->fd, rcvbuf, strbuf);
|
||||
}
|
||||
}
|
||||
#endif /* if defined(SO_RCVBUF) */
|
||||
#endif /* if defined(SET_RCVBUF) */
|
||||
|
||||
#if defined(SO_SNDBUF)
|
||||
#if defined(SET_SNDBUF)
|
||||
optlen = sizeof(size);
|
||||
if (getsockopt(sock->fd, SOL_SOCKET, SO_SNDBUF, (void *)&size,
|
||||
&optlen) == 0 &&
|
||||
|
|
@ -2424,7 +2416,7 @@ again:
|
|||
sock->fd, strbuf);
|
||||
}
|
||||
#endif /* ifdef IP_RECVTOS */
|
||||
#endif /* defined(USE_CMSG) || defined(SO_RCVBUF) || defined(SO_SNDBUF) */
|
||||
#endif /* defined(USE_CMSG) || defined(SET_RCVBUF) || defined(SET_SNDBUF) */
|
||||
|
||||
setup_done:
|
||||
inc_stats(manager->stats, sock->statsindex[STATID_OPEN]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue