Commit graph

21 commits

Author SHA1 Message Date
Elliott Hughes
68c2755d71 Fix three clang complaints about the DNS code.
These are all already fixed upstream in the same way.

Change-Id: I2881b6d0fbd0237fffc0f00563bc14750dcce0d9
2014-07-07 09:44:17 -07:00
Elliott Hughes
37b1b5bbcd Fix all resolv warnings and turn on -Werror.
The res_init.c changes bring us a bit closer to upstream too, though
there's still work to be done there. Some of the remaining differences
look like bugs we'd want to fix, so we should definitely try to come
back to that.

Change-Id: I50baa148e967c90d55d711e9904ad54c7d724d4d
2014-07-02 16:27:20 -07:00
Nick Kralevich
bcf77b5dff Merge "add CLOEXEC to various DNS related code" 2014-06-30 22:26:48 +00:00
Elliott Hughes
a311704103 Restore <nsswitch.h> which is BSD API, not private.
Also make nsdispatch non-hidden. Firefox uses it.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1030899
Change-Id: Iaccc1ec813d196ec91ac475fcc4ae9dca756861d
2014-06-30 14:15:34 -07:00
Elliott Hughes
a210cae724 Switch to upstream NetBSD nsap_addr.c.
These symbols should be public (and Firefox uses them), and we'd also probably
rather have the upstream thread-safe implementation.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1030899
Change-Id: I2a5888fbb3198546848398f576fd2195ff3fe00c
2014-06-30 12:03:43 -07:00
Nick Kralevich
1781ed7774 add CLOEXEC to various DNS related code
Occasionally file descriptors seem to be leaking across execs
from DNS related calls. Set close-on-execute for the various
sockets / file to prevent file descriptor leakage.

Change-Id: I4724b47bc7236f40c29518a6075598a9bba48b0a
2014-06-29 20:46:17 -07:00
Elliott Hughes
e8e453439f Bring our "libresolv" stuff in line with glibc.
Despite the name, most of resolv_private.h is actually in glibc; it's just
that there it's tucked away in libresolv whereas we have it in libc.

Change-Id: Ibcf6603f1141ffd2661cee0bffa83052d4f9e549
2014-06-13 11:50:07 -07:00
Elliott Hughes
7f2d4c21cc Somewhere, the declaration of _resolv_delete_cache_for_net went missing.
I couldn't work out where this went missing from "git log", but it became
important with the switch to hidden visibility.

Change-Id: I921f81e36642a2c65c3ec85dc9b5b87c5d977a5b
2014-06-12 18:40:06 -07:00
Elliott Hughes
8563802b04 Use default hidden visibility to build libc_dns.
Bug: 11156955
Change-Id: Ia443705f5fbee0681039d4480abc89850968f475
2014-06-12 13:35:41 -07:00
Paul Jensen
5240b562e7 Query libnetd_client for the appropriate netId for host resolution.
If libnetd_client can't be found, operate as before and use the default netId
potentially overriden by a more specific netId passed in to
android_get*fornet().

(cherry picked from commit 559c7842cc)

Change-Id: I42ef3293172651870fb46d2de22464c4f03e8e0b
2014-05-19 12:49:52 -07:00
Elliott Hughes
3e5f0c9849 Fix a gethnamaddr.c warning that's already fixed upstream.
We're still way out of sync, but this cleans up a tiny corner.

Change-Id: I51e76601785bf351d6418841b56e08a900a84d82
2014-05-06 11:23:40 -07:00
Szymon Jakubczak
ea9bf67881 bionic: Replace iface with opaque netid in resolver.
Replace iface cache key with netid.

Replace _mark with netid.

Mark sockets used to test IPv4/IPv6 support as well as sockets
used to determine source address for rfc6724 sort.

Remove pid/uid mappings (functionality moved to system/netd).

Do not create resolv_cache when it does not exist, but rather only
when DNS configuration is supplied.

Clean up unused functions.

Change-Id: I9ccfda2902cc0943e87c9bc346ad9a2578accdab
2014-04-01 16:25:49 -04:00
Calin Juravle
c20de90287 Remove ALIGNBYTES and ALIGN from <sys/param.h>
There are only three users of bionic definition of ALIGN and keeping it
in sys/param.h polutes the namespace.

I inline the definition in the the three places that's used.

Bug: 13400663
Change-Id: I565008e8426c38ffb07422f42cd8e547d53044e9
2014-03-21 09:59:34 +00:00
Elliott Hughes
205c7887ad Clean up reentrancy cruft.
The DNS copy of reentrant.h was unused, so remove it.

The strtod implementation can use the upstream-netbsd reentrant.h and
get a little closer to what was then upstream. (It's since been replaced
by gdtoa, and we'll have to follow at some point, but for now this doesn't
make anything any worse.)

ANDROID_CHANGES is (now) only used in the DNS code, so push the -D
down.

The <locale.h> change prevents an LP32 hack from leaking into LP64.

Change-Id: Idf30b98a59d7ca8f7c6cd6d07020b512057911ef
2014-03-13 16:17:43 -07:00
Elliott Hughes
f2cea021ab Clean up <stdio.h> macros.
Also neuter __isthreaded.

We should come back to try to hide struct FILE's internals for LP64.

Bug: 3453512
Bug: 3453550
Change-Id: I7e115329fb4579246a72fea367b9fc8cb6055d18
2014-03-13 14:54:53 -07:00
Calin Juravle
0ad555a908 Update res_debug.c to take into account changes
to the nameser.h

Bug: 13219633
Change-Id: Id75de2e8933f716ad86ca296a97f5c619fb946a7
2014-03-07 20:03:57 +00:00
Calin Juravle
85c5202a64 Fix broken pointer overflow check ns_name_unpack()
Many compilers may optimize away the overflow check `msg + l < msg',
where `msg' is a pointer and `l' is an integer, because pointer
overflow is undefined behavior in C.

Use a safe precondition test `l >= eom - msg' instead.
Bug: 13219633

Change-Id: I3fca2125834073cc36d7e9c4e586e97842265a59
2014-03-06 18:39:29 +00:00
Calin Juravle
fcb502e3ec Sync up nameser with upstream(2014.03.05)
Bug: 13219633

Change-Id: I8ee4ddf270710e9eea415fa3db984af7719a8dd4
2014-03-06 18:36:43 +00:00
Calin Juravle
569fb9887d Moved nameser.h and namser_compat.h to public include dir
This is part of the upstream sync (Net/Open/Free BSDs expose the
nameser.h in their public headers).

Change-Id: Ib063d4e50586748cc70201a8296cd90d2e48bbcf
2014-03-04 15:07:07 +00:00
Calin Juravle
cecc036970 Moved private dns header to their own dir.
Bug: 13219633
Change-Id: I3435ef7564b9ad3c7b54188a0809440993b36c9e
2014-03-03 20:40:41 +00:00
Calin Juravle
bd33537fde Renamed the misleading libc/netbsd directory to libc/dns.
Bug: 13219633
Change-Id: Ide43add0b90b3081cc709a22d1ff1f59d65f1104
2014-02-28 16:31:04 +00:00