>Number: 5490 >Category: os-osf >Synopsis: Virtual host broken due to INADDR_NONE >Confidential: no >Severity: serious >Priority: medium >Responsible: apache >State: open >Class: duplicate >Submitter-Id: apache >Arrival-Date: Fri Dec 17 14:10:00 PST 1999 >Last-Modified: >Originator: [EMAIL PROTECTED] >Organization: apache >Release: 1.3.9 >Environment: Digital UNIX 4.0D - Newest patch level uname -a: OSF1 alpha.vaxxine.com V4.0 878 alpha gcc --version: 2.95.2 cc -V: DEC C V5.6-084 on Digital UNIX V4.0 (Rev. 878)
>From /usr/include/netinet/in.h: @(#)$RCSfile: in.h,v $ $Revision: 4.3.26.3 $ (DEC) $Date: 1997/10/08 19:01:25 $ >Description: Hello. This error is a repeat of the PR#463 but occurred in Apache 1.3.9 using either gcc or cc. The problem, like PR#463, seems to be related to typing. In /usr/include/in/netstd.h I have: #ifndef _KERNEL #define INADDR_NONE 0xffffffff /* -1 return */ #endif If I create a test program and compile via either cc or gcc the failure of inet_addr() does not match INADDR_NONE. #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> int main( void ) { char *w = "entersomedomainhere"; struct hostent *hep; unsigned long my_addr; char *p; hep = gethostbyname(w); if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) { fprintf(stderr, "Cannot resolve host name %s --- exiting!\n", w); exit(1); } my_addr = inet_addr( w ); printf( "Name = %s\n", hep->h_name ); printf( "inet_addr (unsigned) = %u\n", my_addr ); printf( "inet_addr (decimal) = %d\n", my_addr ); printf( "No address (unsigned) = %u\n", INADDR_NONE ); printf( "No address (decimal) = %d\n", ((unsigned long) -1) ); printf( "UL: %d != %d ? %d\n", my_addr, INADDR_NONE, (my_addr != INADDR_NONE) ); } I get: Name = entersomedomainhere inet_addr (unsigned) = 4294967295 inet_addr (decimal) = -1 No address (unsigned) = 4294967295 No address (decimal) = -1 UL: -1 != -1 ? 1 >How-To-Repeat: If necessary I can provide a short term shell account. >Fix: I was able to resolve the problem by #undef'ing INADDR_NONE and letting the existing #define with http_vhost.c take effect. Admittedly one should not have to do so but it patched the problem. Maybe a test of the sizeof the return value of inet_addr() and the sizeof INADDR_NONE if compiled on an alpha when httpd starts? It would at least let alpha users know there's a problem. >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, you need] [to include <[EMAIL PROTECTED]> in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]