From: Sreenivasa M. <mul...@ho...> - 2006-10-26 19:26:54
|
Hello Brain, Here is the entry The SOA is 195.187.24.in-addr.arpa IN SOA lab-a.lab.test.net. abuse.test.net. ( 2006101700 ; serial 7200 ; refresh (2 hours) 600 ; retry (10 minutes) 604800 ; expire (1 week) 86400 ; minimum (1 day) ) Here are some sample entries 1 PTR ool-18bbc301.static.goog.net. 10 PTR ool-18bbc30a.static.goog.net. 100 PTR ool-18bbc364.static.goog.net. 101 PTR ool-18bbc365.static.goog.net. 102 PTR ool-18bbc366.static.goog.net. Could you please tell me what I should be doing wrong. For me record is not getting created in the first place. It is returning null. When I try to debug there is a exception like wireparseexception below Here is the data I am passing [-61, -69, -61, 1] in byte array. public Name(DNSInput in) throws WireParseException { int len, pos, currentpos; Name name2; boolean done = false; byte [] label = new byte[MAXLABEL + 1]; boolean savedState = false; while (!done) { len = in.readU8(); switch (len & LABEL_MASK) { case LABEL_NORMAL: if (getlabels() >= MAXLABELS) throw new WireParseException("too many labels"); if (len == 0) { append(emptyLabel, 0, 1); done = true; } else { label[0] = (byte)len; in.readByteArray(label, 1, len); append(label, 0, 1); } break; case LABEL_COMPRESSION: pos = in.readU8(); pos += ((len & ~LABEL_MASK) << 8); if (Options.check("verbosecompression")) System.err.println("currently " + in.current() + ", pointer to " + pos); if (pos >= in.current()) throw new WireParseException("bad compression"); When I do a nsupdate and works for these 1.195.187.24.in-addr.arpa 600 IN PTR www.junk.com. Thanks in advance -Sri >From: Brian Wellington <bwe...@xb...> >To: Sreenivasa Mulakala <mul...@ho...> >CC: dns...@li... >Subject: Re: DNSJAVA Help >Date: Thu, 26 Oct 2006 11:01:45 -0700 (PDT) > >On Thu, 26 Oct 2006, Sreenivasa Mulakala wrote: > >>I am having trouble in adding a row to DNS which is BIND 9.2.5. >> >>I am able to ping the server. >> >>When I run the program which is below. Nothing goes on to wire atleast. >>The >>code is not contacting the server for update or add. >> >>Could you please advice me on what could be wrong. >> >>Thanks & Regards >>Sri >> >> System.setProperty("sun.net.spi.nameservice.nameservers","192.168.2.3"); >> System.setProperty("sun.net.spi.nameservice.provider.1", "dns,sun"); >> System.setProperty("sun.net.spi.nameservice.provider.2", "dns,dnsjava"); >> >> >> >> public Record addDNSEntry(String zone, int dnsClass, long ttl, String >>ipAddress ){ >> String = "ool-18bbc301.arpa.net." >> >> Message msg = new Message(); >> Record record = null; >> >> try{ >> System.out.println("Trying to update the record"); >> >> byte[] ipaddressbytearray = Address.toByteArray("195.187.24.1", >>Address.IPv4); >> >> >> record = Record.newRecord(new Name(zone), Type.A, DClass.IN, ttl, >>ipaddressbytearray.length, ipaddressbytearray); >> >> msg.addRecord(record,Section.ADDITIONAL); >> log.info("The Entry is updated"); >> }catch(TextParseException tpe){ >> log.error(" OOOPs In TextParseException of add DNS entry : "); >> log.error(tpe.getMessage()); >> }catch(Exception ioe){ >> log.error("OOPS In Exception of add DNS entry : "); >> log.error(ioe.getMessage()); >> } >> return record; >> } > >You're building a message and never sending it. See the example of using >dynamic update at http://www.dnsjava.org/examples.html. > >Brian |