directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Vermillard <jvermill...@archean.fr>
Subject Re: DNS : RecordStore
Date Wed, 13 Jun 2007 09:27:32 GMT
in 

    /**
     * Returns the raw IP address of this <code>InetAddress</code>
     * object. The result is in network byte order: the highest order
     * byte of the address is in <code>getAddress()[0]</code>.
     *
     * @return  the raw IP address of this object.
     */
    public byte[] getAddress() {
	return null;
    }
Le mercredi 13 juin 2007 à 11:10 +0200, Julien Vermillard a écrit :
> Le mardi 12 juin 2007 à 14:15 -0700, Enrique Rodriguez a écrit :
> > On 6/12/07, Julien Vermillard <jvermillard@archean.fr> wrote:
> > > ...
> > > 1#
> > > In DNS protocol, the RecordStore interface
> > > http://tinyurl.com/2prg84
> > 
> > I added your suggestion, re: generics and some minor Javadocs.  I
> > recently completed a Javadoc run on Kerberos and Change Password and
> > DNS was on my TODO list.  I'll step it up.
> > 
> > > 2#
> > > I made my minimal RecordStore for just resolving few hostname to IP
> > > address. Be carefull, my knowledge of DNS is very low :)
> > >
> > > public Set getRecords(QuestionRecord question) throws Exception
> > >    System.err.println("My store ! : "+question);
> > >    Set<ResourceRecord> set=new HashSet<ResourceRecord>();
> > >    HashMap<String, Object> attr= new HashMap<String, Object>();
> > >    attr.put(DnsAttribute.DOMAIN_NAME,"mydomaine.net");
> > >    attr.put(DnsAttribute.IP_ADDRESS,"192.168.66.66");
> > >    attr.put(DnsAttribute.TYPE,"IN");
> > >    attr.put(DnsAttribute.CLASS,"A");
> > >    ResourceRecord rr=new ResourceRecordImpl("totoz.net",
> > >           RecordType.A,RecordClass.IN,10000,attr);
> > >    set.add(rr);
> > >    return set;
> > > }
> > >
> > > dig report me "corrupted reply".
> > >
> > > Any idea of what I'm doing wrong ?
> > 
> > Just eyeballing it, the only thing in 'attr' should be IP address.
> > The rest is redundant (and domain name conflicts) with the info put
> > into the RR constructor.
> > 
> > What is your dig statement?  If you query for "mydomaine.net" but are
> > returning "totoz.net" that could give you a problem.  With the above
> > code you should be dig'ing:
> > 
> > $ dig totoz.net
> > 
> > and getting "192.168.66.66".
> > 
> > Your reply could also be corrupted if UDP/TCP isn't being handled
> > properly.  Our DNS provider doesn't have TCP support, though it is
> > trivial to add with MINA.  TCP uses a 2-byte pre-pended size, which
> > could be throwing off the client-side decode.
> > 
> > Enrique
> 
> I use a DatagramAcceptor
> 
> I made that test :
> Set<ResourceRecord> set=new HashSet<ResourceRecord>();
> HashMap<String, Object> attr= new HashMap<String, Object>();
> 
> attr.put(DnsAttribute.IP_ADDRESS,"192.168.66.66");
> ResourceRecord rr=new
> ResourceRecordImpl("totoz.net",RecordType.A,RecordClass.IN,10000,attr);
> set.add(rr);
> return set;
> 
> dig result : 
> 
> :~$ dig @192.168.0.228 -p 10053 www.totoz.net
> Warning: Message parser reports malformed message packet.
> 
> ; <<>> DiG 9.3.4 <<>> @192.168.0.228 -p 10053 www.totoz.net
> ; (1 server found)
> ;; global options:  printcmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23978
> ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
> 
> ;; QUESTION SECTION:
> ;www.totoz.net.                 IN      A
> 
> ;; Query time: 11 msec
> ;; SERVER: 192.168.0.228#10053(192.168.0.228)
> ;; WHEN: Wed Jun 13 11:04:24 2007
> ;; 
> 
> The binary dump of query and the reply :
> 
> http://rafb.net/p/Qb1QSm95.html
> 
> Julien
> 
> I'm going to look in the codec, I prolly missed something.
> 
After a little digging in 
ResourceRecordImpl you have :

    public String get( String id )
    {
        return ( String ) attributes.get( id.toLowerCase() );
    }

Which return null for my address, due to the "toLowerCase()".

Julien


Mime
View raw message