Date: Fri, 8 Jan 2016 00:21:56 +0000 (UTC) From: Stanislav Sedov <stas@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293401 - stable/10/lib/libc/rpc Message-ID: <201601080021.u080Luwv009416@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: stas Date: Fri Jan 8 00:21:55 2016 New Revision: 293401 URL: https://svnweb.freebsd.org/changeset/base/293401 Log: MFC r292047: RPC: populate local address for rendezvous transporter. Modified: stable/10/lib/libc/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/rpc/svc_vc.c ============================================================================== --- stable/10/lib/libc/rpc/svc_vc.c Fri Jan 8 00:07:37 2016 (r293400) +++ stable/10/lib/libc/rpc/svc_vc.c Fri Jan 8 00:21:55 2016 (r293401) @@ -292,8 +292,8 @@ rendezvous_request(xprt, msg) int sock, flags; struct cf_rendezvous *r; struct cf_conn *cd; - struct sockaddr_storage addr; - socklen_t len; + struct sockaddr_storage addr, sslocal; + socklen_t len, slen; struct __rpc_sockinfo si; SVCXPRT *newxprt; fd_set cleanfds; @@ -358,6 +358,20 @@ again: __xdrrec_setnonblock(&cd->xdrs, cd->maxrec); } else cd->nonblock = FALSE; + slen = sizeof(struct sockaddr_storage); + if(_getsockname(sock, (struct sockaddr *)(void *)&sslocal, &slen) < 0) { + warnx("svc_vc_create: could not retrieve local addr"); + newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = 0; + } else { + newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = sslocal.ss_len; + newxprt->xp_ltaddr.buf = mem_alloc((size_t)sslocal.ss_len); + if (newxprt->xp_ltaddr.buf == NULL) { + warnx("svc_vc_create: no mem for local addr"); + newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = 0; + } else { + memcpy(newxprt->xp_ltaddr.buf, &sslocal, (size_t)sslocal.ss_len); + } + } gettimeofday(&cd->last_recv_time, NULL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601080021.u080Luwv009416>