rpms/rpcbind/devel rpcbind-0.2.0-soreuseaddr-listner.patch, NONE, 1.1 rpcbind.spec, 1.43, 1.44

Steve Dickson steved at fedoraproject.org
Tue Jul 6 18:36:40 UTC 2010


Author: steved

Update of /cvs/pkgs/rpms/rpcbind/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv26273

Modified Files:
	rpcbind.spec 
Added Files:
	rpcbind-0.2.0-soreuseaddr-listner.patch 
Log Message:
- Set SO_REUSEADDR on listening sockets (bz 597356)



rpcbind-0.2.0-soreuseaddr-listner.patch:
 rpcbind.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- NEW FILE rpcbind-0.2.0-soreuseaddr-listner.patch ---
commit 68556dc512493868960b367406e04d7169c003a8
Author: Jeff Layton <jlayton at redhat.com>
Date:   Tue Jun 22 17:33:14 2010 -0400

    nd: set SO_REUSEADDR on NC_TPI_COTS listening sockets
    
    I previously sent this patch to the libtirpc-devel list but got no
    response. Resending with wider distribution...
    
    If we don't set SO_REUSEADDR, then if there are any sockets on this port
    in TIME_WAIT state when rpcbind is restarted then that will prevent the
    bind() call from succeeding.
    
    Details of the problem are here:
    
        https://bugzilla.redhat.com/show_bug.cgi?id=597356
    
    Signed-off-by: Jeff Layton <jlayton at redhat.com>
    Signed-off-by: Steve Dickson <steved at redhat.com>

diff --git a/src/rpcbind.c b/src/rpcbind.c
index ddf2cfc..c8f0d9f 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -276,6 +276,7 @@ init_transport(struct netconfig *nconf)
 	int addrlen = 0;
 	int nhostsbak;
 	int checkbind;
+	int on = 1;
 	struct sockaddr *sa = NULL;
 	u_int32_t host_addr[4];  /* IPv4 or IPv6 */
 	struct sockaddr_un sun;
@@ -493,6 +494,14 @@ init_transport(struct netconfig *nconf)
 		}
 		oldmask = umask(S_IXUSR|S_IXGRP|S_IXOTH);
 		__rpc_fd2sockinfo(fd, &si);
+		if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on,
+				sizeof(on)) != 0) {
+			syslog(LOG_ERR, "cannot set SO_REUSEADDR on %s",
+				nconf->nc_netid);
+			if (res != NULL)
+				freeaddrinfo(res);
+			return 1;
+		}
 		if (bind(fd, sa, addrlen) < 0) {
 			syslog(LOG_ERR, "cannot bind %s: %m", nconf->nc_netid);
 			if (res != NULL)


Index: rpcbind.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rpcbind/devel/rpcbind.spec,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -p -r1.43 -r1.44
--- rpcbind.spec	27 Jul 2009 03:10:47 -0000	1.43
+++ rpcbind.spec	6 Jul 2010 18:36:39 -0000	1.44
@@ -2,7 +2,7 @@
 
 Name:           rpcbind
 Version:        0.2.0
-Release:	4%{?dist}
+Release:	5%{?dist}
 Summary:        Universal Addresses to RPC Program Number Mapper
 Group:          System Environment/Daemons
 License:        GPL
@@ -13,6 +13,7 @@ Source0:        http://downloads.sourcef
 Source1: rpcbind.init
 
 Patch100: rpcbind-0.2.0-usage-fix.patch
+Patch101: rpcbind-0.2.0-soreuseaddr-listner.patch
 
 Requires: glibc-common setup
 Conflicts: man-pages < 2.43-12
@@ -35,6 +36,7 @@ RPC calls on a server on that machine.
 %prep
 %setup -q
 %patch100 -p1
+%patch101 -p1
 
 %build
 %ifarch s390 s390x
@@ -120,6 +122,9 @@ fi
 %dir %attr(700,rpc,rpc) /var/lib/rpcbind
 
 %changelog
+* Tue Jul  6 2010 Steve Dickson <steved at redhat.com> - 0.2.0-5
+- Set SO_REUSEADDR on listening sockets (bz 597356)
+
 * Sun Jul 26 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.2.0-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 



More information about the scm-commits mailing list