1 diff -Nru host/Makefile host+/Makefile
2 --- host/Makefile Wed Mar 15 22:51:39 2000
3 +++ host+/Makefile Wed Jun 14 01:01:09 2000
5 # This is the default in either case if you compile stand-alone.
6 CONFIGDEFS = -DHOST_RES_SEND
8 +CONFIGDEFS = -DHOST_RES_SEND -DIPV6
10 # ----------------------------------------------------------------------
11 # Include file directories.
12 # This program must be compiled with the same include files that
13 diff -Nru host/README.ip6.int host+/README.ip6.int
14 --- host/README.ip6.int Thu Jan 1 01:00:00 1970
15 +++ host+/README.ip6.int Wed Jun 14 01:05:05 2000
17 +Use -DIPV6 in the Makefile to turn IPv6 addresses recognition. This
18 +version of host recognizes IPv6 addresses in the following formats:
20 +3ffe:8010:: normal format of a host (mask 128) address
21 +3ffe:8010::1 normal format of a host (mask 128) address
22 +3ffe:8010::/28 with mask
23 +3ffe:8010:2::/28 with mask; :2: will be masked
24 +3ffe:8010:2 relaxed format; default mask will be 48 in this case
25 +3ffe:8010/28 default mask 32 but shorten explicitely to 28
27 +All of the above addresses will be transformed into ip6.int domain form,
28 +e.g. 3ffe:8010/28 -> 1.0.8.E.F.F.3.ip6.int. ::/0 can be used to ask
31 +There no IPv6 communication support yet.
34 diff -Nru host/defs.h host+/defs.h
35 --- host/defs.h Wed Mar 29 20:19:00 2000
36 +++ host+/defs.h Tue Jun 13 18:39:39 2000
38 int parse_type PROTO((char *));
39 int parse_class PROTO((char *));
40 char *in_addr_arpa PROTO((char *));
41 +char *ip6_int PROTO((char *));
42 char *nsap_int PROTO((char *));
43 void print_host PROTO((char *, struct hostent *));
44 void show_res PROTO((void));
45 diff -Nru host/info.c host+/info.c
46 --- host/info.c Mon Mar 27 12:59:11 2000
47 +++ host+/info.c Tue Jun 13 21:06:15 2000
49 int nodata = 0; /* NO_DATA status during DNSRCH */
50 int nquery = 0; /* number of extra search queries */
52 + if (name==NULL) return FALSE;
54 * Single dot means root zone.
56 diff -Nru host/main.c host+/main.c
57 --- host/main.c Wed Mar 29 22:38:09 2000
58 +++ host+/main.c Wed Jun 14 00:55:58 2000
60 input char *name; /* command line argument */
62 bool result; /* result status of action taken */
65 /* check for nonsense input name */
66 if (strlength(name) > MAXDNAME)
67 @@ -1297,6 +1298,13 @@
69 queryaddr = inet_addr(queryname);
72 + if (index(queryname,':')) {
74 + queryname = ip6_int(queryname);
79 * Generate reverse in-addr.arpa query if so requested.
80 * The input name must be a dotted quad, and be convertible.
81 @@ -1304,7 +1312,11 @@
84 if (queryaddr == NOT_DOTTED_QUAD)
87 + name = ip6_int(queryname);
92 name = in_addr_arpa(queryname);
94 @@ -1323,18 +1335,18 @@
95 * Heuristic to check whether we are processing a reverse mapping domain.
96 * Normalize to not have trailing dot, unless it is the root zone.
98 - if ((queryaddr == NOT_DOTTED_QUAD) && !reverse)
99 + if ((queryaddr == NOT_DOTTED_QUAD) && !rev6 && !reverse)
101 char namebuf[MAXDNAME+1];
104 - name = strcpy(namebuf, queryname);
105 + name = strncpy(namebuf, queryname, sizeof(namebuf));
108 if (n > 1 && name[n-1] == '.')
111 - reverse = indomain(name, ARPA_ROOT, FALSE);
112 + reverse = indomain(name, ARPA_ROOT, FALSE) || indomain(name, IPNG_ROOT, FALSE);
116 @@ -1370,7 +1382,7 @@
117 /* set querytype for regular mode if unspecified */
118 if ((querytype == T_NONE) && !listmode)
120 - if ((queryaddr != NOT_DOTTED_QUAD) || reverse)
121 + if ((queryaddr != NOT_DOTTED_QUAD) || rev6 || reverse)
125 diff -Nru host/util.c host+/util.c
126 --- host/util.c Mon Mar 27 13:34:15 2000
127 +++ host+/util.c Wed Jun 14 01:00:08 2000
132 +** IP6_INT -- Convert IPv6 string to reverse ip6.int
133 +** ------------------------------------------------------------------
136 +** Pointer to appropriate reverse ip6.int name with
137 +** trailing dot to force absolute domain name. NULL
138 +** in case of invalid IPv6 input string.
143 +input char *ipv6; /* input string with IPv6 */
145 + static char dombuf[ 128/4*3 + sizeof(IPNG_ROOT) + 2];
147 + char ipv6addr [8*4 + 7 + 1 + 3 + 2], *mask, *p, buf2[5];
148 + struct in6_addr ip6buf;
149 + int nmask = -1, err, i, colons = 0;
151 + strncpy(ipv6addr, ipv6, sizeof(ipv6addr));
153 + mask = index(ipv6addr, '/');
157 + nmask = atoi(mask);
160 + p = ipv6addr; while(*p) if (*p++==':') colons++;
161 +/* printf("addr: %s, colons: %d, last: %c\n", ipv6addr, colons, p[-1]); */
163 + /* relaxing address format: remove last : */
164 + if ( (p-ipv6addr>=2) && (p[-1]==':') && (p[-2]!=':') ) p[-1] = '\0';
166 + /* mask not set, derived from non-standard formatted address */
167 + if ( (colons<7) && (p[-1]!=':') && (strstr(ipv6addr,"::")==0) ) {
168 + strcat(ipv6addr, "::");
169 + if (nmask==-1) nmask = (colons+1)*16;
172 + if (nmask==-1) nmask = 128;
174 + err = inet_pton(AF_INET6, ipv6addr, &ip6buf);
176 + errmsg("Address (%s) format error: %s", ipv6, strerror(errno));
180 + errmsg("Address `%s' not valid");
184 +/* for (i=0; i<16; i++) printf("%02X ", ip6buf.s6_addr[i]); printf("/%d\n", nmask); */
190 + sprintf(buf2, "%X.", ip6buf.s6_addr[(nmask-1)/8] % 16);
192 + sprintf(buf2, "%X.", ip6buf.s6_addr[(nmask-1)/8] / 16);
194 + strcat(dombuf, buf2);
195 + nmask -= 4; /* 8 bits at a time */
197 + strcat(dombuf, IPNG_ROOT);
198 + strcat(dombuf, ".");
204 ** NSAP_INT -- Convert dotted nsap address string to reverse nsap.int
205 ** ------------------------------------------------------------------