gethostbyaddr failure

Ian Campbell ian at slu.ms
Wed Apr 9 03:19:20 UTC 2008


Hi all,

    I'm having a problem with reverse DNS on FreeBSD 7.0 (AMD64).
Postfix was having problems doing DNS lookups, and I eventually
narrowed it down to a failure with gethostbyaddr using the
name-addr-test files in the Postfix tarball.

    You can find the test my machine failed here:
http://www.opensource.apple.com/darwinsource/Current/postfix-174/postfix/auxiliary/name-addr-test/gethostbyaddr.c

    ... but it's basically just a call to gethostbyaddr().

    My resolv.conf is just 'nameserver 127.0.0.1' (there is a local
powerdns recursor running), but I've tried it with two other
nameservers as well. No luck, although there is nothing wrong with any
of the servers, according to dig and host.

    My nsswitch.conf has files and dns for the hosts entry.

    Strangely, when I look at the truss output for the test,
/etc/hosts is never opened, and neither is a socket... so it's not
like there's a network/dns issue, it's not even making the request. It
just abruptly fails. When I added a call to herror() in the test, I
got an error message about a resolver internal error.

blackhole# truss -f ./gethostbyaddr 72.14.205.147
 2049: __sysctl(0x7fffffffe870,0x2,0x7fffffffe88c,0x7fffffffe880,0x0,0x0) = 0 (0x0)
 2049: mmap(0x0,560,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 34365132800 (0x800525000)
 2049: munmap(0x800525000,560)                   = 0 (0x0)
 2049: __sysctl(0x7fffffffe8e0,0x2,0x80062dde8,0x7fffffffe8d8,0x0,0x0) = 0 (0x0)
 2049: mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34365132800 (0x800525000)
 2049: issetugid(0x800526015,0x800521669,0x800631730,0x800631700,0x49ac,0x7fffffffe8d8) = 0 (0x0)
 2049: open("/etc/libmap.conf",O_RDONLY,0666)    ERR#2 'No such file or directory'
 2049: open("/var/run/ld-elf.so.hints",O_RDONLY,057) = 3 (0x3)
 2049: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\M-l\0\0"...,128) = 128 (0x80)
 2049: lseek(3,0x80,SEEK_SET)                    = 128 (0x80)
 2049: read(3,"/lib:/usr/lib:/usr/lib/compat:/u"...,236) = 236 (0xec)
 2049: close(3)                                  = 0 (0x0)
 2049: access("/lib/libc.so.7",0)                = 0 (0x0)
 2049: open("/lib/libc.so.7",O_RDONLY,030556300) = 3 (0x3)
 2049: fstat(3,{mode=-r--r--r-- ,inode=49456,size=1150104,blksize=4096}) = 0 (0x0)
 2049: read(3,"\^?ELF\^B\^A\^A\t\0\0\0\0\0\0\0"...,4096) = 4096 (0x1000)
 2049: mmap(0x0,2215936,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_NOCORE,3,0x0) = 34366234624 (0x800632000)
 2049: mprotect(0x80071b000,4096,PROT_READ|PROT_WRITE|PROT_EXEC) = 0 (0x0)
 2049: mprotect(0x80071b000,4096,PROT_READ|PROT_EXEC) = 0 (0x0)
 2049: mmap(0x80081b000,118784,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,3,0xe9000) = 34368237568 (0x80081b000)
 2049: mmap(0x800838000,94208,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 34368356352 (0x800838000)
 2049: close(3)                                  = 0 (0x0)
 2049: sysarch(0x81,0x7fffffffe960,0x80052b088,0x0,0xffffffffffd08fb0,0x7fffffffe6b8) = 0 (0x0)
 2049: mmap(0x0,240,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 34365165568 (0x80052d000)
 2049: munmap(0x80052d000,240)                   = 0 (0x0)
 2049: mmap(0x0,41760,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 34365165568 (0x80052d000)
 2049: munmap(0x80052d000,41760)                 = 0 (0x0)
 2049: __sysctl(0x7fffffffe910,0x2,0x800838e80,0x7fffffffe908,0x0,0x0) = 0 (0x0)
 2049: sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
 2049: sigprocmask(SIG_SETMASK,0x0,0x0)          = 0 (0x0)
 2049: gettimeofday({1207708748.093731},0x0)     = 0 (0x0)
 2049: getpid(0x7fffffffe4d0,0x0,0x80084e540,0x80070239c,0xffffffff80a4e2a0,0x7fffffffe4c8) = 2049 (0x801)
 2049: __sysctl(0x7fffffffe460,0x2,0x80083cee8,0x7fffffffe478,0x0,0x0) = 0 (0x0)
 2049: __sysctl(0x7fffffffdfc0,0x2,0x80084bad8,0x7fffffffdfb8,0x0,0x0) = 0 (0x0)
 2049: __sysctl(0x7fffffffe000,0x2,0x7fffffffe01c,0x7fffffffe010,0x0,0x0) = 0 (0x0)
 2049: readlink("/etc/malloc.conf",0x7fffffffe050,1024) ERR#2 'No such file or directory'
 2049: issetugid(0x800713954,0x7fffffffe050,0x0,0x2,0xffffffff80a4e2a0,0x7fffffffe038) = 0 (0x0)
 2049: __sysctl(0x7fffffffdf40,0x2,0x7fffffffdf5c,0x7fffffffdf50,0x0,0x0) = 0 (0x0)
 2049: mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34365165568 (0x80052d000)
 2049: mmap(0x0,2097152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368450560 (0x80084f000)
 2049: munmap(0x80084f000,724992)                = 0 (0x0)
 2049: munmap(0x800a00000,323584)                = 0 (0x0)
 2049: issetugid(0x2,0x2,0x800901480,0x1,0x617072612e367069,0xf7) = 0 (0x0)
 2049: open("/etc/resolv.conf",O_RDONLY,0666)    = 3 (0x3)
 2049: fstat(3,{mode=-rw-r--r-- ,inode=49352,size=74,blksize=4096}) = 0 (0x0)
 2049: read(3,"nameserver 127.0.0.1\n#nameserve"...,4096) = 74 (0x4a)
 2049: read(3,0x800909000,4096)                  = 0 (0x0)
 2049: close(3)                                  = 0 (0x0)
 2049: __sysctl(0x7fffffffe4e0,0x2,0x7fffffffe590,0x7fffffffe4d8,0x0,0x0) = 0 (0x0)
 2049: issetugid(0x80084e5c0,0x7fffffffe5a8,0x80084e5c6,0x80084e540,0x101010101010101,0x8080808080808080) = 0 (0x0)
host 72.14.205.147 not found
 2049: write(2,"host 72.14.205.147 not found\n",29) = 29 (0x1d)
 2049: process exit, rval = 1

    I've read, googled, and asked on IRC with no luck. If someone here
can tell me what's going on I'd be much obliged.

    Thank you.


More information about the freebsd-questions mailing list