From: Luis S. <lui...@gm...> - 2008-08-20 11:09:37
|
Hi again, After a better look I think I found this issues: 1 - You added this: "if (rcode == Rcode.NOERROR &&" I don't think this is necessary since in case of a NXDOMAIN error there is not going to be records in the answer section, with the exception of the CNAME records and the DNAME (I think...). 2 - You added this: "if (rcode == Rcode.NXDOMAIN) {" This way you are not treating the NODATA cases. They are considered referrals Regards Luis On Wed, Aug 20, 2008 at 11:50 AM, Luis Silva <lui...@gm...> wrote: > My first impression is that everything is ok. Thanks for the quick reply. > > Kind Regards > Luis > > On Tue, Aug 19, 2008 at 8:17 PM, Brian Wellington <bwe...@xb...>wrote: > >> On Tue, 19 Aug 2008, Luis Silva wrote: >> >> :) Ok sorry for this. The problem is that I sent this email first and got >>> an >>> error and forgot to format the second time. I'm sending you the code in >>> attached. >>> >> >> OK. I think you're correct that a type 4 NXDOMAIN could be cached >> incorrectly. Does the patch below look correct? >> >> Brian >> >> Index: org/xbill/DNS/Cache.java >> =================================================================== >> RCS file: /cvsroot/dnsjava/dnsjava/org/xbill/DNS/Cache.java,v >> retrieving revision 1.116 >> diff -u -r1.116 Cache.java >> --- org/xbill/DNS/Cache.java 5 Dec 2006 01:05:06 -0000 1.116 >> +++ org/xbill/DNS/Cache.java 19 Aug 2008 19:16:56 -0000 >> @@ -628,7 +628,8 @@ >> int type = answers[i].getType(); >> Name name = answers[i].getName(); >> cred = getCred(Section.ANSWER, isAuth); >> - if ((type == qtype || qtype == Type.ANY) && >> + if (rcode == Rcode.NOERROR && >> + (type == qtype || qtype == Type.ANY) && >> name.equals(curname)) >> { >> addRRset(answers[i], cred); >> @@ -679,14 +680,13 @@ >> } >> if (!completed) { >> /* This is a negative response or a referral. */ >> - int cachetype = (rcode == Rcode.NXDOMAIN) ? 0 : qtype; >> - if (soa != null || ns == null) { >> + if (rcode == Rcode.NXDOMAIN) { >> /* Negative response */ >> cred = getCred(Section.AUTHORITY, isAuth); >> SOARecord soarec = null; >> if (soa != null) >> soarec = (SOARecord) soa.first(); >> - addNegative(curname, cachetype, soarec, cred); >> + addNegative(curname, 0, soarec, cred); >> if (response == null) { >> int responseType; >> if (rcode == Rcode.NXDOMAIN) >> @@ -695,8 +695,8 @@ >> responseType = SetResponse.NXRRSET; >> response = >> SetResponse.ofType(responseType); >> } >> - /* NXT records are not cached yet. */ >> - } else { >> + /* DNSSEC records are not cached. */ >> + } else if (ns != null) { >> >> /* Referral response */ >> cred = getCred(Section.AUTHORITY, isAuth); >> addRRset(ns, cred); >> > > |