[xinetd] Fix: Service disabled due to bind failure Update patch: xinetd-2.3.14-leaking-fds-2.patch Resolves:

jsynacek jsynacek at fedoraproject.org
Fri Apr 13 10:03:55 UTC 2012


commit 49f479d3ff873774d69a783af8ecdd55d7d3e0b0
Author: Jan Synacek <jsynacek at redhat.com>
Date:   Tue Apr 3 09:35:00 2012 +0200

    Fix: Service disabled due to bind failure
    Update patch: xinetd-2.3.14-leaking-fds-2.patch
    Resolves: #809272

 xinetd-2.3.14-leaking-fds-2.patch                  |   18 -------
 xinetd-2.3.14-leaking-fds-2a.patch                 |   41 +++++++++++++++
 ...-2.3.14-retry-svc-activate-in-cps-restart.patch |   54 ++++++++++++++++++++
 xinetd.spec                                        |   14 ++++-
 4 files changed, 106 insertions(+), 21 deletions(-)
---
diff --git a/xinetd-2.3.14-leaking-fds-2a.patch b/xinetd-2.3.14-leaking-fds-2a.patch
new file mode 100644
index 0000000..90901e5
--- /dev/null
+++ b/xinetd-2.3.14-leaking-fds-2a.patch
@@ -0,0 +1,41 @@
+diff -Naur xinetd-2.3.14-dist/xinetd/service.c xinetd-2.3.14/xinetd/service.c
+--- xinetd-2.3.14-dist/xinetd/service.c	2012-04-03 08:59:19.000000000 +0200
++++ xinetd-2.3.14/xinetd/service.c	2012-04-03 09:02:34.588160317 +0200
+@@ -366,12 +366,24 @@
+ 
+       msg( LOG_ERR, func,
+                   "socket creation failed (%m). service = %s", SC_ID( scp ) ) ;
++#ifdef HAVE_POLL
++      SVC_EVENTS( sp ) = 0;
++      SVC_FD( sp ) = 0;
++#else
++      FD_CLR( SVC_FD( sp ), &ps.rws.socket_mask ) ;
++#endif /* HAVE_POLL */
+       return( FAILED ) ;
+    }
+ 
+    if ( set_fd_modes( sp ) == FAILED )
+    {
+       (void) Sclose( SVC_FD(sp) ) ;
++#ifdef HAVE_POLL
++      SVC_EVENTS( sp ) = 0;
++      SVC_FD( sp ) = 0;
++#else
++      FD_CLR( SVC_FD( sp ), &ps.rws.socket_mask ) ;
++#endif /* HAVE_POLL */
+       return( FAILED ) ;
+    }
+ 
+@@ -385,6 +397,12 @@
+    if ( status == FAILED )
+    {
+       (void) Sclose( SVC_FD(sp) ) ;
++#ifdef HAVE_POLL
++      SVC_EVENTS( sp ) = 0;
++      SVC_FD( sp ) = 0;
++#else
++      FD_CLR( SVC_FD( sp ), &ps.rws.socket_mask ) ;
++#endif /* HAVE_POLL */
+       return( FAILED ) ;
+    }
+ 
diff --git a/xinetd-2.3.14-retry-svc-activate-in-cps-restart.patch b/xinetd-2.3.14-retry-svc-activate-in-cps-restart.patch
new file mode 100644
index 0000000..7ff5c0b
--- /dev/null
+++ b/xinetd-2.3.14-retry-svc-activate-in-cps-restart.patch
@@ -0,0 +1,54 @@
+diff -Napur xinetd-2.3.14.old/xinetd/access.c xinetd-2.3.14.new/xinetd/access.c
+--- xinetd-2.3.14.old/xinetd/access.c	2005-10-05 10:15:33.000000000 -0700
++++ xinetd-2.3.14.new/xinetd/access.c	2012-02-22 20:12:09.120973124 -0800
+@@ -89,9 +89,20 @@ static void cps_service_restart(void)
+                msg(LOG_ERR, func,
+                "Activating service %s", SC_NAME(scp));
+             } else {
+-               msg(LOG_ERR, func,
+-               "Error activating service %s", 
+-               SC_NAME(scp)) ;
++               /* Try to restart the service */
++               SVC_ATTEMPTS(sp) += 1;
++               if ( SVC_ATTEMPTS(sp) < MAX_SVC_ATTEMPTS ) {
++                  msg(LOG_ERR, func, 
++                  "Error activating service %s, retrying %d more time(s)...",
++                  SC_NAME(scp),
++                  MAX_SVC_ATTEMPTS - SVC_ATTEMPTS(sp));
++                  xtimer_add(cps_service_restart, 1);
++               } else {
++                  /* Give up */
++                  msg(LOG_ERR, func,
++                  "Error activating service %s", 
++                  SC_NAME(scp));
++               } 
+             } /* else */
+          }
+       }
+diff -Napur xinetd-2.3.14.old/xinetd/service.c xinetd-2.3.14.new/xinetd/service.c
+--- xinetd-2.3.14.old/xinetd/service.c	2012-02-22 19:16:56.288912783 -0800
++++ xinetd-2.3.14.new/xinetd/service.c	2012-02-22 19:25:03.059356909 -0800
+@@ -397,6 +408,7 @@ status_e svc_activate( struct service *s
+     * Initialize the service data
+     */
+    SVC_RUNNING_SERVERS(sp)   = SVC_RETRIES(sp) = 0 ;
++   SVC_ATTEMPTS(sp) = 0;
+ 
+    if ( SC_MUST_LISTEN( scp ) )
+       (void) listen( SVC_FD(sp), LISTEN_BACKLOG ) ;
+diff -Napur xinetd-2.3.14.old/xinetd/xconfig.h xinetd-2.3.14.new/xinetd/xconfig.h
+--- xinetd-2.3.14.old/xinetd/xconfig.h	2003-02-19 09:29:28.000000000 -0800
++++ xinetd-2.3.14.new/xinetd/xconfig.h	2012-02-22 19:20:20.360855514 -0800
+@@ -59,6 +59,12 @@
+ #define DEFAULT_LOOP_TIME			10
+ 
+ /*
++ * The number of times to attempt re-activating a service after being
++ * deactivated due to the above.
++ */
++#define MAX_SVC_ATTEMPTS                         30
++
++/*
+  * Signal-to-action mapping
+  */
+ #ifndef RECONFIG_HARD_SIG
diff --git a/xinetd.spec b/xinetd.spec
index 8328304..7d9d521 100644
--- a/xinetd.spec
+++ b/xinetd.spec
@@ -1,7 +1,7 @@
 Summary: A secure replacement for inetd
 Name: xinetd
 Version: 2.3.14
-Release: 44%{?dist}
+Release: 45%{?dist}
 License: xinetd 
 Group: System Environment/Daemons
 Epoch: 2
@@ -52,9 +52,11 @@ Patch22: xinetd-2.3.14-many-services.patch
 # Remove realloc of fds that was causing memory corruption
 Patch23: xinetd-2.3.14-realloc-remove.patch
 # Fix leaking descriptor when starting a service fails
-Patch24: xinetd-2.3.14-leaking-fds-2.patch
+Patch24: xinetd-2.3.14-leaking-fds-2a.patch
 # Fix #770858 - Instances limit in xinetd can be easily bypassed
 Patch25: xinetd-2.3.14-instances.patch
+# Fix #809272 - Service disabled due to bind failure
+Patch26: xinetd-2.3.14-retry-svc-activate-in-cps-restart.patch
 
 BuildRequires: autoconf, automake
 BuildRequires: libselinux-devel >= 1.30
@@ -110,8 +112,9 @@ located in the /etc/xinetd.d directory.
 %patch21 -p1 -b .leaking-fds
 %patch22 -p1 -b .many-services
 %patch23 -p1 -b .realloc-remove
-%patch24 -p1 -b .leaking-fds-2
+%patch24 -p1 -b .leaking-fds-2a
 %patch25 -p1 -b .instances
+%patch26 -p1 -b .retry-svc-activate
 
 aclocal
 autoconf
@@ -181,6 +184,11 @@ fi
 %{_mandir}/*/*
 
 %changelog
+* Fri Apr 13 2012 Jan Synáček <jsynacek at redhat.com> - 2:2.3.14-45
+- Fix: Service disabled due to bind failure
+- Update patch: xinetd-2.3.14-leaking-fds-2.patch
+- Resolves: #809272
+
 * Mon Mar 05 2012 Jan Synáček <jsynacek at redhat.com> - 2:2.3.14-44
 - Fix: Instances limit in xinetd can be easily bypassed
 - Resolves: #770858 


More information about the scm-commits mailing list