[Pdns-dev] Qtype SOA issues

bert hubert bert.hubert at netherlabs.nl
Tue Dec 4 11:49:27 CET 2012


Hi Ilya,

PowerDNS always starts by asking for an ANY record or a SOA record. Your
backend must be prepared to supply answers to these questions. There is very
little we can do about that.

Once you have supplied the SOA or ANY answer, things will work.

	Bert

On Tue, Dec 04, 2012 at 05:45:42PM +0700, Ilya Larkin wrote:
> Code:
> 
> void MyDnsBackend::lookup(const QType& qtype, const string& qdomain,
> DNSPacket* pkt, int zoneId)
> {
>   L << Logger::Info << "Domain: " << qdomain << " Code type: " <<
> qtype.getCode() << endl;
> 
>   if(qtype.getCode() == QType::SOA || qtype.getCode() == QType::CNAME)
>     return;
> 
>   if (boost::algorithm::starts_with(qdomain, "*"))
>     return;
> 
>   //else - handle request
>   //...
> }
> 
> 
> pdns.conf:
> 
> cache-ttl=0
> negquery-cache-ttl=0
> query-cache-ttl=0
> recursive-cache-ttl=0
> 
> launch=mybackend
> module-dir=/usr/share/mods/
> 
> recursor=127.0.0.1:53
> 
> local-address=127.0.0.1
> daemon=yes
> 
> 
> Dig output:
> 
> ; <<>> DiG 9.7.6-P1 <<>> -t A google.com @<server-ip>
> ;; global options: +cmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41566
> ;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0
> 
> ;; QUESTION SECTION:
> ;google.com. IN A
> 
> ;; ANSWER SECTION:
> google.com. 300 IN A 173.194.32.3
> google.com. 300 IN A 173.194.32.7
> google.com. 300 IN A 173.194.32.0
> google.com. 300 IN A 173.194.32.1
> google.com. 300 IN A 173.194.32.8
> google.com. 300 IN A 173.194.32.4
> google.com. 300 IN A 173.194.32.14
> google.com. 300 IN A 173.194.32.5
> google.com. 300 IN A 173.194.32.2
> google.com. 300 IN A 173.194.32.6
> google.com. 300 IN A 173.194.32.9
> 
> ;; Query time: 319 msec
> ;; SERVER: <server-ip>#53(<server-ip>)
> ;; WHEN: Tue Dec  4 08:55:27 2012
> ;; MSG SIZE  rcvd: 204
> 
> 
> pdns log output:
> 
> Dec  4 02:59:04 server pdns[27079]: PowerDNS 3.1 (C) 2001-2012 PowerDNS.COM
> BV (Nov 28 2012, 09:32:08, gcc 4.4.6 20120305 (Red Hat 4.4.6-4)) starting up
> Dec  4 02:59:04 server pdns[27079]: PowerDNS comes with ABSOLUTELY NO
> WARRANTY. This is free software, and you are welcome to redistribute it
> according to the terms of the GPL version 2.
> Dec  4 02:59:04 server pdns[27079]: DNS Proxy launched, local port 16203,
> remote 127.0.0.1:53
> Dec  4 02:59:04 server pdns[27079]: Creating backend connection for TCP
> Dec  4 02:59:04 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:04 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: [MyDnsBackend] Backend initialization
> completed. MySQL client version = 5.1.66
> Dec  4 02:59:33 server pdns[27079]: Start dnsfence backend initialization...
> Dec  4 02:59:33 server pdns[27079]: About to create 3 backend threads for
> UDP
> Dec  4 02:59:33 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: Start dns backend initialization...
> Dec  4 02:59:33 server pdns[27079]: Done launching threads, ready to
> distribute questions
> Dec  4 02:59:35 server pdns[29319]: Domain: google.com Code type: 6
> Dec  4 02:59:35 server pdns[29319]: Domain: com Code type: 6
> Dec  4 02:59:35 server pdns[29319]: Domain:  Code type: 6
> 
> 
> I log all incoming requests. pdns-3.1:
> 
> +----+----------+------------+---------------+------------+------+-----------+
> | id  | logdate| utime    | ip            | query
>  | type | times_met |
> +----+----------+------------+---------------+------------+------+-----------+
> | 18 | 20121204 | 1354586125 | <source ip>   | google.com | SOA  |
> 1 |
> | 19 | 20121204 | 1354586125 | <source ip>   | com            | SOA  |
>     1 |
> | 20 | 20121204 | 1354586125 | <source ip>   |                   | SOA  |
>       1 |
> +----+----------+------------+---------------+------------+------+-----------+
> 3 rows in set (0.03 sec)
> 
> 
> The same request on pdns-2.9.22 server:
> 
> +-------+----------+------------+---------------+-------------------------+------+-----------+
> | id    | logdate  | utime      | ip            | query
>                 | type | times_met |
> +-------+----------+------------+---------------+-------------------------+------+-----------+
> | 63846 | 20121204 | 1354585324 | <source ip>   | google.com              |
> A    |       187 |
> +-------+----------+------------+---------------+-------------------------+------+-----------+
> 
> 
> Another example:
> 
> ; <<>> DiG 9.7.6-P1 <<>> facebook.com @<server-ip>
> ;; global options: +cmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7639
> ;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0
> 
> ;; QUESTION SECTION:
> ;facebook.com. IN A
> 
> ;; ANSWER SECTION:
> facebook.com. 174 IN A 66.220.152.16
> facebook.com. 174 IN A 173.252.100.16
> facebook.com. 174 IN A 66.220.158.16
> facebook.com. 174 IN A 173.252.101.16
> facebook.com. 174 IN A 69.171.229.16
> facebook.com. 174 IN A 69.171.224.32
> 
> ;; Query time: 290 msec
> ;; SERVER: <server-ip>#53(<server-ip>)
> ;; WHEN: Tue Dec  4 10:14:50 2012
> ;; MSG SIZE  rcvd: 126
> 
> pdns log output:
> 
> Dec  4 04:14:47 server pdns[30109]: Domain: facebook.com Code type: 6
> Dec  4 04:14:47 server pdns[30109]: Domain: com Code type: 6
> Dec  4 04:14:47 server pdns[30109]: Domain:  Code type: 6
> 
> 
> database records:
> 
> pdns-3.1:
> +----+----------+------------+---------------+--------------+------+-----------+
> | id | logdate  | utime      | ip            | query
>       | type | times_met |
> +----+----------+------------+---------------+--------------+------+-----------+
> | 18 | 20121204 | 1354586125 | <source ip>   | google.com      | SOA  |
>     5 |
> | 19 | 20121204 | 1354586125 | <source ip>   | com                 | SOA  |
>         8 |
> | 20 | 20121204 | 1354586125 | <source ip>   |                        | SOA
>  |         8 |
> | 21 | 20121204 | 1354590734 | <source ip>   | facebook.com   | SOA  |
>     3 |
> +----+----------+------------+---------------+--------------+------+-----------+
> 4 rows in set (0.04 sec)
> 
> 
> pdns-2.9.22:
> 
> +-------+----------+------------+---------------+------------------+------+-----------+
> | id    | logdate  | utime      | ip            | query
>             | type | times_met |
> +-------+----------+------------+---------------+------------------+------+-----------+
> | 64420 | 20121204 | 1354592035 | <source ip>   | facebook.com     | A    |
>         1 |
> +-------+----------+------------+---------------+------------------+------+-----------+
> 
> pdns-2.9.22 correct detects SOA and A qtypes, but pdns-3.1 only SOA. May be
> i missing something?
> 
> Best regards,
> Ilya

> _______________________________________________
> Pdns-dev mailing list
> Pdns-dev at mailman.powerdns.com
> http://mailman.powerdns.com/mailman/listinfo/pdns-dev



More information about the Pdns-dev mailing list