]> git.pld-linux.org Git - packages/bind.git/blame - host_991529+.diff
- added patch patching bind-idn.patch,
[packages/bind.git] / host_991529+.diff
CommitLineData
25acdb02
JK
1diff -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
4@@ -60,6 +60,8 @@
5 # This is the default in either case if you compile stand-alone.
6 CONFIGDEFS = -DHOST_RES_SEND
7
8+CONFIGDEFS = -DHOST_RES_SEND -DIPV6
9+
10 # ----------------------------------------------------------------------
11 # Include file directories.
12 # This program must be compiled with the same include files that
13diff -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
16@@ -0,0 +1,17 @@
17+Use -DIPV6 in the Makefile to turn IPv6 addresses recognition. This
18+version of host recognizes IPv6 addresses in the following formats:
19+
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
26+
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
29+about just ip6.int.
30+
31+There no IPv6 communication support yet.
32+
33+rzm@icm.edu.pl
34diff -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
37@@ -87,6 +87,7 @@
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));
45diff -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
48@@ -63,6 +63,7 @@
49 int nodata = 0; /* NO_DATA status during DNSRCH */
50 int nquery = 0; /* number of extra search queries */
51
52+ if (name==NULL) return FALSE;
53 /*
54 * Single dot means root zone.
55 */
56diff -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
59@@ -1273,6 +1273,7 @@
60 input char *name; /* command line argument */
61 {
62 bool result; /* result status of action taken */
63+ bool rev6 = FALSE;
64
65 /* check for nonsense input name */
66 if (strlength(name) > MAXDNAME)
67@@ -1297,6 +1298,13 @@
68 else
69 queryaddr = inet_addr(queryname);
70
71+#ifdef IPV6
72+ if (index(queryname,':')) {
73+ rev6 = TRUE;
74+ queryname = ip6_int(queryname);
75+ }
76+#endif
77+
78 /*
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 @@
82 if (reverse)
83 {
84 if (queryaddr == NOT_DOTTED_QUAD)
85- name = NULL;
86+ if (rev6) {
87+ name = ip6_int(queryname);
88+ } else {
89+ name = NULL;
90+ }
91 else
92 name = in_addr_arpa(queryname);
93
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.
97 */
98- if ((queryaddr == NOT_DOTTED_QUAD) && !reverse)
99+ if ((queryaddr == NOT_DOTTED_QUAD) && !rev6 && !reverse)
100 {
101 char namebuf[MAXDNAME+1];
102 register int n;
103
104- name = strcpy(namebuf, queryname);
105+ name = strncpy(namebuf, queryname, sizeof(namebuf));
106
107 n = strlength(name);
108 if (n > 1 && name[n-1] == '.')
109 name[n-1] = '\0';
110
111- reverse = indomain(name, ARPA_ROOT, FALSE);
112+ reverse = indomain(name, ARPA_ROOT, FALSE) || indomain(name, IPNG_ROOT, FALSE);
113 }
114
115 /*
116@@ -1370,7 +1382,7 @@
117 /* set querytype for regular mode if unspecified */
118 if ((querytype == T_NONE) && !listmode)
119 {
120- if ((queryaddr != NOT_DOTTED_QUAD) || reverse)
121+ if ((queryaddr != NOT_DOTTED_QUAD) || rev6 || reverse)
122 querytype = T_PTR;
123 else
124 querytype = T_A;
125diff -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
128@@ -209,6 +209,78 @@
129 }
130
131 \f/*
132+** IP6_INT -- Convert IPv6 string to reverse ip6.int
133+** ------------------------------------------------------------------
134+**
135+** Returns:
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.
139+*/
140+
141+char *
142+ip6_int(ipv6)
143+input char *ipv6; /* input string with IPv6 */
144+{
145+ static char dombuf[ 128/4*3 + sizeof(IPNG_ROOT) + 2];
146+#ifdef IPV6
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;
150+
151+ strncpy(ipv6addr, ipv6, sizeof(ipv6addr));
152+
153+ mask = index(ipv6addr, '/');
154+ if (mask) {
155+ *mask = '\0';
156+ mask++;
157+ nmask = atoi(mask);
158+ }
159+
160+ p = ipv6addr; while(*p) if (*p++==':') colons++;
161+/* printf("addr: %s, colons: %d, last: %c\n", ipv6addr, colons, p[-1]); */
162+
163+ /* relaxing address format: remove last : */
164+ if ( (p-ipv6addr>=2) && (p[-1]==':') && (p[-2]!=':') ) p[-1] = '\0';
165+
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;
170+ }
171+
172+ if (nmask==-1) nmask = 128;
173+
174+ err = inet_pton(AF_INET6, ipv6addr, &ip6buf);
175+ if (err == -1) {
176+ errmsg("Address (%s) format error: %s", ipv6, strerror(errno));
177+ return ipv6;
178+ }
179+ if (err == 0) {
180+ errmsg("Address `%s' not valid");
181+ return ipv6;
182+ }
183+
184+/* for (i=0; i<16; i++) printf("%02X ", ip6buf.s6_addr[i]); printf("/%d\n", nmask); */
185+
186+ nmask -= nmask%4;
187+ dombuf[0] = '\0';
188+ while (nmask>0) {
189+ if (nmask%8==0) {
190+ sprintf(buf2, "%X.", ip6buf.s6_addr[(nmask-1)/8] % 16);
191+ } else {
192+ sprintf(buf2, "%X.", ip6buf.s6_addr[(nmask-1)/8] / 16);
193+ }
194+ strcat(dombuf, buf2);
195+ nmask -= 4; /* 8 bits at a time */
196+ }
197+ strcat(dombuf, IPNG_ROOT);
198+ strcat(dombuf, ".");
199+#endif
200+ return dombuf;
201+}
202+
203+\f/*
204 ** NSAP_INT -- Convert dotted nsap address string to reverse nsap.int
205 ** ------------------------------------------------------------------
206 **
This page took 0.08405 seconds and 4 git commands to generate.