diff -aruN inet6-apps-0.34.vanilla/GNUmakefile.config inet6-apps-0.34/GNUmakefile.config --- inet6-apps-0.34.vanilla/GNUmakefile.config Wed Jun 24 21:51:42 1998 +++ inet6-apps-0.34/GNUmakefile.config Sun Jan 31 19:02:23 1999 @@ -120,6 +120,10 @@ INNER=1 # Enable debugging? -DEBUG=1 -#DEBUG=0 +#DEBUG=1 +DEBUG=0 +# Local hack for supporting IPv4-v6 translator. +# ex: setenv GAI 3ffe:501:10ff:200:: +FAITH=1 +#FAITH=0 diff -aruN inet6-apps-0.34.vanilla/GNUmakefile.inc inet6-apps-0.34/GNUmakefile.inc --- inet6-apps-0.34.vanilla/GNUmakefile.inc Wed Jun 24 21:53:10 1998 +++ inet6-apps-0.34/GNUmakefile.inc Sun Jan 31 19:02:23 1999 @@ -9,6 +9,8 @@ # the default values used would overwrite most of the corresponding # IPv4 only utilities. # +CC=gcc +CFLAGS=-O2 INSTALLED=0 @@ -58,6 +60,7 @@ CFLAGS+=-I$(DOTS)include/generic ifeq ($(OS), Linux) CFLAGS+=-I$(DOTS)include/linux +CFLAGS+=-D__BSD_SOURCE SALEN=0 endif # OS = Linux ifeq ($(OS), BSD) @@ -83,6 +86,9 @@ ifneq ($(INNER), 0) DINNER=-DINNER=$(INNER) endif # INNER +ifneq ($(FAITH), 0) +CFLAGS+=-DFAITH +endif # FAITH ifeq ($(SALEN), 1) CFLAGS+=-DSALEN=$(SALEN) endif # SALEN diff -aruN inet6-apps-0.34.vanilla/include/generic/netinet/in.h inet6-apps-0.34/include/generic/netinet/in.h --- inet6-apps-0.34.vanilla/include/generic/netinet/in.h Wed Jun 24 21:48:05 1998 +++ inet6-apps-0.34/include/generic/netinet/in.h Sun Jan 31 19:02:23 1999 @@ -10,7 +10,11 @@ #ifndef _INET6APPS_NETINET_IN_H #define _INET6APPS_NETINET_IN_H 1 +#if 0 #include_next +#else +#include "/usr/include/netinet/in.h" +#endif #include #endif /* _INET6APPS_NETINET_IN_H */ diff -aruN inet6-apps-0.34.vanilla/include/generic/netinet/in6.h inet6-apps-0.34/include/generic/netinet/in6.h --- inet6-apps-0.34.vanilla/include/generic/netinet/in6.h Wed Jun 24 21:47:02 1998 +++ inet6-apps-0.34/include/generic/netinet/in6.h Sun Jan 31 19:02:23 1999 @@ -67,6 +67,7 @@ } in6a_u; #define in6a_words in6a_u.words #define s6_addr in6a_u.bytes +#define s6_addr32 in6a_u.words }; #endif /* !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802) */ diff -aruN inet6-apps-0.34.vanilla/inetd/inetd.c inet6-apps-0.34/inetd/inetd.c --- inet6-apps-0.34.vanilla/inetd/inetd.c Mon Feb 23 22:05:41 1998 +++ inet6-apps-0.34/inetd/inetd.c Sun Jan 31 19:06:44 1999 @@ -193,9 +193,6 @@ #include #include #include -#ifdef linux -#include -#endif /* linux */ #include #include #include diff -aruN inet6-apps-0.34.vanilla/lib/GNUmakefile inet6-apps-0.34/lib/GNUmakefile --- inet6-apps-0.34.vanilla/lib/GNUmakefile Mon Feb 23 23:03:54 1998 +++ inet6-apps-0.34/lib/GNUmakefile Sun Jan 31 19:02:23 1999 @@ -7,6 +7,11 @@ DOTS=../ include $(DOTS)GNUmakefile.inc +# for making shared library +LD_DYNAMIC=gcc -shared +#LD_DYNAMIC=ld -Bdynamic +CFLAGS+=-fPIC + CFLAGS+=-I. $(DINET6) $(DNETSEC) $(DFASTCTO) OBJS=addrcmp.o misc.o connect.o @@ -50,7 +55,7 @@ endif # LOCAL endif # LIBCAPI -TARGETS=libinet6.a +TARGETS=libinet6.a libinet6.so all: $(TARGETS) @@ -64,12 +69,16 @@ @ar rulv libinet6.a $(OBJS) @ranlib libinet6.a +libinet6.so: $(RESDEP) $(OBJS) + ${LD_DYNAMIC} -o $@ $(OBJS) + clean: @rm -f $(TARGETS) *~ $(OBJS) -install: libinet6.a +install: libinet6.a libinet6.so @echo "libinet6.a -> $(DESTDIR)$(LIBDIR)/libinet6.a" @install -c -m 644 libinet6.a $(DESTDIR)$(LIBDIR) + @install -c -m 644 libinet6.so $(DESTDIR)$(LIBDIR) @for i in 1 3 5 8; \ do \ F=`find . -name \*.$$i -print | sed s:^\./::g`; \ diff -aruN inet6-apps-0.34.vanilla/lib/getaddrinfo.c inet6-apps-0.34/lib/getaddrinfo.c --- inet6-apps-0.34.vanilla/lib/getaddrinfo.c Wed Jun 24 10:36:53 1998 +++ inet6-apps-0.34/lib/getaddrinfo.c Sun Jan 31 19:02:23 1999 @@ -121,6 +121,11 @@ #endif /* RESOLVER */ #endif /* DEBUG */ +#ifdef FAITH +static int translate = 0; +static struct in6_addr faith_prefix; +#endif + #define GAIH_OKIFUNSPEC 0x0100 #define GAIH_EAI ~(GAIH_OKIFUNSPEC) @@ -668,6 +673,21 @@ at->family = AF_INET; #endif /* INET6 */ + if (!(req->ai_flags & AI_PASSIVE)) { + struct gaih_addrtuple *at3 = at; + + while (at3) { +#if INET6 + if (at3->family == AF_INET6) + memcpy(at3->addr, &in6addr_loopback, 16); + else +#endif /* INET6 */ + *((int32_t *)at3->addr) = htonl(INADDR_LOOPBACK); + + at3 = at3->next; + } + } + goto build; }; @@ -676,11 +696,12 @@ if (inet_pton(AF_INET, name, &in_addr) > 0) { if (!(at = malloc(sizeof(struct gaih_addrtuple)))) return -EAI_MEMORY; - + memset(at, 0, sizeof(struct gaih_addrtuple)); - + at->family = AF_INET; memcpy(at->addr, &in_addr, sizeof(struct in_addr)); + goto build; }; }; @@ -761,6 +782,15 @@ } else j = 0; +#ifdef FAITH + if (translate && at2->family == AF_INET) { + at2->family = AF_INET6; + memcpy(&at2->addr[12], &at2->addr[0], sizeof(struct in_addr)); + memcpy(&at2->addr[0], &faith_prefix, + sizeof(struct in6_addr) - sizeof(struct in_addr)); + } +#endif /* FAITH */ + #if INET6 if (at2->family == AF_INET6) i = sizeof(struct sockaddr_in6); @@ -928,12 +958,29 @@ struct gaih *g = gaih, *pg = NULL; struct gaih_service gaih_service, *pservice; + static int firsttime = 1; + #if DEBUG if (DEBUG_MESSAGES) { fprintf(stderr, ">getaddrinfo(name=%s, service=%s, req=%08x, pai=%08x)\n req: ", name ? name : "NULL", service ? service : "NULL", (unsigned int)req, (unsigned int)pai); dump_addrinfo(req, 0); }; #endif /* DEBUG */ + + + if (firsttime) { +#ifdef FAITH + memcpy(&faith_prefix, &in6addr_any, sizeof(struct in6_addr)); + { + char *q = getenv("GAI"); + if (q && (inet_pton(AF_INET6, q, &faith_prefix) >= 0)) + translate = 1; + } +#endif /* FAITH */ + + firsttime = 0; + } + if (name && (name[0] == '*') && !name[1]) name = NULL; diff -aruN inet6-apps-0.34.vanilla/lib/inet_ntop.c inet6-apps-0.34/lib/inet_ntop.c --- inet6-apps-0.34.vanilla/lib/inet_ntop.c Wed Jun 24 21:45:44 1998 +++ inet6-apps-0.34/lib/inet_ntop.c Sun Jan 31 19:02:23 1999 @@ -116,13 +116,13 @@ if (IN6_IS_ADDR_V4MAPPED(addr)) { strcpy(op,"::ffff:"); op += 7; - inet_ntop(AF_INET, &addr->s6_addr[12], op, 38); + inet_ntop(AF_INET, &addr->s6_addr[12], op, INET6_ADDRSTRLEN - 8); return buffer; } if (IN6_IS_ADDR_V4COMPAT(addr)) { strcpy(op,"::"); op += 2; - inet_ntop(AF_INET, &addr->s6_addr[12], op, 43); + inet_ntop(AF_INET, &addr->s6_addr[12], op, INET6_ADDRSTRLEN - 3); return buffer; } @@ -179,9 +179,13 @@ *(op++) = ':'; i++; } +#if 0 if ((start + len) == 8) *(op++) = '0'; else +#else + if ((start + len) != 8) +#endif --op; *op = 0; }