[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: getting busybox DNS (ping, nslookup) to work on android
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2011-04-16 16:44:52
Message-ID: 201104161844.52047.vda.linux () googlemail ! com
[Download RAW message or body]

On Thursday 14 April 2011 20:51, Tito wrote:
> 
> On Thursday 14 April 2011 17:31:43 rouble wrote:
> > I do have a /etc/resolv.conf. It points to the localhost that routes the DNS
> > queries appropriately. I have also tried using another valid name server -
> > which yields the same result.
> > 
> > Here are the logs:
> > 
> > # cat /etc/resolv.conf
> > nameserver 127.0.0.1:53
> > 
> > 
> > # strace -tt -s99 -oLOG nslookup www.google.com
> > Server:    0.0.0.0
> > Address 1: 0.0.0.0
> > 
> > nslookup: can't resolve 'www.google.com'
> > 
> > 
> > # cat LOG
> > 15:10:32.686311 execve("/system/xbin/nslookup", ["nslookup", "www.google.com"],
> > [/* 14 vars */]) = 0
> > 15:10:32.694534 uname({sys="Linux", node="localhost", ...}) = 0
> > 15:10:32.695684 brk(0)                  = 0x8718000
> > 15:10:32.695915 brk(0x8718cd0)          = 0x8718cd0
> > 15:10:32.696221 set_thread_area({entry_number:-1 -> 6, base_addr:0x8718850,
> > limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1,
> > seg_not_present:0, useable:1}) = 0
> > 15:10:32.696676 brk(0x8739cd0)          = 0x8739cd0
> > 15:10:32.696903 brk(0x873a000)          = 0x873a000
> > 15:10:32.697341 getuid32()              = 0
> > 15:10:32.697582 getpid()                = 30438
> > 15:10:32.697868 open("/etc/resolv.conf", O_RDONLY) = 3
> > 15:10:32.698275 fstat64(3, {st_mode=S_IFREG|0666, st_size=24, ...}) = 0
> > 15:10:32.698773 mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
> > MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77ea000
> > 15:10:32.699038 read(3, "nameserver 127.0.0.1:53\n", 1024) = 24
> > 15:10:32.699421 read(3, "", 1024)       = 0
> > 15:10:32.699654 close(3)                = 0
> > 15:10:32.699882 munmap(0xb77ea000, 4096) = 0
> > 15:10:32.700188 uname({sys="Linux", node="localhost", ...}) = 0
> > 15:10:32.701512 fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0),
> > ...}) = 0
> > 15:10:32.701985 mmap2(NULL, 4096, PROT_READ|PROT_WRITE,
> > MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77ea000
> > 15:10:32.702267 write(1, "Server:    0.0.0.0\n", 19) = 19
> > 15:10:32.702659 socket(PF_UNIX, SOCK_STREAM, 0) = 3
> > 15:10:32.703056 fcntl64(3, F_GETFL)     = 0x2 (flags O_RDWR)
> > 15:10:32.703316 fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
> > 15:10:32.703573 connect(3, {sa_family=AF_UNIX, path="/var/run/nscd/socket"},
> > 110) = -1 ENOENT (No such file or directory)
> > 15:10:32.704146 close(3)                = 0
> > 15:10:32.704571 socket(PF_UNIX, SOCK_STREAM, 0) = 3
> > 15:10:32.704817 fcntl64(3, F_GETFL)     = 0x2 (flags O_RDWR)
> > 15:10:32.705150 fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
> > 15:10:32.705470 connect(3, {sa_family=AF_UNIX, path="/var/run/nscd/socket"},
> > 110) = -1 ENOENT (No such file or directory)
> > 15:10:32.706137 close(3)                = 0
> > 15:10:32.706406 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such
> > file or directory)

This (access to /etc/nsswitch.conf) looks glibc-like.

Is Bionic based on glibc or uses glibc-like NSS plug-in name resolution?
If not, then your program is statically linked against glibc, not Bionic.


> > 15:10:32.706831 open("/system/lib/libnss_dns.so.2", O_RDONLY) = -1 ENOENT
> > (No such file or directory)
> > 15:10:32.707143 stat64("/system/lib", {st_mode=S_IFDIR|0755, st_size=10240,
> > ...}) = 0
> > 15:10:32.707639 open("/system/lib/egl/libnss_dns.so.2", O_RDONLY) = -1
> > ENOENT (No such file or directory)
> > 15:10:32.707955 stat64("/system/lib/egl", {st_mode=S_IFDIR|0755,
> > st_size=1024, ...}) = 0
> > 15:10:32.708496 open("/system/lib/anyconnect-lib/libnss_dns.so.2", O_RDONLY)
> > = -1 ENOENT (No such file or directory)
> > 15:10:32.708868 stat64("/system/lib/anyconnect-lib", {st_mode=S_IFDIR|0755,
> > st_size=1024, ...}) = 0
> > 15:10:32.709611 open("/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file
> > or directory)
> > 15:10:32.709940 open("/lib/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such
> > file or directory)
> > 15:10:32.710238 stat64("/lib", 0xbfc5a5a8) = -1 ENOENT (No such file or
> > directory)
> > 15:10:32.710497 open("/usr/lib/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No
> > such file or directory)
> > 15:10:32.710801 stat64("/usr/lib", 0xbfc5a5a8) = -1 ENOENT (No such file or
> > directory)
> > 15:10:32.711093 open("/system/lib/libnss_files.so.2", O_RDONLY) = -1 ENOENT
> > (No such file or directory)
> > 15:10:32.711413 open("/system/lib/egl/libnss_files.so.2", O_RDONLY) = -1
> > ENOENT (No such file or directory)
> > 15:10:32.711741 open("/system/lib/anyconnect-lib/libnss_files.so.2",
> > O_RDONLY) = -1 ENOENT (No such file or directory)
> > 15:10:32.712153 write(1, "Address 1: 0.0.0.0\n", 19) = 19
> > 15:10:32.712469 write(1, "\n", 1)       = 1
> > 15:10:32.712762 write(2, "nslookup: can\'t resolve \'www.google.com\'\n",
> > 41) = 41

So, it found neither NSS config (thus used default one) nor any NSS libraries.
The system you took this strace on is definitely has no NSS stuff.

I would hazard to guess you (possibly unknowingly) linked against glibc
but Android doesn't use glibc.

-- 
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic