[Bug 190824] New: [patch] [libc] getaddrinfo: addrconfig doesn't ignore loopback addresses
bz-noreply at freebsd.org
bz-noreply at freebsd.org
Mon Jun 9 09:17:38 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190824
Bug ID: 190824
Summary: [patch] [libc] getaddrinfo: addrconfig doesn't ignore
loopback addresses
Product: Base System
Version: 11.0-CURRENT
Hardware: Any
OS: Any
Status: Needs Triage
Severity: Affects Many People
Priority: ---
Component: kern
Assignee: freebsd-bugs at FreeBSD.org
Reporter: justin.mcomie at gmail.com
The AI_ADDRCONFIG option of getaddrinfo is intended to reduce latency by
excluding queries
for address families not configured on the system. However loopback addresses
are currently
treated as "configured" addresses, effectively breaking this functionality.
This patch
addresses this by retooling addrconfig() to exclude addresses on loopback
interfaces when
looking for configured addresses. The code is based on getifaddrs.c.
- This patch does not address link-local addresses with respect to
AI_ADDRCONFIG.
- This patch does not affect the ability to resolve numeric hosts such as
'127.0.0.1', '::1',
and 'ffff::%eth0', since getaddrinfo bypasses the call to addrconfig when
such an address
is requested.
Testing:
- Host info:
$ ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:0c:29:0d:a3:78
inet 172.16.69.133 netmask 0xffffff00 broadcast 172.16.69.255
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
- Using a test program like
http://www.logix.cz/michal/devel/various/getaddrinfo.c.xp
and filtering to just show the address families:
- With AI_ADDRCONFIG NOT set:
$ ./gai google.com | egrep -o IPv. | uniq
IPv4
IPv6
$ ./gai 127.0.0.1 | egrep -o IPv. | uniq
IPv4
$ ./gai fe80::1%lo0 | egrep -o IPv. | uniq
IPv6
- With AI_ADDRCONFIG set:
$ ./gai google.com | egrep -o IPv. | uniq
IPv4
$ ./gai 127.0.0.1 | egrep -o IPv. | uniq
IPv4
$ ./gai fe80::1%lo0 | egrep -o IPv. | uniq
IPv6
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list