Changeset 2285

Show
Ignore:
Timestamp:
10/24/11 10:40:32 (19 months ago)
Author:
peter
Message:

actually parse ednssubnet info in backend-v3.pl; update/tweak/fix pipebackend docs

Location:
trunk/pdns
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/modules/pipebackend/backend-v3.pl

    r2254 r2285  
    2424        chomp(); 
    2525        my @arr=split(/\t/); 
    26         if(@arr < 7) { 
     26        if(@arr < 8) { 
    2727                print "LOG      PowerDNS sent unparseable line\n"; 
    2828                print "FAIL\n"; 
     
    3030        } 
    3131 
    32         my ($type,$qname,$qclass,$qtype,$id,$ip,$netmask)=split(/\t/); 
     32        my ($type,$qname,$qclass,$qtype,$id,$ip,$localip,$ednsip)=split(/\t/); 
    3333        my $bits=21; 
    3434        my $auth = 1; 
  • trunk/pdns/pdns/docs/pdns.xml

    r2277 r2285  
    1362913629              <para> 
    1363013630                If not set the default pipebackend-abi-version is 1. When set to 2, the local-ip-address field is added 
    13631                 after the remote-ip-address. (the local-ip-address refers to the IP address the question was received on) 
     13631                after the remote-ip-address. (the local-ip-address refers to the IP address the question was received on). When 
     13632                set to 3, the real remote IP/subnet is added based on edns-subnet support (this also requires enabling 'edns-subnet-processing'). 
    1363213633              </para> 
    1363313634            </listitem> 
     
    1363913640        <para> 
    1364013641          Questions come in over a file descriptor, by default standard input. Answers 
    13641           are sent out over another file descriptor, standard output by default. 
     13642          are sent out over another file descriptor, standard output by default. Questions 
     13643          and answers are terminated by single newline ('\n') characters. 
    1364213644        </para> 
    1364313645        <sect3> 
     
    1364513647      <para> 
    1364613648        PowerDNS sends out 'HELO\t1', indicating that it wants to speak the 
    13647         protocol as defined in this document, version 1. 
     13649        protocol as defined in this document, version 1. For abi-version 2 or 3, PowerDNS 
     13650        sends 'HELO\t2' or 'HELO\t3'. 
    1364813651         
    1364913652        A PowerDNS CoProcess must then send out a banner, prefixed by 'OK\t',  
     
    1365413657    <sect3><title>Questions</title> 
    1365513658      <para> 
    13656         Questions come in three forms and are prefixed by a tag indicating the kind: 
     13659        Questions come in three forms and are prefixed by a tag indicating the type: 
    1365713660        <variablelist> 
    1365813661          <varlistentry> 
     
    1368113684          </varlistentry> 
    1368213685        </variablelist> 
    13683 The question format: 
    13684  
     13686       </para> 
     13687<para> 
     13688The question format, for type Q questions: 
     13689</para> 
     13690 
     13691<para> 
    1368513692pipebackend-abi-version = 1 [default] 
    1368613693<screen> 
    13687 type    qname           qclass  qtype   id      remote-ip-address 
     13694Q       qname           qclass  qtype   id      remote-ip-address 
    1368813695</screen> 
    13689  
     13696</para> 
     13697<para> 
    1369013698pipebackend-abi-version = 2 
    1369113699<screen> 
    13692 type    qname           qclass  qtype   id      remote-ip-address       local-ip-address 
     13700Q       qname           qclass  qtype   id      remote-ip-address       local-ip-address 
    1369313701</screen> 
    13694  
     13702</para> 
     13703 
     13704<para> 
     13705pipebackend-abi-version = 3 
     13706<screen> 
     13707Q       qname           qclass  qtype   id      remote-ip-address       local-ip-address        edns-subnet-address 
     13708</screen> 
     13709</para> 
     13710 
     13711<para> 
    1369513712Fields are tab separated, and terminated with a single \n. The remote-ip-address is the IP address 
    1369613713of the nameserver asking the question; the local-ip-address is the IP address on which the question 
    1369713714was received. 
    13698  
     13715</para> 
     13716 
     13717<para> 
    1369913718Type is the tag above, qname is the domain the question is about. qclass is 
    1370013719always 'IN' currently, denoting an INternet question. qtype is the kind of 
    1370113720information desired, the record type, like A, CNAME or AAAA. id can be 
    1370213721specified to help your backend find an answer if the id is already known 
    13703 from an earlier query. You can ignore it. 
    13704  
     13722from an earlier query. You can ignore it unless you want to support AXFR. 
     13723</para> 
     13724 
     13725<para> 
    1370513726remote-ip-address is the ip-address of the nameserver asking the question. 
    13706 local-ip-address is the ip-address that was querried locally. 
    13707       </para></sect3> 
     13727local-ip-address is the ip-address that was queried locally. edns-subnet-address 
     13728is the actual client subnet as provided via edns-subnet support. Note that for the SOA 
     13729query that precedes an AXFR, edns-subnet is always set to 0.0.0.0/0. 
     13730</para> 
     13731 
     13732<para> 
     13733AXFR-queries look like this: 
     13734<screen> 
     13735AXFR    id 
     13736</screen> 
     13737The id is gathered from the answer to a SOA query. 
     13738 
     13739</para>  
     13740 </sect3> 
    1370813741    <sect3><title>Answers</title> 
    1370913742      <para> 
     
    1371513748            <listitem> 
    1371613749              <para> 
    13717                 Indicating a successful line of DATA 
     13750                Indicating a successful line of DATA. 
    1371813751              </para> 
    1371913752            </listitem> 
     
    1372313756            <listitem> 
    1372413757              <para> 
    13725                 Indicating the end of an answer - no further data 
     13758                Indicating the end of an answer - no further data. 
    1372613759              </para> 
    1372713760            </listitem> 
     
    1374113774                For specifying things that should be logged. Can only be sent after 
    1374213775                a query and before an END line. After the tab, the message to be 
    13743                 logged 
     13776                logged. 
    1374413777                 
    1374513778              </para> 
     
    1374913782 
    1375013783 
    13751         So letting it be known that there is no data consists if sending 'END' 
     13784        So, letting it be known that there is no data consists of sending 'END' 
    1375213785        without anything else. 
    1375313786 
    1375413787 
    13755 The answer format: 
     13788The answer format (for abi-version 1 and 2): 
    1375613789<screen> 
    1375713790DATA    qname           qclass  qtype   ttl     id      content  
     
    1376013793'content' is as specified in <xref linkend="types"/>. 
    1376113794 
    13762 A sample dialogue may look like this: 
     13795A sample dialogue may look like this (note that in reality, 
     13796almost all queries will actually be for the ANY qtype): 
    1376313797<screen> 
    1376413798Q       www.ds9a.nl     IN      CNAME   -1      213.244.168.210 
    1376513799DATA    www.ds9a.nl     IN      CNAME   3600    1 ws1.ds9a.nl 
     13800END 
    1376613801Q       ws1.ds9a.nl     IN      CNAME   -1      213.244.168.210 
    1376713802END 
     
    1377313808</screen> 
    1377413809 
    13775           This would correspond to a remote webserver 213.244.168.210 wanting to 
     13810This would correspond to a remote webserver 213.244.168.210 wanting to 
    1377613811resolve the IP address of www.ds9a.nl, and PowerDNS traversing the CNAMEs to 
    1377713812find the IP addresses of ws1.ds9a.nl 
     
    1379513830This is a typical zone transfer. 
    1379613831          </para> 
     13832<para> 
     13833        For abi-version 3, DATA-responses get two extra fields: 
     13834<screen> 
     13835DATA    scopebits       auth    qname           qclass  qtype   ttl     id      content  
     13836</screen> 
     13837 
     13838scopebits indicates how many bits from the subnet provided in the question 
     13839(originally from edns-subnet) were used in determining this answer. This can 
     13840aid caching (although PowerDNS does not currently use this value). The auth 
     13841field indicates whether this response is authoritative; this is for DNSSEC. 
     13842</para> 
    1379713843        </sect3> 
    1379813844        <sect3>