From nobody Mon Jun 13 18:54:36 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C30918450AD; Mon, 13 Jun 2022 18:54:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LMLMw54fJz3hL0; Mon, 13 Jun 2022 18:54:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655146476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y0brNzrk7ahAWxzR4m7nr9ac7NdpSO/h9fd46QMLYwM=; b=qpxzOyzj83V8PUZ7336+Z36PBgMV+UXugJclKdNUw0d0PNnsvSpe5YmD+v9uX3pnccnWAn Jm4+q/Wg6lSU/4XAImxcSSEXvzF9VO0lr8laO6LFkO36eZgLZ3/RU257eJjplb3ycyeIup xeQ8ktLwzWbHulBRZJE7PG+k9ptUrgaNtsWxzStMvlN0KbTpMow7F8Qjl6DpGjtrIstOWl JWOeWxW6gMZU4OUGa3tpWoAF5MOEt9eAkoH878Ifyr/dcjsEbGiTLC+eAW7CL5aS/5Okxs e0qsHM9kznN6go9Ji0UzNEtYor2JncnYVMqbvyCCRhvXwqzTbpXRSza5c2C1FQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EEDB1B537; Mon, 13 Jun 2022 18:54:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25DIsabb068908; Mon, 13 Jun 2022 18:54:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25DIsaPA068907; Mon, 13 Jun 2022 18:54:36 GMT (envelope-from git) Date: Mon, 13 Jun 2022 18:54:36 GMT Message-Id: <202206131854.25DIsaPA068907@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric van Gyzen Subject: git: 9f48eea36607 - main - rpcbind: get contact addr from xprt members List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f48eea36607cd89a88a38d4efa9f3b81d5e6e54 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655146476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y0brNzrk7ahAWxzR4m7nr9ac7NdpSO/h9fd46QMLYwM=; b=rZ8UH/dRb2UGQa9Sr8QdNf9VFLdjUh+ClySOQowx5Z0/AXaU1iOXCr6WtG9xcgkE3CW/SN 1hKQOYDBDLeA6jhyZNJjX98k7+VOvQKDE869zWTH6OLwDkMCVvk+VZas1QDyweVvUXRcRf 9UiUtLh1xRyQa+qMNTq6OLenbiOmIeT3LTr1eMV01vOCIwbvHTd3cb66K6HdSjX52TRno+ cJbGRKowoI14wZfexnQKbYPj8Fy0fH3qgwoSxvIdhF8WFjdivO/i6ElfK9Ex064ACH/DSs y1JFhJwhdYzSHti6R2eNJ5XLjWo9Y6u/HTHxFHNvimxdrE1R6++66Hgzf97GLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655146476; a=rsa-sha256; cv=none; b=UwCAwTDWzsMwPMB3zHIIbFdKLUeZtGNY7uNL26J5T3zohKcn7gx7UyEkrttBWNF20TdjRw 3M0sqZJ64A4PnOA/uTlB4T0Rcj0Oj3nu2hmBA3rBUvx7f2uZ4zBEckTdMVtu0SjNt0iKhB 34d75TMl0BfEj+SJoYLTF9MLJ4r77Wvkbh+v8t/w7E+CVyKch9OiuueSInizVim2PXrqL4 vcyzw0Cw/GRcpmZeBiQfy7Zlq+damtWWhyK+BgQ7vw0Sut1RFpGZ7K92cV1UzRekPJe/Kw Z3zp2nkdwnSm0DaF4aWhV84U/d53Opf1EmAPID1+QydIRP/X1aO8nqmX1IGD3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=9f48eea36607cd89a88a38d4efa9f3b81d5e6e54 commit 9f48eea36607cd89a88a38d4efa9f3b81d5e6e54 Author: Dmitry Ovsyannikov AuthorDate: 2022-06-13 13:34:44 +0000 Commit: Eric van Gyzen CommitDate: 2022-06-13 13:54:08 +0000 rpcbind: get contact addr from xprt members Addition to D31491 in order to actually resolve the top root cause. Currently rpcbind gets contact address from connectionless xprt->xp_p2 member of a transport and will fail to get it when working over connection oriented transport, leading to a guess game in terms of contact address on rpcinfo requests like RPCBPROC_GETVERSADDR or RPCBPROC_GETADDRLIST and poor returns which may influence a user of a call and specifically reported on OSX clients, which tend to not provide address hint from rpcinfo request to a server. MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D35220 --- include/rpc/svc.h | 4 ++++ usr.sbin/rpcbind/check_bound.c | 11 +++++------ usr.sbin/rpcbind/util.c | 16 ++++++++-------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/rpc/svc.h b/include/rpc/svc.h index 912d26ba4461..4cffd4070817 100644 --- a/include/rpc/svc.h +++ b/include/rpc/svc.h @@ -165,6 +165,10 @@ struct svc_req { * Approved way of getting address of caller */ #define svc_getrpccaller(x) (&(x)->xp_rtaddr) +/* + * Approved way of getting address of callee + */ +#define svc_getrpccallee(x) (&(x)->xp_ltaddr) /* * Operations defined on an SVCXPRT handle diff --git a/usr.sbin/rpcbind/check_bound.c b/usr.sbin/rpcbind/check_bound.c index cf0a029dad72..1f9382d33730 100644 --- a/usr.sbin/rpcbind/check_bound.c +++ b/usr.sbin/rpcbind/check_bound.c @@ -161,7 +161,7 @@ char * mergeaddr(SVCXPRT *xprt, char *netid, char *uaddr, char *saddr) { struct fdlist *fdl; - struct svc_dg_data *dg_data; + struct netbuf *callee; char *c_uaddr, *s_uaddr, *m_uaddr, *allocated_uaddr = NULL; for (fdl = fdhead; fdl; fdl = fdl->next) @@ -182,12 +182,11 @@ mergeaddr(SVCXPRT *xprt, char *netid, char *uaddr, char *saddr) * address by which it contacted us. Use that for the "client" uaddr, * otherwise use the info from the SVCXPRT. */ - dg_data = (struct svc_dg_data*)xprt->xp_p2; - if (dg_data != NULL && dg_data->su_srcaddr.buf != NULL) { - c_uaddr = taddr2uaddr(fdl->nconf, &dg_data->su_srcaddr); + callee = svc_getrpccallee(xprt); + if (callee != NULL && callee->buf != NULL) { + c_uaddr = taddr2uaddr(fdl->nconf, callee); allocated_uaddr = c_uaddr; - } - else if (saddr != NULL) { + } else if (saddr != NULL) { c_uaddr = saddr; } else { c_uaddr = taddr2uaddr(fdl->nconf, svc_getrpccaller(xprt)); diff --git a/usr.sbin/rpcbind/util.c b/usr.sbin/rpcbind/util.c index e497e9227690..7662f2357d48 100644 --- a/usr.sbin/rpcbind/util.c +++ b/usr.sbin/rpcbind/util.c @@ -101,7 +101,7 @@ bitmaskcmp(struct sockaddr *dst, struct sockaddr *src, struct sockaddr *mask) /* * Find a server address that can be used by `caller' to contact - * the local service specified by `serv_uaddr'. If `clnt_uaddr' is + * the local service specified by `serv_uaddr'. If `contct_uaddr' is * non-NULL, it is used instead of `caller' as a hint suggesting * the best address (e.g. the `r_addr' field of an rpc, which * contains the rpcbind server address that the caller used). @@ -110,8 +110,8 @@ bitmaskcmp(struct sockaddr *dst, struct sockaddr *src, struct sockaddr *mask) * string which should be freed by the caller. On error, returns NULL. */ char * -addrmerge(struct netbuf *caller, const char *serv_uaddr, const char *clnt_uaddr, - const char *netid) +addrmerge(struct netbuf *caller, const char *serv_uaddr, + const char *contct_uaddr, const char *netid) { struct ifaddrs *ifap, *ifp = NULL, *bestif; struct netbuf *serv_nbp = NULL, *hint_nbp = NULL, tbuf; @@ -128,7 +128,7 @@ addrmerge(struct netbuf *caller, const char *serv_uaddr, const char *clnt_uaddr, #ifdef ND_DEBUG if (debugging) fprintf(stderr, "addrmerge(caller, %s, %s, %s\n", serv_uaddr, - clnt_uaddr == NULL ? "NULL" : clnt_uaddr, netid); + contct_uaddr == NULL ? "NULL" : contct_uaddr, netid); #endif caller_sa = caller->buf; if ((nconf = rpcbind_get_conf(netid)) == NULL) @@ -137,15 +137,15 @@ addrmerge(struct netbuf *caller, const char *serv_uaddr, const char *clnt_uaddr, goto freeit; /* - * Use `clnt_uaddr' as the hint if non-NULL, but ignore it if its + * Use `contct_uaddr' as the hint if non-NULL, but ignore it if its * address family is different from that of the caller. */ hint_sa = NULL; - if (clnt_uaddr != NULL) { + if (contct_uaddr != NULL) { #ifdef ND_DEBUG - hint_uaddr = clnt_uaddr; + hint_uaddr = contct_uaddr; #endif - if ((hint_nbp = uaddr2taddr(nconf, clnt_uaddr)) == NULL) + if ((hint_nbp = uaddr2taddr(nconf, contct_uaddr)) == NULL) goto freeit; hint_sa = hint_nbp->buf; }