RPC: populate local address for rendezvous transporter.
When accepting a connection on underlying tcp socket rpc vc transporter fails to populate local address. This change rectifies this problem by modifying rendezvous_request() to fill out the xptr structure member with appropriate information. Submitted by: Alex Burlyga <alex.burlyga.ietf@gmail.com> MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4206
This commit is contained in:
parent
b87170f210
commit
5eff94ee56
@ -281,8 +281,8 @@ rendezvous_request(SVCXPRT *xprt, struct rpc_msg *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;
|
||||
@ -347,6 +347,20 @@ rendezvous_request(SVCXPRT *xprt, struct rpc_msg *msg)
|
||||
__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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user