[PATCH] The "sort=" parameter of the "resolver" directive
pluknet at nginx.com
Thu Jun 30 16:13:55 UTC 2022
> On 29 Jun 2022, at 04:51, Maxim Dounin <mdounin at mdounin.ru> wrote:
> On Tue, Jun 28, 2022 at 04:24:58PM +0400, Roman Arutyunyan wrote:
>> On Thu, Jun 16, 2022 at 07:17:13PM +0400, Sergey Kandaurov wrote:
>>>> On 23 Feb 2022, at 08:11, Ruslan Ermilov <ru at nginx.com> wrote:
>>>> src/core/ngx_resolver.c | 38 +++++++++++++++++++++++++++++++++++++-
>>>> src/core/ngx_resolver.h | 5 +++++
>>>> 2 files changed, 42 insertions(+), 1 deletions(-)
>>>> # HG changeset patch
>>>> # User Ruslan Ermilov <ru at nginx.com>
>>>> # Date 1645589387 -10800
>>>> # Wed Feb 23 07:09:47 2022 +0300
>>>> # Node ID 8db4bbd67840e8bebb23f9c6d10c0f633552e616
>>>> # Parent 1c19779448db2309d607c74e2628ff98f84569ff
>>>> The "sort=" parameter of the "resolver" directive.
>>> IMHO, the name isn't enough self-documenting in this context.
>>> It can be misinterpreted as sorting addresses, not families.
>>> I'd prefer the parameter name "prefer" here.
>> Jftr, we had a discussion about this. I like the new name. There's no
>> sorting here.
> IIRC, the "sort=" option was expected to be a simplified version
> of the sortlist option of resolv.conf. It was intentionally made
> extendable, so potentially we can support all the sortlist
> features if needed. Ruslan might remember details, make sure to
> discuss this with him.
As discussed with Ruslan, and if I got him right, the "sort" name has
a weak relation to sortlist, the intension is to sort address families,
including future ones (which is rather theoretical).
In principle, the syntax can be extended to arbitrary address prefixes.
As additionally discussed, sortlist is substituted with precedence based
lookup table in RFC 3484 (now RFC 6724) for default address selection.
In gethostbyname() sortlist is used for query type A only, and in
getaddrinfo() it is the same limitation "for backward compatibility
against gethostbyname(3)". On the other hand, address selection policy
based reordering is applied for all address families in getaddrinfo().
(This is based on my research of KAME/BSD sources.)
The "prefer" name is actually inspired by RFC 3484 and related terminology.
More information about the nginx-devel