I've gotten it down to this: int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
getaddrinfo hates "::1" as a node parameter. I've attached a tester for getaddrinfo (based on Ulrich Drepper's http://people.redhat.com/drepper/userapi-ipv6.html ) $> netstat -a -t -p tcp 0 0 *:www *:* LISTEN - tcp6 0 0 *:ssh *:* LISTEN - $>./test ::1 ssh ./test: getaddrinfo: Address family for hostname not supported $> telnet ::1 ssh Trying ::1... Connected to ::1. Escape character is '^]'. SSH-2.0-OpenSSH_4.3p2 Debian-8ubuntu1 $>./test ::1 www ./test: getaddrinfo: Address family for hostname not supported $>telnet ::1 www Trying ::1... telnet: Unable to connect to remote host: Connection refused both $>./test 127.0.0.1 www and $>./test 127.0.0.1 ssh succeed (aka I can talk to the www or ssh daemons running on my system). If anyone's got a clue, please say so ... I'm kind of in the mists now :) If not, when I get the time, I'll look into telnet's implementation to see what they do to accept "::1" -- Lucian Adrian Grijincu On 6/6/07, Lucian Adrian Grijincu <[EMAIL PROTECTED]> wrote:
the cause: segmentation fault at: rv = apr_socket_bind(sock, to); from static void sendto_receivefrom(abts_case *tc, void *data) from testsockets.c the second parameter given is NULL: apr_socket_bind (sock=0x80d3c78, sa=0x0) at network_io/unix/sockets.c:154 the NULL value comes from rv = apr_sockaddr_info_get(&to, addr, APR_UNSPEC, 7772, 0, p); Which was supposed to initialize it, but failed to. digging deeper we get into network_io/unix/soccaddr.c, where there's a this call error = getaddrinfo(hostname, servname, &hints, &ai_list); This returns -9 which gai_strerror says it means "Address family for hostname not supported". getaddrinfo's input params are: hostname ="::1" servname = 0x0 hints = {ai_flags = AI_ADDRCONFIG, ai_family = 0, ai_socktype = 1, ai_protocol = 0, ai_addrlen = 0, ai_addr = 0x0, ai_canonname = 0x0, ai_next = 0x0} Will dig deeper, but if somebody has some knowledge why this would fail, jump in :) -- Lucian Adrian Grijincu On 6/6/07, Lucian Adrian Grijincu <[EMAIL PROTECTED]> wrote: > I took http://apr.apache.org/dev/dist/apr-1.2.9.tar.gz > Hope I'm on target now:) > > I've done two tests. One in which I ran buildconf myself and one without. > For each test I then ran: > ./configure > make > make test > > Both failed with: > testsockets : \/bin/bash: line 1: 10039 Segmentation fault > (core dumped) ./$prog > > the line possition it reports differs from run to run. > > Same system: Ubuntu 7.04, 32bit. > > Also: > Still haven't checked if this is to be expected running ./test/testall gives: > testatomic : SUCCESS > testdir : SUCCESS > testdso : FAILED 8 of 9 > testdup : SUCCESS > testenv : SUCCESS > testfile : SUCCESS > testfilecopy : FAILED 2 of 4 > testfileinfo : SUCCESS > testflock : FAILED 2 of 3 > testfmt : SUCCESS > testfnmatch : FAILED 2 of 2 > testargs : SUCCESS > testhash : SUCCESS > testipsub : SUCCESS > testlock : SUCCESS > testlfs : SUCCESS > testmmap : |Segmentation fault (core dumped) > > Even though they pass when run from make check. > > On 6/6/07, William A. Rowe, Jr. <[EMAIL PROTECTED]> wrote: > > note trunk isn't 1.2.9 - it's actually 1.3.0 with some additional > > socket features, so this is quite possibly not a problem with the > > new tarball. would you mind also trying branches/1.2.x or the > > tarball i created? > > > > Lucian Adrian Grijincu wrote: > > > Disclaimer: I haven't checked to see if this is the right behaviour, I > > > have an exam tomorow :( > > > > > > Ubuntu 7.04 32 bit > > > testsockets : \Segmentation fault (core dumped) > > > > > > I've tested it twice, with a clean checkout of trunk both times; same > > > behaviour. > > > All tests before this one worked fine. > > > > > > -- > > > Lucian Adrian Grijincu > > > > > > On 6/5/07, William A. Rowe, Jr. <[EMAIL PROTECTED]> wrote: > > >> http://apr.apache.org/dev/dist/ > > >> > > >> +/-1? Package to release > > >> [ ] apr-0.9.14 > > >> [ ] apr-1.2.9 > > >> [ ] apr-iconv-1.2.0 > > >> > > >> Three packages so far to consider, votes welcome > > >> > > >> > > > > > > > > >
#define _GNU_SOURCE #include <errno.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <error.h> #include <unistd.h> #include <netinet/in.h> #include <sys/socket.h> #include <stdlib.h> #include <stdio.h> int main (int argc, char *argv[]) { int result = 0; struct addrinfo *ai; struct addrinfo hints; memset (&hints, '\0', sizeof (hints)); hints.ai_flags = AI_ADDRCONFIG; hints.ai_socktype = SOCK_STREAM; int e = getaddrinfo (argv[1], argv[2], &hints, &ai); if (e != 0) error (EXIT_FAILURE, 0, "getaddrinfo: %s", gai_strerror (e)); struct addrinfo *runp = ai; while (runp != NULL) { int sock = socket (runp->ai_family, runp->ai_socktype, runp->ai_protocol); if (sock != -1) { if (connect (sock, runp->ai_addr, runp->ai_addrlen) == 0) { char *line = NULL; size_t len = 0; ssize_t n = getline (&line, &len, stdin); write (sock, line, n); n = read (sock, line, len); write (STDOUT_FILENO, line, n); close (sock); goto out; } close (sock); } runp = runp->ai_next; } error (0, 0, "cannot contact %s", argv[1]); result = 1; out: freeaddrinfo (ai); return result; }