Question

I am trying to enable wired ethernet on my device which runs on android 4.4.I am successful in getting the eth0 interface up. But DNS resolution is not happening.Pinging the address from adb works fine.(if I connect to my router once through WiFi then onwards dns is getting resolved and can browse with ethernet).One more observation is that this problem does not exist if I use Firefox instead of default browser.

From the logs it is clear that gethostbyname() call is failing.When i tracked further it is clear that proxy socket opened in android_open_proxy() function does not contain proper values.

    /*   reading proxy-- proxy -->/dev/socket/dnsproxyd ..*/

if (fread(buf, 1, sizeof(buf), proxy) != sizeof(buf)) return NULL;

    /* This is reading serialized data from system/netd/DnsProxyListener.cpp
     * and changes here need to be matched there */
    int result_code = strtol(buf, NULL, 10);

***here result_code is 401 (in succes case it is 222).

Was it helpful?

Solution

It's noteworthy that Motorola has modified parts of the DNS resolution code (in the Bionic libc library) in its phones, so mentioning which device you have might help narrowing the issue.

p.s. the 'ndc resolver' command may be necessary to change default dns configuration. example:

ndc resolver setifdns wlan0 "" 192.168.0.1
ndc resolver setdefaultif if wlan0

OTHER TIPS

This is strange, I may need a more throughout description to help me with this problem with you. The following may help, just try and rule out some things:

You might want to check if the dns server is on a different network/subnet to the ethernet, This can be done by physically checking or seeing if settings match up on both.

Try setting the settings manually/statically.

I'm guessing firefox could be using a cache to resolve domains, different browsers shouldn't have different dns servers. The last thing I could think of is firefox using a proxy server which resolves the addresses automatically.

Try out a few things and see if you can troubleshoot it.

I had exactly this problem on a kitkat build for a media stick device using a USB ethernet adapter. dhcpcd eth0 would let me browse by IP address but I needed the following to enable dns lookup:

ndc resolver setifdns eth0 "" 8.8.8.8 8.8.4.4

ndc resolver setdefaultif eth0

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top