getipnode.c revision d736db6dc53e615e3f2d66d1ddbe28473694d107
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Copyright (C) 1999, 2000 Internet Software Consortium.
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * Permission to use, copy, modify, and distribute this software for any
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * purpose with or without fee is hereby granted, provided that the above
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
b6d52ee5bea1b9d9074698e693b49ce96edff47bMark Andrews#include <lwres/netdb.h> /* XXX #include <netdb.h> */
44aae046c38e796e581110b7ecdf4478167d684dBob Halleyconst struct in6_addr lwres_in6addr_any = IN6ADDR_ANY_INIT;
fd35453765c6494d077edca44f4d998af5fd4cfaDavid Lawrencestatic const unsigned char in6addr_compat[12] = {
44aae046c38e796e581110b7ecdf4478167d684dBob Halley 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
634c61d2ddf514c3b1f5c8d49c2d2375df20a8b6Andreas Gustafsson#define IN6_IS_ADDR_V4COMPAT(x) (!memcmp((x)->s6_addr, in6addr_compat, 12) && \
44aae046c38e796e581110b7ecdf4478167d684dBob Halley#define IN6_IS_ADDR_V4MAPPED(x) (!memcmp((x)->s6_addr, in6addr_mapped, 12))
static int scan_interfaces(int *, int *);
const void *src);
struct hostent *
int tmp_err;
return (NULL);
return (NULL);
goto cleanup;
goto cleanup;
if (have_v4 &&
goto cleanup;
goto cleanup;
return (he3);
struct hostent *
return (NULL);
switch (af) {
case AF_INET:
return (NULL);
case AF_INET6:
return (NULL);
return (NULL);
* Lookup IPv4 and IPv4 mapped/compatible addresses
return (NULL);
return (he1);
return (NULL);
return (he2);
IN6ADDRSZ) == 0) {
return (NULL);
return (NULL);
return (he1);
char **cpp;
cpp++;
addresses++;
cpp++;
names++;
int s, cpsize, n;
goto err_ret;
goto err_ret;
#ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF
goto err_ret;
goto err_ret;
#ifdef HAVE_SA_LEN
#ifdef FIX_ZERO_SA_LEN
#ifdef HAVE_MINIMUM_IFREQ
(int)(sizeof (struct sockaddr));
case AF_INET:
if (*have_v4 == 0) {
&((struct sockaddr_in *)
case AF_INET6:
if (*have_v6 == 0) {
&((struct sockaddr_in6 *)
sizeof in6) == 0)
close(s);
close(s);
static struct hostent *
int len = 0;
addresses++;
cpp++;
names++;
cpp++;
addresses++;
cpp++;
names++;
cpp++;
return (NULL);
goto no_recovery;
goto cleanup0;
goto cleanup1;
sizeof in6addr_mapped);
INADDRSZ);
cpp++;
npp++;
goto cleanup1;
sizeof in6addr_mapped);
INADDRSZ);
cpp++;
npp++;
goto cleanup1;
goto cleanup2;
npp++;
cpp++;
goto cleanup2;
return(he);
cpp++;
cpp++;
return (NULL);
static struct hostent *
goto cleanup;
switch (af) {
case AF_INET:
case AF_INET6:
INSIST(0);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
return (he);
return (NULL);
static struct hostent *
goto cleanup;
switch (af) {
case AF_INET:
case AF_INET6:
INSIST(0);
goto cleanup;
goto cleanup;
goto cleanup;
return (he);
return (NULL);