summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2023-05-01 22:05:43 +0800
committerMatt Johnston <matt@ucc.asn.au>2023-05-01 22:15:10 +0800
commit5040f21cb4ee6ade966e60c6d5a3c270d03de1f1 (patch)
treea540d34f0f6b01ca9d86e93dfd3c86e96c11a15e
parent7f80432ea6aa7bb25ce8043169be15052ac22f78 (diff)
downloaddropbear-master.tar.gz
Remove SO_LINGERHEADmastermain
It could cause channels to take up to 5 seconds to close(), which would block the entire process. On busy TCP forwarding sessions this would result in channels seeming stuck and new connections not being accepted. We don't need to monitor for flushing failures since we can't report errors, so SO_LINGER wasn't useful. Thanks to GektorUA for reporting and testing Fixes #230
-rw-r--r--src/netio.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/netio.c b/src/netio.c
index b8aebea..6ef73d4 100644
--- a/src/netio.c
+++ b/src/netio.c
@@ -472,7 +472,6 @@ int dropbear_listen(const char* address, const char* port,
struct addrinfo hints, *res = NULL, *res0 = NULL;
int err;
unsigned int nsock;
- struct linger linger;
int val;
int sock;
uint16_t *allocated_lport_p = NULL;
@@ -551,9 +550,6 @@ int dropbear_listen(const char* address, const char* port,
val = 1;
/* set to reuse, quick timeout */
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val));
- linger.l_onoff = 1;
- linger.l_linger = 5;
- setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
if (res->ai_family == AF_INET6) {