ID:               30057
 Updated by:       [EMAIL PROTECTED]
 Reported By:      neon at neon-line dot net
-Status:           Open
+Status:           Feedback
 Bug Type:         Sockets related
 Operating System: FreeBSD 4.10
 PHP Version:      5.0.1
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Please test the next unstable (5.1/HEAD) snapshot to see if things work
out ok there; we can then backport the fix.


Previous Comments:
------------------------------------------------------------------------

[2004-09-12 11:33:07] neon at neon-line dot net

Sorry, my typo. sys/socket.h is indeed the correct one.
On FreeBSD it works, but will it break on some other OS(s)?

------------------------------------------------------------------------

[2004-09-12 11:27:24] [EMAIL PROTECTED]

<sys/sockets.h> or <sys/socket.h> ? (I'd expect the latter to be
correct)

It sounds like we need to add that header to our configure check to
make it work (and also make IPV6 depend on its presence)

------------------------------------------------------------------------

[2004-09-12 09:10:59] neon at neon-line dot net

wez:
I had to add stdlib.h and sys/sockets.h headers to compile it because
NULL is defined in stdlib.h (weird) and constant AF_INET in
sys/socket.h.
After those modifications output was "OK!" (as expected).

------------------------------------------------------------------------

[2004-09-12 02:12:23] [EMAIL PROTECTED]

I recall the bug that prompted the extended check for ai_family and
sa_family (though not the bug# off hand).  It was also in BSD (I want
to say it was also FreeBSD4).

Enabling getaddrinfo when this behavior was present caused intermittent
segfaults in the reporters build, I'll track down that original bug
report, it had some detailed comments.

------------------------------------------------------------------------

[2004-09-12 01:29:59] [EMAIL PROTECTED]

Please try manually compiling this (slightly altered code from
configure.in), running it, and pasting the output here in this bug
report; thanks!

1/ Copy the code into v6test.c
2/ cc -o v6test v6test.c
3/ ./v6test

#include <netdb.h>
#include <sys/types.h>
int main(void) {
  struct addrinfo *ai, *pai, hints;
    
  memset(&hints, 0, sizeof(hints));
  hints.ai_flags = AI_NUMERICHOST;

  if (getaddrinfo("127.0.0.1", NULL, &hints, &ai) < 0) {
    printf("FAIL-1\n");
    exit(1);
  }

  if (ai == NULL) {
    printf("FAIL-2\n");
    exit(1);
  }

  pai = ai;
    
  while (pai) {
    if (pai->ai_family != AF_INET) {
      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
      printf("FAIL-3\n");
      exit(1);
    }
    if (pai->ai_addr->sa_family != AF_INET) {
      /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
      printf("FAIL-4\n");
      exit(1);
    }
    pai = pai->ai_next;
  }
  freeaddrinfo(ai);
  printf("OK!\n");
  exit(0);
}


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/30057

-- 
Edit this bug report at http://bugs.php.net/?id=30057&edit=1

Reply via email to