Simon Perreault <si...@per.reau.lt> writes: > Le 2014-05-02 04:13, Jérémie Courrèges-Anglas a écrit : >> I don't like AI_ADDRCONFIG. It's useless as specified, and making it >> useful requires interpretations and deviations. > > Can you justify this? Sounds to me like a blanket statement as it is.
Didn't you need to make it ignore link-local addresses to make it useful? >> My understanding is that its goal is to solve a real world problem, >> as in avoiding useless and potentially harmful DNS requests. So why not >> make it do that, and just that? Because I don't think the end goal is >> preventing IPv6 link-local communication, or communication with ::1 or >> "localhost", etc. > > I don't understand the above paragraph at all. Facts only please, and no > hyperbole. What's the problem exactly? Let's say you have a machine with no IPv6 address configured (or rather, only link-local addresses configured and ::1 on lo0). With the AI_ADDRCONFIG flag (either set explicitely or assumed if the caller passes no hints structure): - getaddrinfo("fe80::...%em0") fails with "no address associated with name" - getaddrinfo("::1") fails similarly - more generally, getaddrinfo("numeric IPv6 address") fails with "no address associated with that name" - getaddrinfo("localhost") now requires IPv4/v6 connectivity on non-lo interfaces. oops. All those are IMHO poor behavior (lies), especially since getaddrinfo is supposed to handle pretty much anything you're throwing at it. Yet it is now the default behavior when you pass no hints, and adding explicit AI_ADDRCONFIG flags to base programs has been recently proposed. >> -bit is set, IPv4 addresses will be returned only if an IPv4 address is >> -configured on an interface, and IPv6 addresses will be returned only if an >> IPv6 >> -address is configured on an interface. >> +bit is set, DNS requests for IPv4 addresses will be performed only if an >> +IPv4 address is configured on an interface, and DNS requetsts for IPv6 >> +addresses will be performed only if an IPv6 address is configured on an >> +interface. > > Targeting only DNS is wrong. That's not at all what AI_ADDRCONFIG does. I'm proposing to change its semantics so that it targets only DNS. Saying that it doesn't target DNS doesn't help much. :) Why do we ignore link-local IPv6 addresses when iterating over the result of getifaddrs? Because without this AI_ADDRCONFIG would be almost useless; yet the spec doesn't say we should ignore link-local addresses... > It is of no use to return an IPv6 address that you found in a non-DNS > database if the host has no IPv6 address configured on its interfaces. ... I see it the other way. I think that if AI_ADDRCONFIG has been proposed to avoid *useless and potentially harmful* DNS requests. I'd feel better if it had not been adopted in the first place, because it's basically useless if interpreted literally. But also it helps to cope with the stupid behavior some CPEs exhibit, instead of forcing people (hi, Orange) to fix their errors. That is not a good thing IMHO. > But take the above with a grain of salt because I absolutely don't > understand the problem you're trying to fix. I hope its clearer this way. :) -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE