From patchwork Tue Apr 10 21:30:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10333863 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 3BAD46053C for ; Tue, 10 Apr 2018 21:30:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C36E28478 for ; Tue, 10 Apr 2018 21:30:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AC2A284FC; Tue, 10 Apr 2018 21:30:49 +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 18285284E4 for ; Tue, 10 Apr 2018 21:30:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876AbeDJVaq (ORCPT ); Tue, 10 Apr 2018 17:30:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35644 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbeDJVaq (ORCPT ); Tue, 10 Apr 2018 17:30:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 104D9C0587F3; Tue, 10 Apr 2018 21:30:46 +0000 (UTC) Received: from steved.boston.devel.redhat.com (ovpn-117-159.phx2.redhat.com [10.3.117.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABC698E3F1; Tue, 10 Apr 2018 21:30:45 +0000 (UTC) From: Steve Dickson To: Libtirpc-devel Mailing List Cc: Linux NFS Mailing list Subject: [PATCH 1/2] Restore using reserve ports for client connections Date: Tue, 10 Apr 2018 17:30:42 -0400 Message-Id: <20180410213043.5545-1-steved@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 10 Apr 2018 21:30:46 +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 both clnt_com_create() and clnt_tli_create() to avoid using reserve ports when creating connection to the server. For certain legacy apps, the client has to used reserve port to be able to communicate with its server so using of reserve ports is restored. Signed-off-by: Steve Dickson --- src/clnt_generic.c | 3 +-- src/rpc_soc.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/clnt_generic.c b/src/clnt_generic.c index e5a314f..774292b 100644 --- a/src/clnt_generic.c +++ b/src/clnt_generic.c @@ -341,8 +341,7 @@ clnt_tli_create(int fd, const struct netconfig *nconf, servtype = nconf->nc_semantics; if (!__rpc_fd2sockinfo(fd, &si)) goto err; - if (__binddynport(fd) == -1) - goto err; + bindresvport(fd, NULL); } else { if (!__rpc_fd2sockinfo(fd, &si)) goto err; diff --git a/src/rpc_soc.c b/src/rpc_soc.c index af6c482..f32a27c 100644 --- a/src/rpc_soc.c +++ b/src/rpc_soc.c @@ -147,8 +147,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) {