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: 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) { |
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) { |
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; |
155failed: 156 delegpt_free_mlc(dp); 157 return 0; |
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)) { |
175 char buf[257]; 176 dname_str(dp->name, buf); 177 log_err("second hints for zone %s ignored.", buf); |
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) { |
261 if(!(dp=read_stubs_name(s))) |
262 return 0; |
263 if(!read_stubs_host(s, dp) || !read_stubs_addr(s, dp)) { 264 delegpt_free_mlc(dp); 265 return 0; 266 } |
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); |
272 if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, !s->isprime)) 273 return 0; |
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 --- |