1 From 5040f21cb4ee6ade966e60c6d5a3c270d03de1f1 Mon Sep 17 00:00:00 2001
2 From: Matt Johnston <matt@ucc.asn.au>
3 Date: Mon, 1 May 2023 22:05:43 +0800
4 Subject: Remove SO_LINGER
6 It could cause channels to take up to 5 seconds to close(), which would block
7 the entire process. On busy TCP forwarding sessions this would result in
8 channels seeming stuck and new connections not being accepted.
10 We don't need to monitor for flushing failures since we can't report errors, so
11 SO_LINGER wasn't useful.
13 Thanks to GektorUA for reporting and testing
18 1 file changed, 4 deletions(-)
22 @@ -472,7 +472,6 @@ int dropbear_listen(const char* address,
23 struct addrinfo hints, *res = NULL, *res0 = NULL;
26 - struct linger linger;
29 uint16_t *allocated_lport_p = NULL;
30 @@ -551,9 +550,6 @@ int dropbear_listen(const char* address,
32 /* set to reuse, quick timeout */
33 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val));
35 - linger.l_linger = 5;
36 - setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
38 #if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
39 if (res->ai_family == AF_INET6) {