From owner-freebsd-net@freebsd.org Wed Jan 23 09:03:25 2019 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B4EF14BFD8A for ; Wed, 23 Jan 2019 09:03:25 +0000 (UTC) (envelope-from danfe@regency.nsu.ru) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 9FED66A09F for ; Wed, 23 Jan 2019 09:03:24 +0000 (UTC) (envelope-from danfe@regency.nsu.ru) Received: by mailman.ysv.freebsd.org (Postfix) id 63E7814BFD89; Wed, 23 Jan 2019 09:03:24 +0000 (UTC) Delivered-To: net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 528FB14BFD87 for ; Wed, 23 Jan 2019 09:03:24 +0000 (UTC) (envelope-from danfe@regency.nsu.ru) Received: from mx.nsu.ru (mx.nsu.ru [84.237.50.39]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D6726A09C for ; Wed, 23 Jan 2019 09:03:22 +0000 (UTC) (envelope-from danfe@regency.nsu.ru) Received: from [84.237.50.47] (helo=regency.nsu.ru) by mx.nsu.ru with esmtp (Exim 4.72) (envelope-from ) id 1gmERJ-0007In-Tr for net@freebsd.org; Wed, 23 Jan 2019 16:03:17 +0700 Received: from regency.nsu.ru (localhost [127.0.0.1]) by regency.nsu.ru (8.14.2/8.14.2) with ESMTP id x0N9YxHB089892 for ; Wed, 23 Jan 2019 15:34:59 +0600 (NOVT) (envelope-from danfe@regency.nsu.ru) Received: (from danfe@localhost) by regency.nsu.ru (8.14.2/8.14.2/Submit) id x0N9Ys4w089878 for net@freebsd.org; Wed, 23 Jan 2019 16:34:54 +0700 (+07) (envelope-from danfe) Date: Wed, 23 Jan 2019 16:34:54 +0700 From: Alexey Dokuchaev To: net@freebsd.org Subject: Why rpcb_getaddr(3) uses UDP even for TCP NFS mounts? Message-ID: <20190123093454.GA87168@regency.nsu.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-KLMS-Rule-ID: 3 X-KLMS-Message-Action: skipped X-KLMS-AntiSpam-Status: not scanned, whitelist X-KLMS-AntiPhishing: not scanned, whitelist X-KLMS-AntiVirus: Kaspersky Security 8.0 for Linux Mail Server, version 8.0.1.705, not scanned, whitelist X-Rspamd-Queue-Id: 3D6726A09C X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of danfe@regency.nsu.ru designates 84.237.50.39 as permitted sender) smtp.mailfrom=danfe@regency.nsu.ru X-Spamd-Result: default: False [0.33 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.77)[-0.768,0]; FROM_HAS_DN(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+a:mx.nsu.ru]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[net@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[4]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MX_GOOD(-0.01)[cached: mx.nsu.ru]; NEURAL_SPAM_LONG(0.12)[0.125,0]; DMARC_NA(0.00)[nsu.ru]; NEURAL_HAM_SHORT(-0.52)[-0.515,0]; SUBJECT_ENDS_QUESTION(1.00)[]; FORGED_SENDER(0.30)[danfe@nsu.ru,danfe@regency.nsu.ru]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:3335, ipnet:84.237.48.0/21, country:RU]; FROM_NEQ_ENVFROM(0.00)[danfe@nsu.ru,danfe@regency.nsu.ru]; IP_SCORE(0.00)[country: RU(0.00)] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2019 09:03:25 -0000 Hi there, I've recently encountered a problem that my NFS box was not directly accessible to one of its clients. I've forwarded TCP ports for the rpcbind(8), mountd(8), and nfsd(8) with ssh(1), but mount_nfs(8) did not work, that is, with -o tcp,proto=tcp. Running it under truss(1) revealed something odd: socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP) = 3 (0x3) ... sendto(3,"blah-blah"...,56,0,{ AF_INET :111 },16) = 56 (0x38) Only after I've forwarded port 111 via UDP, it worked as expected. Apparently, this happens inside rpcb_getaddr(3), and there is no easy way to create SOCK_STREAM/IPPROTO_TCP socket, which kind of prevents working with NFSv3 in a pure TCP environment, as forcing TCP mounts via -o tcp,proto=tcp is useless, per /usr/src/lib/libc/rpc/rpcb_clnt.c: ... #ifdef PORTMAP ... /* * Try UDP only - there are some portmappers out * there that use UDP only. */ Is there a reason for this behavior (apart from what the comment says, ignoring the fact that it is 2019 now), and more importantly, correct way to avoid talking to the rpcbind(8) via UDP? ./danfe