Changeset 1451
- Timestamp:
- 12/06/09 18:20:10 (3 months ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 3 modified
-
pdns_recursor.cc (modified) (4 diffs)
-
syncres.cc (modified) (2 diffs)
-
syncres.hh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/pdns_recursor.cc
r1446 r1451 1545 1545 typedef vector<string> parts_t; 1546 1546 parts_t parts; 1547 for(int n=0; n < 2 ; ++n ) { 1547 const char *option_names[3]={"auth-zones", "forward-zones", "forward-zones-recurse"}; 1548 for(int n=0; n < 3 ; ++n ) { 1548 1549 parts.clear(); 1549 stringtok(parts, ::arg()[ n ? "forward-zones" : "auth-zones"], ",\t\n\r");1550 stringtok(parts, ::arg()[option_names[n]], ",\t\n\r"); 1550 1551 for(parts_t::const_iterator iter = parts.begin(); iter != parts.end(); ++iter) { 1551 1552 SyncRes::AuthDomain ad; … … 1555 1556 headers.first=toCanonic("", headers.first); 1556 1557 if(n==0) { 1557 L<<Logger::Error<<"Parsing authoritative data for zone '"<<headers.first<<"' from file '"<<headers.second<<"'"<<endl; 1558 ZoneParserTNG zpt(headers.second, headers.first); 1559 DNSResourceRecord rr; 1560 while(zpt.get(rr)) { 1561 try { 1562 string tmp=DNSRR2String(rr); 1563 rr=String2DNSRR(rr.qname, rr.qtype, tmp, rr.ttl); 1564 } 1565 catch(std::exception &e) { 1566 throw AhuException("Error parsing record '"+rr.qname+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"': "+e.what()); 1567 } 1568 catch(...) { 1569 throw AhuException("Error parsing record '"+rr.qname+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"'"); 1570 } 1571 1572 ad.d_records.insert(rr); 1573 1574 } 1558 L<<Logger::Error<<"Parsing authoritative data for zone '"<<headers.first<<"' from file '"<<headers.second<<"'"<<endl; 1559 ZoneParserTNG zpt(headers.second, headers.first); 1560 DNSResourceRecord rr; 1561 while(zpt.get(rr)) { 1562 try { 1563 string tmp=DNSRR2String(rr); 1564 rr=String2DNSRR(rr.qname, rr.qtype, tmp, rr.ttl); 1565 } 1566 catch(std::exception &e) { 1567 throw AhuException("Error parsing record '"+rr.qname+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"': "+e.what()); 1568 } 1569 catch(...) { 1570 throw AhuException("Error parsing record '"+rr.qname+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"'"); 1571 } 1572 1573 ad.d_records.insert(rr); 1574 } 1575 1575 } 1576 1576 else { 1577 L<<Logger::Error<<"Redirecting queries for zone '"<<headers.first<<"' to: "; 1578 convertServersForAD(headers.second, ad, ";"); 1577 L<<Logger::Error<<"Redirecting queries for zone '"<<headers.first<<"' "; 1578 if(n == 2) { 1579 L<<"with recursion "; 1580 ad.d_rdForward = 1; 1581 } 1582 else ad.d_rdForward = 0; 1583 L<<"to: "; 1584 1585 convertServersForAD(headers.second, ad, ";"); 1586 if(n == 2) { 1587 ad.d_rdForward = 1; 1588 } 1579 1589 } 1580 1590 … … 1601 1611 trim(domain); 1602 1612 trim(instructions); 1603 1613 if(boost::starts_with(domain,"+")) { 1614 domain=domain.c_str()+1; 1615 ad.d_rdForward = true; 1616 } 1617 else 1618 ad.d_rdForward = false; 1604 1619 if(domain.empty()) 1605 1620 throw AhuException("Error parsing line "+lexical_cast<string>(linenum)+" of " +::arg()["forward-zones-file"]); … … 2114 2129 ::arg().set("auth-zones", "Zones for which we have authoritative data, comma separated domain=file pairs ")=""; 2115 2130 ::arg().set("forward-zones", "Zones for which we forward queries, comma separated domain=ip pairs")=""; 2131 ::arg().set("forward-zones-recurse", "Zones for which we forward queries, comma separated domain=ip pairs")=""; 2116 2132 ::arg().set("forward-zones-file", "File with domain=ip pairs for forwarding")=""; 2117 2133 ::arg().set("export-etc-hosts", "If we should serve up contents from /etc/hosts")="off"; -
trunk/pdns/pdns/syncres.cc
r1447 r1451 555 555 else { 556 556 for(vector<ComboAddress>::const_iterator server=iter->second.d_servers.begin(); server != iter->second.d_servers.end(); ++server) 557 nsset.insert( server->toStringWithPort());557 nsset.insert((iter->second.d_rdForward ? "+" : "-") + server->toStringWithPort()); // add a '+' if the rd bit should be set 558 558 } 559 559 … … 828 828 LOG<<prefix<<qname<<": Domain has hardcoded nameserver(s)"<<endl; 829 829 830 ComboAddress addr=parseIPAndPort(*tns, 53); 830 string txtAddr = *tns; 831 if(!tns->empty()) { 832 sendRDQuery = txtAddr[0] == '+'; 833 txtAddr=txtAddr.c_str()+1; 834 } 835 ComboAddress addr=parseIPAndPort(txtAddr, 53); 831 836 832 837 remoteIPs.push_back(addr); 833 838 pierceDontQuery=true; 834 // sendRDQuery=true;835 839 } 836 840 else { -
trunk/pdns/pdns/syncres.hh
r1446 r1451 363 363 { 364 364 vector<ComboAddress> d_servers; 365 bool d_rdForward; 365 366 typedef multi_index_container < 366 367 DNSResourceRecord,