Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5428210rwl; Tue, 11 Apr 2023 05:28:41 -0700 (PDT) X-Google-Smtp-Source: AKy350Ydv00qHiPF+62W3rizYc4Ce0QbWo9f6PbGC43iyNCazHuuASQCRiI+uGK/rw41ik9IuOyk X-Received: by 2002:a05:6a20:66a4:b0:e7:568e:c74 with SMTP id o36-20020a056a2066a400b000e7568e0c74mr10906144pzh.23.1681216121194; Tue, 11 Apr 2023 05:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681216121; cv=none; d=google.com; s=arc-20160816; b=Y4MYpvHGSicdGAWHie82GzfYZEH063ILrKVeKuZnQtn4gtiL85Wfo29cRvfmAvYjJv v3+QxvTZqeoX06E3TPK6KKjUox4fPfQ9Y1h4sIhtO24P8ZZ5+nJbTVHQuzyMq0KJ8K0f FQR1h7FvuJYnoEPcyr2WCyBMjI8pv/fbqYw/+vWzutbPPwXDQC3qRiqZtMQ7I0aJJSMo EPjjgdsSR9czxz/yEo5GLpuC8C9OKHiA86N0PjeqMyLdEJknR/40PgeCO+190uGy90wv 1f4IzybJj0S13GIBNHzkHZlke8U23n0pyY9NyDLf2sRC+QfVwYYCKxQXUfxFX7TH0fOC i8xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=otXvsN5mlICmRtToXqcADp4/XMt+rc0kaZthGi0oCO0=; b=LXd+UsohiVa+ZKXnaCDo34ZTwMBv5CJoADcn7D29CHHmSJNYFd6y2u0ul6nsEnCVFs MR3AOMpDUpdi2NHqGBK0p3IXx41etrS7rKVgPiZSBqT+Cag7o0FDjRWo0TTdQcuvPfuF +E2380Cv8rv/G6drt83Do5l0/HvCXlx/FXRLLW/Dp1Wu0ZyOYtNFUs8BRExKHkfmuOm0 9l/v1PKmGoqvJm9YhO+b85bZo5mzjL9fjJTo6vHPNXfLi+KDJS0GYvk4TxIjaQl1H1Cw BKJSxat6CTkwE6XZ6s19zJbn6NIrKdGicyV1NWUIXLoYfIXY9bHv6Lez1Sc1QprWXuQn Mt6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w188-20020a6262c5000000b00627fbc1cb02si13580257pfb.338.2023.04.11.05.28.21; Tue, 11 Apr 2023 05:28:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229588AbjDKMSk (ORCPT + 99 others); Tue, 11 Apr 2023 08:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbjDKMSj (ORCPT ); Tue, 11 Apr 2023 08:18:39 -0400 X-Greylist: delayed 412 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 11 Apr 2023 05:18:37 PDT Received: from redcrew.org (redcrew.org [37.157.195.192]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9101D2D4E for ; Tue, 11 Apr 2023 05:18:37 -0700 (PDT) Received: from server.danny.cz (85-71-161-19.rce.o2.cz [85.71.161.19]) by redcrew.org (Postfix) with ESMTP id 07C902C49; Tue, 11 Apr 2023 14:11:44 +0200 (CEST) Received: from talos.danny.cz (unknown [IPv6:2001:470:5c11:160:47df:83f6:718e:218]) by server.danny.cz (Postfix) with ESMTP id 6BE1C11AA3F; Tue, 11 Apr 2023 14:11:43 +0200 (CEST) From: =?UTF-8?q?Dan=20Hor=C3=A1k?= To: libtirpc-devel@lists.sourceforge.net Cc: linux-nfs@vger.kernel.org, Rob Riggs Subject: [PATCH] allow TCP-only portmapper Date: Tue, 11 Apr 2023 14:11:42 +0200 Message-Id: <20230411121142.23312-1-dan@danny.cz> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Code that works in GLIBC's runrpc implementation fails with libtirpc. libtirpc forces the RPC library to talk to the portmapper via UDP, even when the client specifies TCP. This breaks existing code which expect the protocol specified to be honored, even when talking to portmapper. This is upstreaming of an old patch by Rob Riggs reported in Fedora. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1725329 Signed-off-by: Rob Riggs Signed-off-by: Dan HorĂ¡k --- src/rpcb_clnt.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c index 9a9de69..d178d86 100644 --- a/src/rpcb_clnt.c +++ b/src/rpcb_clnt.c @@ -496,11 +496,7 @@ getpmaphandle(nconf, hostname, tgtaddr) CLIENT *client = NULL; rpcvers_t pmapvers = 2; - /* - * Try UDP only - there are some portmappers out - * there that use UDP only. - */ - if (nconf == NULL || strcmp(nconf->nc_proto, NC_TCP) == 0) { + if (nconf == NULL) { struct netconfig *newnconf; if ((newnconf = getnetconfigent("udp")) == NULL) { @@ -509,7 +505,8 @@ getpmaphandle(nconf, hostname, tgtaddr) } client = getclnthandle(hostname, newnconf, tgtaddr); freenetconfigent(newnconf); - } else if (strcmp(nconf->nc_proto, NC_UDP) == 0) { + } else if (strcmp(nconf->nc_proto, NC_UDP) == 0 || + strcmp(nconf->nc_proto, NC_TCP) == 0) { if (strcmp(nconf->nc_protofmly, NC_INET) != 0) return NULL; client = getclnthandle(hostname, nconf, tgtaddr); -- 2.40.0