From: Chuck Lever III <chuck.lever@oracle.com>
To: Roland Mainz <roland.mainz@nrubsig.org>,
Martin Wege <martin.l.wege@gmail.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
Cedric Blancher <cedric.blancher@gmail.com>
Subject: Re: refer= syntax in /etc/exports for custom non-2049 TCP ports ? / was: Re: Change "hostname" to "hostport" in text-based mountd downcall Re: BUG in exports(5), no example for refer= Re: Examples for refer= in /etc/exports?
Date: Wed, 31 Jan 2024 14:41:41 +0000 [thread overview]
Message-ID: <0EC68335-F4EB-43B2-BF95-0C3A6E01FCC8@oracle.com> (raw)
In-Reply-To: <CAKAoaQkdf41emWL-2Uq9_kFjF99Xc7UEK_ur0MmnfFAjJqLM7A@mail.gmail.com>
> On Jan 29, 2024, at 10:07 AM, Roland Mainz <roland.mainz@nrubsig.org> wrote:
>
> On Mon, Jan 29, 2024 at 3:14 PM Chuck Lever III <chuck.lever@oracle.com> wrote:
>>
>>> On Jan 29, 2024, at 6:44 AM, Roland Mainz <roland.mainz@nrubsig.org> wrote:
>>>
>>> What would be the correct syntax to specify a custom (non-2049) TCP
>>> port for refer= in /etc/exports ?
>>>
>>> Would this work:
>>> ---- snip ----
>>> `/ref *(no_root_squash,refer=/export/home@134.49.22.111:32049)
>>> ---- snip ----
>>
>> Hello Roland -
>>
>> Although generic NFSv4 referral support has been in NFSD for
>> many years, NFSD currently does not implement alternate ports
>> in referrals.
>
> I know, but the question is about the syntax in /etc/exports. The idea
> is to use the same syntax for other NFSv4 server implementations (like
> nfs4j) ...
>
> For context: I have a ticket open for the ms-nfs41-client to get the
> referral support with custom (non-2049) TCP ports fixed...
Here's a workaround that might be used with current
versions of NFSD. I'm going to walk through this because
there is some information that could be useful for
ms-nfs41-client.
Referrals are conveyed to NFSv4 clients using the
fs_locations attribute of GETATTR. This attribute conveys
a list of alternate locations a client can use to access
the share it's looking for.
Each item in the list looks like this:
struct fs_location4 {
utf8str_cis server<>;
pathname4 rootpath;
};
The content of the server<> field is either a hostname or
an IP address. RFC 8881 Section 11.16 says:
> An IPv4 or IPv6 address is represented as a universal address (see Section 3.3.9 and [12]), minus the netid, and either with or without the trailing ".p1.p2" suffix that represents the port number. If the suffix is omitted, then the default port, 2049, SHOULD be assumed.
Therefore there is only one way to convey an alternate
port. You can't do it when the server<> field contains a
DNS label; the server has to spell it out with a universal
address. This is part of the NFSv4 protocol, it's not an
NFSD limitation.
(When NFSD supports this properly, it will need to resolve
each hostname to an IP address, when an alternate port is
present, before it builds the fs_location4 list item).
It turns out that our mountd passes the "host" part of the
refer= option to the kernel without much additional
checking, so you can specify a full IPv4 universal address
like so:
/export/referral *(refer=/export/yada@192.168.1.77 <mailto:refer=/export/yada@192.168.1.77>.8.1)
That is, it's an IPv4 address with a .p1.p2 suffix.
p1 = port DIV 256
p2 = port MOD 256
Here, .8.1 is port 2049.
I've tried some simple testing, and it seems to work with
both refer= and nfsref.
This refer= port syntax probably won't work for IPv6
addresses, and definitely will not for DNS labels. Thus
I consider this a hack and not a long-term solution for
NFSD.
Regarding Roland's question about copying this syntax for
other NFSv4 servers: I recommend that you don't do that.
You'll end up copying its mistakes and limitations. To
amplify my previous explanation: this is unfinished work,
and there are other, better ways to handle referrals.
Moreover, you can't copy what doesn't exist. Since NFSD
currently does not support alternate ports in any kind
of robust way, there's nothing to copy. Each server
implementation will have to invent their own.
--
Chuck Lever
next prev parent reply other threads:[~2024-01-31 14:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 9:51 Examples for refer= in /etc/exports? Cedric Blancher
2023-11-10 0:05 ` BUG in exports(5), no example for refer= " Cedric Blancher
2023-11-10 0:37 ` Chuck Lever III
2023-11-10 0:47 ` Cedric Blancher
2023-11-10 2:19 ` Chuck Lever III
2023-11-10 2:42 ` Cedric Blancher
2023-11-10 5:09 ` Chuck Lever III
2023-11-10 8:30 ` Martin Wege
2023-11-10 18:55 ` Chuck Lever III
2023-11-13 1:01 ` Change "hostname" to "hostport" in text-based mountd downcall " Cedric Blancher
2023-11-13 15:48 ` Steve Dickson
2023-11-19 17:17 ` Cedric Blancher
2024-01-24 14:04 ` Cedric Blancher
2024-01-24 14:05 ` Cedric Blancher
2024-01-29 11:44 ` refer= syntax in /etc/exports for custom non-2049 TCP ports ? / was: " Roland Mainz
2024-01-29 14:14 ` Chuck Lever III
2024-01-29 15:07 ` Roland Mainz
2024-01-29 15:51 ` Chuck Lever III
2024-01-29 23:45 ` Martin Wege
2024-01-31 14:41 ` Chuck Lever III [this message]
2023-11-10 7:11 ` Martin Wege
2023-11-10 19:02 ` Chuck Lever III
2023-11-13 1:12 ` No bugzilla account confirmation email from bugzilla.linux-nfs.org " Cedric Blancher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0EC68335-F4EB-43B2-BF95-0C3A6E01FCC8@oracle.com \
--to=chuck.lever@oracle.com \
--cc=cedric.blancher@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=martin.l.wege@gmail.com \
--cc=roland.mainz@nrubsig.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox