Apr 15, 1995, 6:46 PM
Post #13 of 13
(2535 views)
Permalink
>I jsut tested it, and indeed the code does allow you to use an IP address
>instead of a name. Indeed if your name maps to more than one IP
>address, you must use an interface specific name or a number. What
>platform did you have problems on? (I tested this on BSDI)
Ok, so I can't test it, and E55 doesn't seem to be available for Apache 0.5.1
(so I can't compile it), so all I can do is look at your code.
For the BindAddress:
if (!strcmp(w, "*")) {
bind_address.s_addr = htonl(INADDR_ANY);
} else {
hep = gethostbyname(w);
if (hep && hep->h_addrtype == AF_INET &&
hep->h_addr_list[0] && !hep->h_addr_list[1])
{
memcpy(&bind_address, hep->h_addr_list[0],
sizeof(struct in_addr));
} else {
fprintf(errors,"Syntax error on line %d of %s:\n",n,server_confname);
fprintf(errors,"BindAddress must be \"*\", or a numeric IP address,\n");
fprintf(errors,"or a name that maps to exactly one address.\n");
exit(1);
}
}
}
#endif /* APB_BIND_ADDRESS */
You pass a string to gethostbyname [sic], so I presume it must be a hostname.
Your example that I saw before used a hostname. Yet you claim that
a numeric IP address should work? I don't think there is any reason to expect
this, although I could imagine BSDI is being 'nice' and simply returning the
IP address you gave it.
This certainly would not work under OSF/1. (Though it does work under Solaris,
to my surprise.)
David.