From: Alan T. DeKok Date: Thu, 9 Sep 2021 20:33:51 +0000 (-0400) Subject: respect SO_SNDBUF X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9dc50aabeb9da1a869c0485cf37494d559c25ce1;p=thirdparty%2Ffreeradius-server.git respect SO_SNDBUF --- diff --git a/src/lib/util/udp_queue.c b/src/lib/util/udp_queue.c index 76615692d9..da2fdd3194 100644 --- a/src/lib/util/udp_queue.c +++ b/src/lib/util/udp_queue.c @@ -121,6 +121,25 @@ fr_udp_queue_t *fr_udp_queue_alloc(TALLOC_CTX *ctx, fr_udp_queue_config_t const if (config->interface && (fr_socket_bind(fd, &config->ipaddr, &port, config->interface) < 0)) goto error; + /* + * Set sendbuf + */ +#ifdef SO_SNDBUF + /* + * Set SO_SNDBUF size, if configured to do so. + */ + if (config->send_buff_is_set) { + int opt; + + opt = config->send_buff; + + if (opt < 65536) opt = 65536; + if (opt > (1 << 30)) opt = 1<<30; + + (void) setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(int)); + } +#endif + uq = talloc_zero(ctx, fr_udp_queue_t); if (!uq) { error: