From owner-svn-src-all@FreeBSD.ORG Sat May 9 15:41:22 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8C55106566C; Sat, 9 May 2009 15:41:22 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CCFD8FC12; Sat, 9 May 2009 15:41:22 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n49FfMYK027554; Sat, 9 May 2009 15:41:22 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n49FfMn5027553; Sat, 9 May 2009 15:41:22 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200905091541.n49FfMn5027553@svn.freebsd.org> From: Doug Rabson Date: Sat, 9 May 2009 15:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191937 - head/sys/nlm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 May 2009 15:41:23 -0000 Author: dfr Date: Sat May 9 15:41:22 2009 New Revision: 191937 URL: http://svn.freebsd.org/changeset/base/191937 Log: Work around non-standard behaviour of rpcbind in some versions of Linux (FC4?). Submitted by: zachary dot loafman at isilon dot com Modified: head/sys/nlm/nlm_prot_impl.c Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Sat May 9 15:09:40 2009 (r191936) +++ head/sys/nlm/nlm_prot_impl.c Sat May 9 15:41:22 2009 (r191937) @@ -312,6 +312,7 @@ nlm_get_rpc(struct sockaddr *sa, rpcprog enum clnt_stat stat = RPC_SUCCESS; int rpcvers = RPCBVERS4; bool_t do_tcp = FALSE; + bool_t tryagain = FALSE; struct portmap mapping; u_short port = 0; @@ -373,14 +374,7 @@ again: stat = CLNT_CALL(rpcb, (rpcprog_t) RPCBPROC_GETADDR, (xdrproc_t) xdr_rpcb, &parms, (xdrproc_t) xdr_wrapstring, &uaddr, timo); - if (stat == RPC_PROGVERSMISMATCH) { - if (rpcvers == RPCBVERS4) - rpcvers = RPCBVERS; - else if (rpcvers == RPCBVERS) - rpcvers = PMAPVERS; - CLNT_CONTROL(rpcb, CLSET_VERS, &rpcvers); - goto again; - } else if (stat == RPC_SUCCESS) { + if (stat == RPC_SUCCESS) { /* * We have a reply from the remote RPCBIND - turn it * into an appropriate address and make a new client @@ -391,13 +385,22 @@ again: struct netbuf *a; a = __rpc_uaddr2taddr_af(ss.ss_family, uaddr); if (!a) { - CLNT_DESTROY(rpcb); - return (NULL); + tryagain = TRUE; + } else { + tryagain = FALSE; + memcpy(&ss, a->buf, a->len); + free(a->buf, M_RPC); + free(a, M_RPC); + xdr_free((xdrproc_t) xdr_wrapstring, &uaddr); } - memcpy(&ss, a->buf, a->len); - free(a->buf, M_RPC); - free(a, M_RPC); - xdr_free((xdrproc_t) xdr_wrapstring, &uaddr); + } + if (tryagain || stat == RPC_PROGVERSMISMATCH) { + if (rpcvers == RPCBVERS4) + rpcvers = RPCBVERS; + else if (rpcvers == RPCBVERS) + rpcvers = PMAPVERS; + CLNT_CONTROL(rpcb, CLSET_VERS, &rpcvers); + goto again; } break; case PMAPVERS: