Commit Graph

115 Commits

Author SHA1 Message Date
Elliott Hughes
eb847bc866 Fix x86_64 build, clean up intermediate libraries.
The x86_64 build was failing because clone.S had a call to __thread_entry which
was being added to a different intermediate .a on the way to making libc.so,
and the linker couldn't guarantee statically that such a relocation would be
possible.

  ld: error: out/target/product/generic_x86_64/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(clone.o): requires dynamic R_X86_64_PC32 reloc against '__thread_entry' which may overflow at runtime; recompile with -fPIC

This patch addresses that by ensuring that the caller and callee end up in the
same intermediate .a. While I'm here, I've tried to clean up some of the mess
that led to this situation too. In particular, this removes libc/private/ from
the default include path (except for the DNS code), and splits out the DNS
code into its own library (since it's a weird special case of upstream NetBSD
code that's diverged so heavily it's unlikely ever to get back in sync).

There's more cleanup of the DNS situation possible, but this is definitely a
step in the right direction, and it's more than enough to get x86_64 building
cleanly.

Change-Id: I00425a7245b7a2573df16cc38798187d0729e7c4
2013-10-09 16:00:17 -07:00
Robert Greenwalt
a31ddef36d Change how DNS resolver handle no default iface
We used to just try any iface we'd been told about as a
fallback, but that will end up mistakenly using a secondary
network's dns when we really don't have a default connection.

It also messed up our detection of whether we were doing the
lookup on the default or not (we'd get back our secondary net
iface as the default, do the compare and think we were on default).

Remove the lies and let dns fail if we don't have an iface for it.

bug:10132565
Change-Id: I5f0f2abacaaaaf23c5292b20fba9d8dcb6fb10c5
2013-08-22 21:05:49 -07:00
Robert Greenwalt
1d8d9a308c Fix the detection of alt-network in dns resolver.
Used to determine proper A/AAAA record request.

bug:10132565
Change-Id: I7229f6672e879920a6fae58672cddd72db78546c
2013-08-05 18:44:30 +00:00
Robert Greenwalt
e0805a94c5 Tell the dns resolver about our domains.
A refactor caused us to not tell the resolver about search domains
until after it had done the domain fanout.

bug:6799630
Change-Id: Ibabd8fa5bcc69b1490fc5e329e62eb0f2d1a5e63
2013-07-31 16:53:46 -07:00
Colin Cross
f6e6e5e727 am 977a3313: Merge changes Iac00ce10,I192d3825
* commit '977a33137d2be0093f474055f839cf665b82b588':
  bionic: add tests for properties
  bionic: move system property writing from init to bionic
2013-06-17 18:21:37 -07:00
Colin Cross
5cf32de7a0 bionic: move system property writing from init to bionic
Move the implementation of writing to the system property area
from init to bionic, next to the reader implementation.  This
will allow full property testing to be added to bionic tests.

Add new accessor and waiting functions to hide the implementation
from watchprops and various bionic users.

Also hide some of the implementation details of the property area
from init by moving them into _system_properties.h, and other details
from everybody by moving them into system_properties.h.

(cherry picked from commit dc1038b790)

Change-Id: I192d3825ee276c5047bc751039fe6cfe226a7cca
2013-06-17 16:58:43 -07:00
Elliott Hughes
5a6a0a9445 am 18af4503: Merge "Ensure header files using __BEGIN_DECLS include sys/cdefs.h."
* commit '18af450393b005b4ead896d82cda750e6876fd33':
  Ensure header files using __BEGIN_DECLS include sys/cdefs.h.
2013-06-05 18:06:04 -07:00
Elliott Hughes
36fa67bcdd Ensure header files using __BEGIN_DECLS include sys/cdefs.h.
We keep fixing these one-by-one; let's fix them all at once.

Found thus:

  find . -name *.h | xargs grep -L sys/cdefs.h | xargs grep -l BEGIN_DECL | xargs grep -L sys/types

Change-Id: I188842aa2484dc6176e96556d57c38a0f785b59b
2013-06-05 17:58:08 -07:00
Elliott Hughes
509fc80697 am d8a9cccb: Merge "Fix all printf warnings in res_send.c."
* commit 'd8a9cccb4d77eecc36425c9240a12bd305031ee3':
  Fix all printf warnings in res_send.c.
2013-05-14 11:10:23 -07:00
Kito Cheng
bb0b09cad6 Fix all printf warnings in res_send.c.
Change-Id: I4bf959140b5a5475897bd80704e64e3c4645fc3f
2013-05-14 10:09:23 -07:00
Elliott Hughes
8dd195c509 am 7a29f404: Merge "Update getaddrinfo to RFC6724"
* commit '7a29f404e11d3346e79154b8e8d72a3215febced':
  Update getaddrinfo to RFC6724
2013-04-01 18:20:10 -07:00
Lorenzo Colitti
378b0e1ea2 Update getaddrinfo to RFC6724
Currently, our getaddrinfo implementation does not conform to
any IETF standard. It follows draft-ietf-6man-rfc3484-revise-01,
but that draft has expired. Update the policy table to RFC6724.

(cherry-pick of e919b116d35aa7deb24ddece69c491e24c3b0d6f.)

Bug: 8276725
Change-Id: I2d17122defd966ac6c2c13d04887fb110f2598a0
2013-04-01 18:04:25 -07:00
Elliott Hughes
12ea800566 am 5f829205: am c1416647: Merge "Clean up internal libc logging."
* commit '5f8292050fc07f4bf9e70f37a807ad028e3cfc87':
  Clean up internal libc logging.
2013-03-15 16:36:37 -07:00
Elliott Hughes
8f2a5a0b40 Clean up internal libc logging.
We only need one logging API, and I prefer the one that does no
allocation and is thus safe to use in any context.

Also use O_CLOEXEC when opening the /dev/log files.

Move everything logging-related into one header file.

Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58
2013-03-15 16:12:58 -07:00
Nick Kralevich
5d36baee95 Merge "gethostbyname: fix crash" 2013-02-22 19:32:37 +00:00
Nick Kralevich
bfe0640e41 Don't pass pid to dnsproxyd
dnsproxyd can already determine our pid by looking at our
socket connection. It's dangerous (and unneeded) to pass it
ourselves.

Change-Id: I2596d02e361b302259ddb084be2fb75be59889c5
2013-02-21 21:34:11 -08:00
Nick Kralevich
a6b24b7afb gethostbyname: fix crash
When an app doesn't have the internet permission, android_open_proxy
returns NULL, causing a segfault when calling fprintf. Fixed.

Change-Id: I598855350ed0db3cc88e5ae3b400145418a3a615
2013-02-21 20:12:42 -08:00
Elliott Hughes
8ca1da6e71 resolved conflicts for merge of 62727429 to master
Change-Id: I8a3d167f3ef279a7c46cb8fb90c9477beff84d8e
2013-02-13 13:51:54 -08:00
Elliott Hughes
d8213bb573 Update getnameinfo.c, remove dead code, and fix error reporting.
Also add a unit test for the salen size checking.

Bug: 1889275
Change-Id: I8ec4107df9e2e9a8571e8915525249c6e44b98ad
2013-02-13 13:11:11 -08:00
Mattias Falk
c63e59039d dns cache per interface iteration 2
name server addresses are read from the dns
cache associated wih the interface on which
the request shall be done.

processes which has requested to issue dns request
using specific interface are now proxied to netd.

added methods to attach/detach a process to a specific
dns cache/interface.

added getaddrinfoforinface method which takes an
interface as an argument.

bug:4815099
bug:5465296
Change-Id: I7a8fe1980cdf99d4d296ddc5c6411f0c72162263
2013-02-07 09:40:16 -08:00
Robert Greenwalt
b002a2ff77 Revert "dns cache per interface iteration 2"
This reverts commit f1464ff956

Change-Id: I3496b9a8cb54614fe3eea016d1391c8a89f3db38
2013-01-19 00:40:24 +00:00
Mattias Falk
f1464ff956 dns cache per interface iteration 2
name server addresses are read from the dns
cache associated wih the interface on which
the request shall be done.

processes which has requested to issue dns request
using specific interface are now proxied to netd.

added methods to attach/detach a process to a specific
dns cache/interface.

added getaddrinfoforinface method which takes an
interface as an argument.

Change-Id: I851ec8ab8ce3112626ad2a729078b91d013f32fd
bug:4815099
bug:5465296
2013-01-11 15:47:27 -08:00
Robert Greenwalt
78851f10d1 Cache negative DNS results.
Find the TTL for the negative results using the minimum of
the SOA records TTL or the MINIMUM-TTL field (RFC-2308).

bug:5926539
Change-Id: I6d39c9fb558afcb7a4a5bc014d97dab4a85c0d4f
2013-01-09 16:36:33 -08:00
Robert Greenwalt
6f3222ea42 Add search domain to dns interface data.
This doesn't currently use this info - it's still using the system
property based data-passing.  That change is comming.

bug:6799630
Change-Id: I725463209855447cd04bf1457281f3084fffd692
2012-11-13 11:50:57 -08:00
Elliott Hughes
ab44f52202 More upstream NetBSD upgrades.
Change-Id: Idb781d37de3b05585271d7d258ecffd5ba87d0b8
2012-10-23 16:05:09 -07:00
Henrik Engström
ce5ba8bfcd Added missing cache failed notification
Added a missing call to _resolv_cache_query_failed for another fail
case where it was missing (it doesn't go through the error handling
under the "fail" label). This missing notification caused requests to
have to wait for timeout instead of beeing notified on some failed
requests.

Change-Id: I904d60269c59b926784e3a397d2a860329f55142
2012-08-17 09:18:47 +02:00
Robert Greenwalt
8f88aa7d38 am c5cab345: am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"
* commit 'c5cab3452d5ced55474e56497594579108670b51':
  Avoid multiple dns lookups for the same query
2012-06-12 15:56:29 -07:00
Robert Greenwalt
c5cab3452d am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"
* commit '028ccf5d40dd9a945ea92aa79822c08c6f6aa1d2':
  Avoid multiple dns lookups for the same query
2012-06-12 15:52:56 -07:00
Robert Greenwalt
028ccf5d40 Merge "Avoid multiple dns lookups for the same query" 2012-06-12 15:06:24 -07:00
Elliott Hughes
20afd4e70c am e0961445: Merge "Remove the meaningless on Linux if_dl.h header."
* commit 'e0961445124b5ff39412da32578e14e0d1f6afd6':
  Remove the meaningless on Linux if_dl.h header.
2012-06-11 17:41:10 -07:00
Elliott Hughes
c3d45b822c Remove the meaningless on Linux if_dl.h header.
This was misleading 'configure' into thinking we actually support AF_LINK,
but we're Linux, so we don't, and we never implemented the functions we
declared here either.

Reported to AOSP by Jun-ya Kato.

(cherry-pick of 5056f1fad1187cd67729bb04ba72397d78256f03.)

Change-Id: Ic67f674d2221497c8166994812bb5fc7f0831066
2012-06-11 15:13:37 -07:00
Elliott Hughes
7c5c68f5c7 Merge "Remove the meaningless on Linux if_dl.h header." 2012-06-11 15:09:57 -07:00
Elliott Hughes
5056f1fad1 Remove the meaningless on Linux if_dl.h header.
This was misleading 'configure' into thinking we actually support AF_LINK,
but we're Linux, so we don't, and we never implemented the functions we
declared here either.

Reported to AOSP by Jun-ya Kato.

Change-Id: I111f9887f3812469b411b9cf5124d9dd624f19f7
2012-06-11 15:01:10 -07:00
Geremy Condra
524c87c61c Added event logging for some spoofed DNS queries.
Change-Id: I40909306e8cf922f1dd5a5685db89f732a709794
2012-06-11 11:44:48 -07:00
Geremy Condra
5a095ef287 am 03539a36: Merge "Ensure that the port number and TXID are properly randomized." into jb-dev
* commit '03539a36b634bdfa61c06277cf25e0ca8e3105ba':
  Ensure that the port number and TXID are properly randomized.
2012-05-30 11:09:05 -07:00
Geremy Condra
b23f193dcc Ensure that the port number and TXID are properly randomized.
This fix reads from /dev/urandom to get the required entropy.

Bug: 6535492
Change-Id: Ibc2fec3f71a67607b608ad9b767b0b6504993c1d
2012-05-24 15:26:12 -07:00
Mattias Falk
a59cfcfd08 Avoid multiple dns lookups for the same query
If two or more rapid dns requests for the same server are done
from different threads it turns into separate dns reques, if
the response of the request isn't found in the cache.

This patch avoid multiple request for the same server by
letting subsequents request wait until the first request
has finished.

Change-Id: Ic72ea0e7d3964a4164eddf866feb4357ec4dfe54
2012-05-07 18:04:25 -07:00
Elliott Hughes
53daf4757d am 73a6566d: Merge "Remove expired dns cache entries before removing oldest"
* commit '73a6566da337db50cfc73c369d774ac1905a30c2':
  Remove expired dns cache entries before removing oldest
2012-05-07 13:59:59 -07:00
Elliott Hughes
73a6566da3 Merge "Remove expired dns cache entries before removing oldest" 2012-05-07 10:41:53 -07:00
Robert Greenwalt
c59ba4595b Use new binary code format
3-digits + null.  Old was 3-digits + space + null.

Change-Id: If5fdf9ced073f432ace3a76858025ad651c74e3d
2012-03-09 11:50:46 -08:00
Selim Gurun
06e1831f19 Prevent potential stall on dns proxy operations.
Update wire protocol to return and process error code first.
This will make sure dns proxy operations do not stall when
an internal error happens.
Also fix a compiler warning.
Also fix a potential buffer overflow.
And use correct types (uint32_t) rather than int when reading from network.

Change-Id: I9f99c16d6fd5e9137491a4d1b293a7c78e31b9c3
2012-03-07 15:09:05 -08:00
Kenny Root
1fb6662d1a Revert "Use the new NativeDaemonConnector style."
The other changes relating to this were already reverted.

This reverts commit 1625c7a837
2012-02-24 11:04:42 -08:00
Robert Greenwalt
1625c7a837 Use the new NativeDaemonConnector style.
Prepend a 0 to match the new sequence-number style, though this module
doesn't really need/use it.

bug:5864209
Change-Id: Iacbcddaced6fe8bb01d186596a916e4fb4805fef
2012-02-07 11:53:55 -08:00
Robert Greenwalt
52764f5546 Increase the size of the system-wide dns cache
32 enteries perhaps was ok for per-process caching with ipv4 only
but adding ipv6 records makes it effectively 16 entries and making
it system wide makes is pretty useless.  Increasing to 640 entries.

bug:5841178
Change-Id: I879f8bf4d3c4d8c1708bb46d46a67c1f64b1861f
2012-01-25 15:36:58 -08:00
David 'Digit' Turner
79fcc6948d Merge "libc: remove private declarations from <time.h> and <resolv.h>" 2012-01-19 04:15:38 -08:00
Jean-Baptiste Queru
5f926c2679 am b00d7a33: am eae1f1fb: Merge "res_send: Avoid spurious close()s and (rare) failure"
* commit 'b00d7a331c9f2a578a4cfc4dfe0d626aa58fa702':
  res_send: Avoid spurious close()s and (rare) failure
2012-01-17 18:18:29 -08:00
Jean-Baptiste Queru
b00d7a331c am eae1f1fb: Merge "res_send: Avoid spurious close()s and (rare) failure"
* commit 'eae1f1fba33cb105302227b044a14e5abcbe55e7':
  res_send: Avoid spurious close()s and (rare) failure
2012-01-17 18:16:10 -08:00
Jim Huang
87043f9c89 res_send: Avoid spurious close()s and (rare) failure
When looping over the current list of sockets we are connected to,
use getpeername() not getsockname() to find out who the remote
end is.  This change avoids spurious close() and (rare) failure.

Origin: ISC bug #18625 and fixed in libbind 6.0

Change-Id: I5e85f9ff4b98c237978e4bf4bd85ba0a90d768e6
2012-01-14 11:30:00 +08:00
David 'Digit' Turner
208898ee77 libc: remove private declarations from <time.h> and <resolv.h>
This patch is used to remove private C library declarations from the
public headers (that are exported to the NDK). It should *only* be
submitted after all other patches modifying the users of said
private functions have been submitted to the tree, to avoid
breakages.

Change-Id: I0a5e3014f8e3ac9ed8df86a5cdae506337c23252
2012-01-13 14:24:08 +01:00
Robert Greenwalt
e4ade69654 am 82c4be54: am ecd0e95a: Adding a timeout to tcp dns lookup connects.
* commit '82c4be54da0825ebe74b524932c9db733419057a':
  Adding a timeout to tcp dns lookup connects.
2012-01-12 15:05:57 -08:00