From 27c09e245337bc89e32170d5a22a3a35edf5acd7 Mon Sep 17 00:00:00 2001 From: Petr Šabata Date: Nov 07 2014 13:02:18 +0000 Subject: Close sockets after the client disconnects (#1161432) --- diff --git a/nc6-1.0-afindep-close-the-accepted-socket-when-done.patch b/nc6-1.0-afindep-close-the-accepted-socket-when-done.patch new file mode 100644 index 0000000..397790c --- /dev/null +++ b/nc6-1.0-afindep-close-the-accepted-socket-when-done.patch @@ -0,0 +1,31 @@ +From 9f043d704320942bfbc5cd7773e91a7beff5522b Mon Sep 17 00:00:00 2001 +From: Aaron Lu +Date: Fri, 7 Nov 2014 14:27:36 +0800 +Subject: [PATCH] afindep: close the accepted socket when done + +The accepted socket ns isn't closed when done and that caused the socket +to keep in the CLOSE_WAIT state until the program quits. But since nc6 +is used to continuous accpet more connections and not quit with a +client, this would cause more and more sockets to stay in CLOSE_WAIT +state and eventually new connections will be refused. + +Signed-off-by: Aaron Lu +--- + src/afindep.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/afindep.c b/src/afindep.c +index 6645d6d..bf06e8b 100644 +--- a/src/afindep.c ++++ b/src/afindep.c +@@ -548,6 +548,7 @@ int afindep_listener(const struct addrinfo *hints, + } + + callback(ns, socktype, cdata); ++ close(ns); + + if (max_accept > 0 && --max_accept == 0) + break; +-- +1.9.3 + diff --git a/nc6.spec b/nc6.spec index a3f13d5..6a73219 100644 --- a/nc6.spec +++ b/nc6.spec @@ -1,14 +1,16 @@ Summary: Netcat with IPv6 Support Name: nc6 Version: 1.0 -Release: 20%{?dist} +Release: 21%{?dist} Group: Applications/Internet URL: http://www.deepspace6.net/projects/netcat6.html License: GPLv2+ Source: ftp://ftp.deepspace6.net/pub/ds6/sources/nc6/%{name}-%{version}.tar.bz2 # Given that the trailing newlines are now a part of the comments, # some macros with comments on the same line break. -Patch0: nc6-1.0-dnl.patch +Patch0: %{name}-1.0-dnl.patch +# rhbz#1161432 +Patch1: %{name}-1.0-afindep-close-the-accepted-socket-when-done.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: gettext-devel @@ -28,6 +30,7 @@ ago as another one of those cryptic but standard Unix tools." %prep %setup -q %patch0 -p1 +%patch1 -p1 %build autoreconf -fiv @@ -43,6 +46,9 @@ make DESTDIR="%{buildroot}" install %doc README AUTHORS COPYING NEWS TODO %changelog +* Fri Nov 07 2014 Petr Šabata - 1.0-21 +- Close sockets after the client disconnects (#1161432) + * Sun Aug 17 2014 Fedora Release Engineering - 1.0-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild