Deleted Added
full compact
iter_hints.c (249140) iter_hints.c (249141)
1/*
2 * iterator/iter_hints.c - iterative resolver module stub and root hints.
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 105 unchanged lines hidden (view full) ---

114{
115 /* from:
116 ; This file is made available by InterNIC
117 ; under anonymous FTP as
118 ; file /domain/named.cache
119 ; on server FTP.INTERNIC.NET
120 ; -OR- RS.INTERNIC.NET
121 ;
1/*
2 * iterator/iter_hints.c - iterative resolver module stub and root hints.
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 105 unchanged lines hidden (view full) ---

114{
115 /* from:
116 ; This file is made available by InterNIC
117 ; under anonymous FTP as
118 ; file /domain/named.cache
119 ; on server FTP.INTERNIC.NET
120 ; -OR- RS.INTERNIC.NET
121 ;
122 ; related version of root zone: 2010061700
122 ; related version of root zone: changes-on-20120103
123 */
124 struct delegpt* dp = delegpt_create_mlc((uint8_t*)"\000");
125 if(!dp)
126 return NULL;
127 dp->has_parent_side_NS = 1;
128 if(do_ip4) {
123 */
124 struct delegpt* dp = delegpt_create_mlc((uint8_t*)"\000");
125 if(!dp)
126 return NULL;
127 dp->has_parent_side_NS = 1;
128 if(do_ip4) {
129 if(!ah(dp, "A.ROOT-SERVERS.NET.", "198.41.0.4")) return 0;
130 if(!ah(dp, "B.ROOT-SERVERS.NET.", "192.228.79.201")) return 0;
131 if(!ah(dp, "C.ROOT-SERVERS.NET.", "192.33.4.12")) return 0;
132 if(!ah(dp, "D.ROOT-SERVERS.NET.", "128.8.10.90")) return 0;
133 if(!ah(dp, "E.ROOT-SERVERS.NET.", "192.203.230.10")) return 0;
134 if(!ah(dp, "F.ROOT-SERVERS.NET.", "192.5.5.241")) return 0;
135 if(!ah(dp, "G.ROOT-SERVERS.NET.", "192.112.36.4")) return 0;
136 if(!ah(dp, "H.ROOT-SERVERS.NET.", "128.63.2.53")) return 0;
137 if(!ah(dp, "I.ROOT-SERVERS.NET.", "192.36.148.17")) return 0;
138 if(!ah(dp, "J.ROOT-SERVERS.NET.", "192.58.128.30")) return 0;
139 if(!ah(dp, "K.ROOT-SERVERS.NET.", "193.0.14.129")) return 0;
140 if(!ah(dp, "L.ROOT-SERVERS.NET.", "199.7.83.42")) return 0;
141 if(!ah(dp, "M.ROOT-SERVERS.NET.", "202.12.27.33")) return 0;
129 if(!ah(dp, "A.ROOT-SERVERS.NET.", "198.41.0.4")) goto failed;
130 if(!ah(dp, "B.ROOT-SERVERS.NET.", "192.228.79.201")) goto failed;
131 if(!ah(dp, "C.ROOT-SERVERS.NET.", "192.33.4.12")) goto failed;
132 if(!ah(dp, "D.ROOT-SERVERS.NET.", "199.7.91.13")) goto failed;
133 if(!ah(dp, "E.ROOT-SERVERS.NET.", "192.203.230.10")) goto failed;
134 if(!ah(dp, "F.ROOT-SERVERS.NET.", "192.5.5.241")) goto failed;
135 if(!ah(dp, "G.ROOT-SERVERS.NET.", "192.112.36.4")) goto failed;
136 if(!ah(dp, "H.ROOT-SERVERS.NET.", "128.63.2.53")) goto failed;
137 if(!ah(dp, "I.ROOT-SERVERS.NET.", "192.36.148.17")) goto failed;
138 if(!ah(dp, "J.ROOT-SERVERS.NET.", "192.58.128.30")) goto failed;
139 if(!ah(dp, "K.ROOT-SERVERS.NET.", "193.0.14.129")) goto failed;
140 if(!ah(dp, "L.ROOT-SERVERS.NET.", "199.7.83.42")) goto failed;
141 if(!ah(dp, "M.ROOT-SERVERS.NET.", "202.12.27.33")) goto failed;
142 }
143 if(do_ip6) {
142 }
143 if(do_ip6) {
144 if(!ah(dp, "A.ROOT-SERVERS.NET.", "2001:503:ba3e::2:30")) return 0;
145 if(!ah(dp, "D.ROOT-SERVERS.NET.", "2001:500:2d::d")) return 0;
146 if(!ah(dp, "F.ROOT-SERVERS.NET.", "2001:500:2f::f")) return 0;
147 if(!ah(dp, "H.ROOT-SERVERS.NET.", "2001:500:1::803f:235")) return 0;
148 if(!ah(dp, "I.ROOT-SERVERS.NET.", "2001:7fe::53")) return 0;
149 if(!ah(dp, "J.ROOT-SERVERS.NET.", "2001:503:c27::2:30")) return 0;
150 if(!ah(dp, "K.ROOT-SERVERS.NET.", "2001:7fd::1")) return 0;
151 if(!ah(dp, "L.ROOT-SERVERS.NET.", "2001:500:3::42")) return 0;
152 if(!ah(dp, "M.ROOT-SERVERS.NET.", "2001:dc3::35")) return 0;
144 if(!ah(dp, "A.ROOT-SERVERS.NET.", "2001:503:ba3e::2:30")) goto failed;
145 if(!ah(dp, "D.ROOT-SERVERS.NET.", "2001:500:2d::d")) goto failed;
146 if(!ah(dp, "F.ROOT-SERVERS.NET.", "2001:500:2f::f")) goto failed;
147 if(!ah(dp, "H.ROOT-SERVERS.NET.", "2001:500:1::803f:235")) goto failed;
148 if(!ah(dp, "I.ROOT-SERVERS.NET.", "2001:7fe::53")) goto failed;
149 if(!ah(dp, "J.ROOT-SERVERS.NET.", "2001:503:c27::2:30")) goto failed;
150 if(!ah(dp, "K.ROOT-SERVERS.NET.", "2001:7fd::1")) goto failed;
151 if(!ah(dp, "L.ROOT-SERVERS.NET.", "2001:500:3::42")) goto failed;
152 if(!ah(dp, "M.ROOT-SERVERS.NET.", "2001:dc3::35")) goto failed;
153 }
154 return dp;
153 }
154 return dp;
155failed:
156 delegpt_free_mlc(dp);
157 return 0;
155}
156
157/** insert new hint info into hint structure */
158static int
159hints_insert(struct iter_hints* hints, uint16_t c, struct delegpt* dp,
160 int noprime)
161{
162 struct iter_hints_stub* node = (struct iter_hints_stub*)malloc(
163 sizeof(struct iter_hints_stub));
164 if(!node) {
165 delegpt_free_mlc(dp);
166 return 0;
167 }
168 node->dp = dp;
169 node->noprime = (uint8_t)noprime;
170 if(!name_tree_insert(&hints->tree, &node->node, dp->name, dp->namelen,
171 dp->namelabs, c)) {
158}
159
160/** insert new hint info into hint structure */
161static int
162hints_insert(struct iter_hints* hints, uint16_t c, struct delegpt* dp,
163 int noprime)
164{
165 struct iter_hints_stub* node = (struct iter_hints_stub*)malloc(
166 sizeof(struct iter_hints_stub));
167 if(!node) {
168 delegpt_free_mlc(dp);
169 return 0;
170 }
171 node->dp = dp;
172 node->noprime = (uint8_t)noprime;
173 if(!name_tree_insert(&hints->tree, &node->node, dp->name, dp->namelen,
174 dp->namelabs, c)) {
172 log_err("second hints ignored.");
175 char buf[257];
176 dname_str(dp->name, buf);
177 log_err("second hints for zone %s ignored.", buf);
173 delegpt_free_mlc(dp);
174 free(node);
175 }
176 return 1;
177}
178
179/** set stub name */
180static struct delegpt*

--- 67 unchanged lines hidden (view full) ---

248
249/** read stubs config */
250static int
251read_stubs(struct iter_hints* hints, struct config_file* cfg)
252{
253 struct config_stub* s;
254 struct delegpt* dp;
255 for(s = cfg->stubs; s; s = s->next) {
178 delegpt_free_mlc(dp);
179 free(node);
180 }
181 return 1;
182}
183
184/** set stub name */
185static struct delegpt*

--- 67 unchanged lines hidden (view full) ---

253
254/** read stubs config */
255static int
256read_stubs(struct iter_hints* hints, struct config_file* cfg)
257{
258 struct config_stub* s;
259 struct delegpt* dp;
260 for(s = cfg->stubs; s; s = s->next) {
256 if(!(dp=read_stubs_name(s)) ||
257 !read_stubs_host(s, dp) ||
258 !read_stubs_addr(s, dp))
261 if(!(dp=read_stubs_name(s)))
259 return 0;
262 return 0;
263 if(!read_stubs_host(s, dp) || !read_stubs_addr(s, dp)) {
264 delegpt_free_mlc(dp);
265 return 0;
266 }
260 /* the flag is turned off for 'stub-first' so that the
261 * last resort will ask for parent-side NS record and thus
262 * fallback to the internet name servers on a failure */
263 dp->has_parent_side_NS = (uint8_t)!s->isfirst;
267 /* the flag is turned off for 'stub-first' so that the
268 * last resort will ask for parent-side NS record and thus
269 * fallback to the internet name servers on a failure */
270 dp->has_parent_side_NS = (uint8_t)!s->isfirst;
271 delegpt_log(VERB_QUERY, dp);
264 if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, !s->isprime))
265 return 0;
272 if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, !s->isprime))
273 return 0;
266 delegpt_log(VERB_QUERY, dp);
267 }
268 return 1;
269}
270
271/** read root hints from file */
272static int
273read_root_hints(struct iter_hints* hints, char* fname)
274{

--- 260 unchanged lines hidden ---
274 }
275 return 1;
276}
277
278/** read root hints from file */
279static int
280read_root_hints(struct iter_hints* hints, char* fname)
281{

--- 260 unchanged lines hidden ---