imac /perl-5.8.8/ nm /heavenly/usr/lib/libc.dylib | grep gethostbyname
3009f634 T __dns_gethostbyname
3009fea0 T __ht_gethostbyname
300a00b0 T __nis_gethostbyname
300a0770 T ___gethostbyname2_r
300a0824 T ___gethostbyname_r
         U __dns_gethostbyname
         U __ht_gethostbyname
3002feac T _gethostbyname
300a07dc T _gethostbyname2
300a0434 t _gethostbyname_internal
         U _gethostbyname
         U _gethostbyname
         U _gethostbyname
         U _gethostbyname
         U _gethostbyname
         U _gethostbyname

tinyproxy is now working with the new libresolv.a!!!

(Wed Aug 29) turns out that this is NOT news, or as they say here

I'm just a UNIX chap, and not an OSX chap, and it turns out that the iPhone really is OSX  *sigh*

DNS is broken

(update Aug 17th DNS fixed kinda)

Using the resolver from this webpage (see link above):

arm-apple-darwin-cc test.c ./libresolv.a

-bash-3.2# ./a.out www.theregister.com
Success!


The iPhone system resolver does not work for GNU code, if you
don't use the resolver above.

-bash-3.2# ./a.out www.theregister.com
gethostbyname() failed


(previous discovery prior to learning libresolv.a fixes the problem)

Sites with CNAMES don't resolve with the toolchain right now:

[imac:~] % host www.theregister.co.uk
www.theregister.co.uk has address 212.100.234.54
[imac:~] % host www.theregister.com
www.theregister.com is an alias for glb.theregister.com.
www.bbc.co.uk is an alias for www.bbc.net.uk.
[imac:~] % host www.bbc.co.uk
www.bbc.co.uk is an alias for www.bbc.net.uk.


#include <stdlib.h>
#include <stdio.h>

struct hp* result;

int main(int argc, char **argv) {
   result = gethostbyname(argv[1]);
   if (result == NULL) {
     printf("gethostbyname() failed\n");
   }
   else{ printf("Success!\n");}
}

arm-apple-darwin-cc test.c

As you can see all the cnames are failing to resolve, A records are fine.
This breaks tinyproxy and other code right now:

# ./a.out www.theregister.co.uk
Success!
# ./a.out www.theregister.com
gethostbyname() failed
# ./a.out glb.theregister.com
Success!
# ./a.out www.bbc.co.uk
gethostbyname() failed
# ./a.out www.bbc.net.uk
Success!

Oh and h_addr_list[0] from the resolver libs does not seem to 
even be present to query.  


I found out this the hardway... tinyproxy now uses this code:

22:59 < core> so this is kinda important!
22:59 < core> memcpy(addr, result->h_addr_list[0], result->h_length);
22:59 < core> fails on iphone
22:59 < core> but memcpy(addr, result->h_addr, result->h_length);
22:59 < core> works