mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-06 21:56:25 +01:00
Prevent DOS by asserts in TCP tuning (#2492)
* Prevent DOS by asserts in TCP tuning -Propagates socket option errors from the tuning functions to the callers. -Asserts a subset of error conditions during tuning, excluding external network causes. -Checks tuning results in 3 call sites and treats them like failures to connect, accept, etc. * Fix variable name * Remove lambda requiring C++11
This commit is contained in:
@@ -97,10 +97,14 @@ void zmq::tcp_listener_t::in_event ()
|
||||
return;
|
||||
}
|
||||
|
||||
tune_tcp_socket (fd);
|
||||
tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt,
|
||||
options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
|
||||
tune_tcp_maxrt (fd, options.tcp_maxrt);
|
||||
int rc = tune_tcp_socket (fd);
|
||||
rc = rc | tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt,
|
||||
options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
|
||||
rc = rc | tune_tcp_maxrt (fd, options.tcp_maxrt);
|
||||
if (rc != 0) {
|
||||
socket->event_accept_failed (endpoint, zmq_errno());
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the engine object for this connection.
|
||||
stream_engine_t *engine = new (std::nothrow)
|
||||
|
||||
Reference in New Issue
Block a user