Date: Wed, 23 Jan 2019 20:40:39 +0000 From: Rick Macklem <rmacklem@uoguelph.ca> To: Alexey Dokuchaev <danfe@nsu.ru>, "net@freebsd.org" <net@freebsd.org> Subject: Re: Why rpcb_getaddr(3) uses UDP even for TCP NFS mounts? Message-ID: <YQBPR01MB01134DB658390853B481B211DD990@YQBPR01MB0113.CANPRD01.PROD.OUTLOOK.COM> In-Reply-To: <20190123093454.GA87168@regency.nsu.ru> References: <20190123093454.GA87168@regency.nsu.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Alexey Dokuchaev wrote: >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=3Dtcp. > >Running it under truss(1) revealed something odd: > > socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP) =3D 3 (0x3) > ... > sendto(3,"blah-blah"...,56,0,{ AF_INET <ip-address>:111 },16) =3D 56 (= 0x38) > <hangs here> > >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=3Dtcp is useless, per /usr/src/lib/libc/rpc/rpcb_clnt.c: Well, there is a reason why NFSv4 (published in an RFC in 2003) does not u= se the Mount protocol or rpcbind. Those protocols were defined decades ago by a company that no longer exists= . If you took a look at Linux sources and found that they avoided using UDP f= or rpcbind, then a compatible change would probably be ok. I now consider the Linux NFS implementation as being the defacto standard. >#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? As above, who knows what implementations are still out there? Since the company (Sun) is long gone, what the Linux sources do probably would be a guide w.r.t. this can be changed. (When I say "Linux", I am not referring to the kernel, but what most distros use. I think most of them will use roughly the same GNU sources, but that also introduces another "degree of freedom" here. To do this well, you probably have to look at several distros and see if they all handle TCP only rpcbind.) rick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YQBPR01MB01134DB658390853B481B211DD990>