mailing list of musl libc
 help / color / mirror / code / Atom feed
* Proposed RFC 3484/6724 subset for getaddrinfo
@ 2014-06-20 15:56 Rich Felker
  2014-06-21 23:32 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Rich Felker @ 2014-06-20 15:56 UTC (permalink / raw)
  To: musl

As mentioned as a possibility before, full support for RFC 3484/6724
result sorting in getaddrinfo seems quite bloated in terms of code
size and runtime overhead. For example, some of the tests require
using netlink to obtain full details on all configured interfaces,
which leads to nastiness like:

http://blog.powerdns.com/2014/05/21/a-surprising-discovery-on-converting-ipv6-addresses-we-no-longer-prefer-getaddrinfo/

So I'd like to propose a subset of the rules in RFC 6724 which I think
suffice for getaddrinfo's use with DNS results. For reference, the
original rules are here in section 6:

http://tools.ietf.org/html/rfc6724

Here are the rules I want to include, and the work needed to evaluate
them (letter in parens, defined below):

Rule 1: Avoid unusable destinations (A)
Rule 2: Prefer matching scope (B,C)
Rule 5: Prefer matching label (B,D)
Rule 6: Prefer higher precedence (E)
Rule 8: Prefer smaller scope (C)
Rule 9: Use longest matching prefix (B,F)
Rule 10: Otherwise, leave the order unchanged (G)

A: Usability: success/failure of UDP connect()
B: Source address: using getsockname on the socket from (A).
C: Scope: Simple computation, no syscalls.
D: Label: Simple computation, no syscalls.
E: Precedence: Simple computation, no syscalls.
F: Matching prefix length: Simple computation, no syscalls.
G: Original order index: Automatically available.

With this proposal, the needed syscalls would be (per result):

socket, connect, getsockname, close

None of these generate any network traffic; they only trigger local
routing logic by the kernel.

The rules being omitted are:

Rule 3: Avoid deprecated addresses
Rule 4: Prefer home addresses
Rule 7: Prefer native transport

As far as I can tell, rule 3 seems irrelevant to DNS results anyway. I
don't see how/why one would end up with a DNS result that's reachable
via a deprecated source address but not by the non-deprecated source
address that replaces it. The situation for rule 4 may be similar, but
I'm less clear on that. As for rule 7, I fail to see why it can't be
handled by rule 5 with a label that forces the source address for
tunneling/etc. to have a label thast mismatches all other addresses'
labels.

One more thing: for my proposal, the whole sorting operation would
only be applied when there are at least 2 results and at least one of
them is IPv6. Sorting does not seem useful for v4-only results.

Does this analysis/proposal seem reasonable?

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Proposed RFC 3484/6724 subset for getaddrinfo
  2014-06-20 15:56 Proposed RFC 3484/6724 subset for getaddrinfo Rich Felker
@ 2014-06-21 23:32 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2014-06-21 23:32 UTC (permalink / raw)
  To: musl

On Fri, Jun 20, 2014 at 11:56:51AM -0400, Rich Felker wrote:
> So I'd like to propose a subset of the rules in RFC 6724 which I think
> suffice for getaddrinfo's use with DNS results. For reference, the
> original rules are here in section 6:
> [...]

Implemented and committed.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-21 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-20 15:56 Proposed RFC 3484/6724 subset for getaddrinfo Rich Felker
2014-06-21 23:32 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).