From: Otto Moerbeek Date: Thu, 3 Jan 2019 09:47:12 +0000 (+0100) Subject: Rec: Set socket buf size for control socket. X-Git-Tag: rec-4.2.0-alpha1~65^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4777000b9c31ea6d42fa68c66f4caef37b3fe22;p=thirdparty%2Fpdns.git Rec: Set socket buf size for control socket. Fixes #5745 without changing settings for all processes. --- diff --git a/pdns/rec_channel.cc b/pdns/rec_channel.cc index cec4dff6a7..8ee9331b69 100644 --- a/pdns/rec_channel.cc +++ b/pdns/rec_channel.cc @@ -54,6 +54,12 @@ int RecursorControlChannel::listen(const string& fname) if(bind(d_fd, (sockaddr*)&d_local,sizeof(d_local))<0) throw PDNSException("Unable to bind to controlsocket '"+fname+"': "+stringerror()); + // receive buf should be size of max datagram plus address size + int bufsz = 60*1024; + setsockopt(d_fd, SOL_SOCKET, SO_SNDBUF, &bufsz, sizeof(bufsz)); + bufsz = 64*1024; + setsockopt(d_fd, SOL_SOCKET, SO_RCVBUF, &bufsz, sizeof(bufsz)); + return d_fd; } @@ -100,6 +106,12 @@ void RecursorControlChannel::connect(const string& path, const string& fname) throw PDNSException("Unable to connect to remote '"+string(remote.sun_path)+"': "+stringerror()); } + // receive buf should be size of max datagram plus address size + int bufsz = 60*1024; + setsockopt(d_fd, SOL_SOCKET, SO_SNDBUF, &bufsz, sizeof(bufsz)); + bufsz = 64*1024; + setsockopt(d_fd, SOL_SOCKET, SO_RCVBUF, &bufsz, sizeof(bufsz)); + } catch (...) { close(d_fd); d_fd=-1;