Bug 14965 - remove AI_ADDRCONFIG from default getaddrinfo() flags
Summary: remove AI_ADDRCONFIG from default getaddrinfo() flags
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: network (show other bugs)
Version: 2.15
: P2 normal
Target Milestone: ---
Assignee: Pavel Šimerda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-16 15:44 UTC by Pavel Šimerda
Modified: 2014-06-14 05:34 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
getaddrinfo: use zero ai_flags by default (958 bytes, patch)
2013-01-03 14:53 UTC, Pavel Šimerda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Šimerda 2012-12-16 15:44:56 UTC
AI_ADDRCONFIG can be beneficial to applications when it's only used for the connect(), sendto(), etc. See a detailed description of this topic:

https://fedoraproject.org/wiki/Networking/NameResolution/ADDRCONFIG

The defaults are only used when an application doesn't supply hints. But, virtually any application that wants to connect() wants to also specify at least the transport protocol (TCP, UDP). That means that applications that would benefit from AI_ADDRCONFIG won't use the defaults anyway.
Comment 1 Pavel Šimerda 2013-01-03 14:53:54 UTC
Created attachment 6793 [details]
getaddrinfo: use zero ai_flags by default

    According to POSIX1-2008, AI_V4MAPPED flag shall be ignored unless ai_family
    equals AF_INET6. In the default hints, ai_family is AF_UNSPEC. Therefore
    AI_V4MAPPED is redundant.
    
    AI_ADDRCONFIG can potentially be beneficial to applications that use
    getaddrinfo() results to immediately call connect(), sendto() and
    similar functions to avoid querying redundant DNS records according
    to the current address configuration.
    
    Those applications will also need to specify ai_socktype and/or
    ai_protocol and therefore will not use hints=NULL. As AI_DEFAULT is not
    a part of the public API, such applications will not be able to use the
    default flags at all.
    
    Please note that POSIX1-2008 doesn't define any default flags at all.
    
    Resolves: #14415, #14965