- Make sure remote address (xp_rtaddr) is populated with the correct type

of address.
This commit is contained in:
Steve Dickson 2007-07-30 11:56:40 +00:00
parent 808a248167
commit 04c2ae6257
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,52 @@
commit f8ff8f0de33606ff544dc87c0a9993fd3a0f5475
Author: Steve Dickson <steved@redhat.com>
Date: Mon Jul 30 07:26:45 2007 -0400
- Make sure remote address (xp_rtaddr) is populated
with the correct type of address.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/src/svc_vc.c b/src/svc_vc.c
index 48494e1..3d77aef 100644
--- a/src/svc_vc.c
+++ b/src/svc_vc.c
@@ -239,7 +239,10 @@ svc_fd_create(fd, sendsize, recvsize)
warnx("svc_fd_create: no mem for local addr");
goto freedata;
}
- memcpy(ret->xp_rtaddr.buf, &sin6, (size_t)sizeof(ss));
+ if (ss.ss_family == AF_INET)
+ memcpy(ret->xp_rtaddr.buf, &ss, (size_t)sizeof(ss));
+ else
+ memcpy(ret->xp_rtaddr.buf, &sin6, (size_t)sizeof(ss));
#ifdef PORTMAP
if (sin6.sin6_family == AF_INET6 || sin6.sin6_family == AF_LOCAL) {
memcpy(&ret->xp_raddr, ret->xp_rtaddr.buf,
@@ -343,20 +346,23 @@ again:
newxprt = makefd_xprt(sock, r->sendsize, r->recvsize);
if (addr.ss_family == AF_INET) {
map_ipv4_to_ipv6((struct sockaddr_in *)&addr, &sin6);
- len = sizeof(struct sockaddr_in6);
} else {
memcpy(&sin6, &addr, len);
}
newxprt->xp_rtaddr.buf = mem_alloc(len);
if (newxprt->xp_rtaddr.buf == NULL)
return (FALSE);
- memcpy(newxprt->xp_rtaddr.buf, &sin6, len);
+
+ if (addr.ss_family == AF_INET)
+ memcpy(newxprt->xp_rtaddr.buf, &addr, len);
+ else
+ memcpy(newxprt->xp_rtaddr.buf, &sin6, len);
newxprt->xp_rtaddr.maxlen = newxprt->xp_rtaddr.len = len;
#ifdef PORTMAP
if (sin6.sin6_family == AF_INET6 || sin6.sin6_family == AF_LOCAL) {
memcpy(&newxprt->xp_raddr, newxprt->xp_rtaddr.buf,
sizeof(struct sockaddr_in6));
- newxprt->xp_addrlen = len;
+ newxprt->xp_addrlen = sizeof(struct sockaddr_in6);
}
#endif /* PORTMAP */
if (__rpc_fd2sockinfo(sock, &si) && si.si_proto == IPPROTO_TCP) {

View File

@ -42,6 +42,7 @@ Patch9: libtirpc-0.1.7-clnt_raw-mutex.patch
Patch10: libtirpc-0.1.7-snprintf.patch Patch10: libtirpc-0.1.7-snprintf.patch
Patch11: libtirpc-0.1.7-bindresvport-ntohs.patch Patch11: libtirpc-0.1.7-bindresvport-ntohs.patch
Patch12: libtirpc-0.1.7-dgcall-iprecverr.patch Patch12: libtirpc-0.1.7-dgcall-iprecverr.patch
Patch13: libtirpc-0.1.7-svc-rtaddr.patch
Patch100: libtirpc-0.1.7-compile.patch Patch100: libtirpc-0.1.7-compile.patch
@ -64,6 +65,7 @@ developing programs which use the tirpc library.
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
%patch12 -p1 %patch12 -p1
%patch13 -p1
%patch100 -p1 %patch100 -p1
@ -150,6 +152,8 @@ rm -rf %{buildroot}
- A couple ntohs() were needed in bindresvport_sa() - A couple ntohs() were needed in bindresvport_sa()
- Added IP_RECVERR processing with to clnt_dg_call() so - Added IP_RECVERR processing with to clnt_dg_call() so
application will see errors instead of timing out application will see errors instead of timing out
- Make sure remote address (xp_rtaddr) is populated
with the correct type of address.
* Mon Jul 9 2007 <steved@redhat.com> 0.1.7-7 * Mon Jul 9 2007 <steved@redhat.com> 0.1.7-7
- Fixed infinite loop in svc_run() (bz 246677) - Fixed infinite loop in svc_run() (bz 246677)