rpms/libtirpc/devel libtirpc-0.1.9-ipv6-socket.patch, NONE, 1.1 libtirpc-0.1.9-rpc_getbroadifs-sizeof.patch, NONE, 1.1 libtirpc.spec, 1.32, 1.33

Steve Dickson steved at fedoraproject.org
Thu Sep 4 18:18:52 UTC 2008


Author: steved

Update of /cvs/pkgs/rpms/libtirpc/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31266

Modified Files:
	libtirpc.spec 
Added Files:
	libtirpc-0.1.9-ipv6-socket.patch 
	libtirpc-0.1.9-rpc_getbroadifs-sizeof.patch 
Log Message:
- Always make IPv6 sockets V6ONLY
- Fix incorrect sizeof() in __rpc_getbroadifs


libtirpc-0.1.9-ipv6-socket.patch:

--- NEW FILE libtirpc-0.1.9-ipv6-socket.patch ---
commit ea9f048761d0b9a2ab6310bffa07351f0b04d8c5
Author: Olaf Kirch <okir at suse.de>
Date:   Tue Sep 2 12:11:15 2008 -0400

    Always make IPv6 sockets V6ONLY
    
    Assume you have a netconfig file looking like this:
    
    udp        tpi_clts      v     inet     udp     -       -
    udp6       tpi_clts      v     inet6    udp     -       -
    ...
    
    a call to svc_tli_create(... &someaddr, "udp") will fail to create an
    IPv6 server socket. The problem is that on Linux, passive IPv6 sockets
    will also accept packets/connections from IPv4, and will simply map
    the sender's address to an IPv6 mapped IPv4 address. So if you want to
    bind both a UDPv4 and UDPv6 socket to the same port, this will fail with
    EADDRINUSE.
    
    The way to avoid this behavior is to change the socket to V6ONLY,
    which tells the kernel to avoid the autmatic mapping.
    
    The change proposed in the patch below does this. I *think* this is
    a good place to do this, as it will also fix applications that do not
    use svc_tli_create() - such as rpcbind, which creates the sockets on
    its own using __rpc_nconf2fd.
    
    I think this also improves portability, as BSD code assumes BSD
    behavior, where this mapping does not occur either.
    
    Signed-off-by: Olaf Kirch <okir at suse.de>
    Signed-off-by: Steve Dickson <steved at redhat.com>

diff --git a/src/rpc_generic.c b/src/rpc_generic.c
index 583aff0..ff4ba16 100644
--- a/src/rpc_generic.c
+++ b/src/rpc_generic.c
@@ -525,11 +525,18 @@ int
 __rpc_nconf2fd(const struct netconfig *nconf)
 {
 	struct __rpc_sockinfo si;
+	int fd;
 
 	if (!__rpc_nconf2sockinfo(nconf, &si))
 		return 0;
 
-	return socket(si.si_af, si.si_socktype, si.si_proto);
+	if ((fd = socket(si.si_af, si.si_socktype, si.si_proto)) >= 0 &&
+	    si.si_af == AF_INET6) {
+		int val = 1;
+
+		setsockopt(fd, SOL_IPV6, IPV6_V6ONLY, &val, sizeof(val));
+	}
+	return fd;
 }
 
 int

libtirpc-0.1.9-rpc_getbroadifs-sizeof.patch:

--- NEW FILE libtirpc-0.1.9-rpc_getbroadifs-sizeof.patch ---
commit 95c8f7227e6b15f2e430d7b87dadc95b2acd4a61
Author: Olaf Kirch <okir at suse.de>
Date:   Tue Sep 2 12:09:39 2008 -0400

    Fix incorrect sizeof() in __rpc_getbroadifs
    
    __rpc_getbroadifs returns bad broadcast addresses on 32bit
    machines because when copying the broadcast addresses, ite
    applies the sizeof() operator to a pointer to a sockaddr,
    rather than the sockaddr itself.
    
    Signed-off-by: Olaf Kirch <okir at suse.de>
    Signed-off-by: Steve Dickson <steved at redhat.com>

diff --git a/src/clnt_bcast.c b/src/clnt_bcast.c
index a96db45..aa2b8f2 100644
--- a/src/clnt_bcast.c
+++ b/src/clnt_bcast.c
@@ -163,7 +163,7 @@ __rpc_getbroadifs(int af, int proto, int socktype, broadlist_t *list)
 		  /*	memcpy(&bip->broadaddr, ifap->ifa_broadaddr,
 			(size_t)ifap->ifa_broadaddr->sa_len);*/
 			memcpy(&bip->broadaddr, ifap->ifa_broadaddr,
-			(size_t)sizeof(ifap->ifa_broadaddr));
+					sizeof(bip->broadaddr));
 			sin = (struct sockaddr_in *)(void *)&bip->broadaddr;
 			sin->sin_port =
 			    ((struct sockaddr_in *)


Index: libtirpc.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libtirpc/devel/libtirpc.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- libtirpc.spec	7 Aug 2008 15:52:20 -0000	1.32
+++ libtirpc.spec	4 Sep 2008 18:18:22 -0000	1.33
@@ -1,6 +1,6 @@
 Name:		   libtirpc
 Version:		0.1.9
-Release:		3%{?dist}
+Release:		4%{?dist}
 Summary:		Transport Independent RPC Library
 Group:		  	System Environment/Libraries
 License:		SISSL
@@ -30,6 +30,9 @@
 Requires:	%{name} = %{version}-%{release}
 Requires(devel):	pkgconfig man
 
+Patch01:  libtirpc-0.1.9-rpc_getbroadifs-sizeof.patch
+Patch02:  libtirpc-0.1.9-ipv6-socket.patch
+
 Patch100: libtirpc-0.1.7-compile.patch
 
 %description devel
@@ -40,6 +43,9 @@
 %prep
 %setup -q
 
+%patch01	-p1
+%patch02	-p1
+
 %patch100	-p1
 
 # Remove .orig files
@@ -137,6 +143,10 @@
 %{_mandir}/*/*
 
 %changelog
+* Thu Sep  4 2008 Steve Dickson <steved at redhat.com> 0.1.9-4
+- Always make IPv6 sockets V6ONLY
+- Fix incorrect sizeof() in __rpc_getbroadifs
+
 * Thu Aug  7 2008 Tom "spot" Callaway <tcallawa at redhat.com> 0.1.9-3
 - fix license tag
 




More information about the fedora-extras-commits mailing list