From patchwork Mon Apr 9 17:28:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10331869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F00A960236 for ; Mon, 9 Apr 2018 17:28:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E17781FFB2 for ; Mon, 9 Apr 2018 17:28:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5D2F28B9A; Mon, 9 Apr 2018 17:28:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F8801FFB2 for ; Mon, 9 Apr 2018 17:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753074AbeDIR22 (ORCPT ); Mon, 9 Apr 2018 13:28:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751653AbeDIR22 (ORCPT ); Mon, 9 Apr 2018 13:28:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC2BE61BB2; Mon, 9 Apr 2018 17:28:27 +0000 (UTC) Received: from steved.boston.devel.redhat.com (ovpn-116-71.phx2.redhat.com [10.3.116.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92C85608EE; Mon, 9 Apr 2018 17:28:27 +0000 (UTC) From: Steve Dickson To: Libtirpc-devel Mailing List Cc: Linux NFS Mailing list Subject: [PATCH] clnt_com_create: Restore backwards compatibility with the legacy glibc code. Date: Mon, 9 Apr 2018 13:28:25 -0400 Message-Id: <20180409172825.169380-1-steved@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 09 Apr 2018 17:28:27 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 46e04a73 changed clnt_com_create() to avoid using reserved ports when creating the the CLIENT ptr. This change breaks backward compatibility with the legacy RPC code that was in glibc. This patch reverts that commit to restore backwards compatibility Signed-off-by: Steve Dickson --- src/rpc_soc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rpc_soc.c b/src/rpc_soc.c index af6c482..ed0892a 100644 --- a/src/rpc_soc.c +++ b/src/rpc_soc.c @@ -67,8 +67,6 @@ extern mutex_t rpcsoc_lock; -extern int __binddynport(int fd); - static CLIENT *clnt_com_create(struct sockaddr_in *, rpcprog_t, rpcvers_t, int *, u_int, u_int, char *, int); static SVCXPRT *svc_com_create(int, u_int, u_int, char *); @@ -147,8 +145,7 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp, flags) bindaddr.maxlen = bindaddr.len = sizeof (struct sockaddr_in); bindaddr.buf = raddr; - if (__binddynport(fd) == -1) - goto err; + bindresvport(fd, NULL); cl = clnt_tli_create(fd, nconf, &bindaddr, prog, vers, sendsz, recvsz); if (cl) { @@ -316,6 +313,7 @@ svc_com_create(fd, sendsize, recvsize, netid) SVCXPRT *svc; int madefd = FALSE; int port; + struct sockaddr_in sin; if ((nconf = __rpc_getconfip(netid)) == NULL) { (void) syslog(LOG_ERR, "Could not get %s transport", netid); @@ -332,6 +330,10 @@ svc_com_create(fd, sendsize, recvsize, netid) madefd = TRUE; } + memset(&sin, 0, sizeof sin); + sin.sin_family = AF_INET; + bindresvport(fd, &sin); + listen(fd, SOMAXCONN); svc = svc_tli_create(fd, nconf, NULL, sendsize, recvsize); (void) freenetconfigent(nconf); if (svc == NULL) {