Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

return NXDOMAIN instead of NOTIMP #589

Merged
merged 1 commit into from
May 6, 2015
Merged

Conversation

inercia
Copy link
Contributor

@inercia inercia commented Apr 22, 2015

Fixes #588 by returning NOTIMP for some unimplemented query types, NXDOMAIN otherwise

@rade
Copy link
Member

rade commented Apr 22, 2015

wouldn't it have been easier to list the query types that we do implement?

@rade
Copy link
Member

rade commented Apr 22, 2015

also, you should use the canonical set representation (#518).

@rade
Copy link
Member

rade commented Apr 22, 2015

Hmm. querying the weave.works domain, I have yet to find a query type that doesn't result in an NXDOMAIN. Perhaps that is what DNS servers typically do? How did you come up with the list of unimplemented types?

@inercia
Copy link
Contributor Author

inercia commented Apr 22, 2015

I haven't found much information on when to return NOTIMP, just this RFC that recommends using it for rejecting ANY queries... I will reduce the set to just this query type...

@inercia inercia force-pushed the weave-588 branch 2 times, most recently from a99ae96 to 95e8b1a Compare April 23, 2015 11:30
@rade
Copy link
Member

rade commented Apr 24, 2015

That RFC is a very recent draft. So it's rather flimsy evidence.

Is NXDOMAIN a valid response for all query types?

The duplication between queryHandler and rdnsHandler is getting out of hand.

@inercia
Copy link
Contributor Author

inercia commented Apr 24, 2015

We have two options: a) we can just reply with NXDOMAIN for all query types or b) reply with NOTIMPL to ANY queries. I think the safest option is a), but it is up to you @rade

@inercia inercia assigned rade and unassigned inercia Apr 24, 2015
@rade
Copy link
Member

rade commented Apr 24, 2015

I am fine with (a), provided NXDOMAIN is a valid response for all query types. Is it?

@inercia
Copy link
Contributor Author

inercia commented Apr 24, 2015

From my understanding of the DNS RFC, I think NXDOMAIN is the general error code (unless otherwise specified). The only documented evidence of the need of NOTIMP is that draft RFC...

@rade
Copy link
Member

rade commented Apr 24, 2015

ok. In which case let's just go with NXDOMAIN for everything.

Would be good to add a smoke tests that checks for the (absence of) the behaviour I reported in #588.

Re the the duplication between queryHandler and rdnsHandler, I can take a stab at that after this has been merged.

@rade rade assigned inercia and unassigned rade Apr 24, 2015
@awh
Copy link
Contributor

awh commented Apr 28, 2015

Just want to confirm my understanding of what we've decided needs to be done for this PR - I think it becomes a one line change to return NXDOMAIN instead of NOTIMP, and a smoke test to that effect?

@inercia
Copy link
Contributor Author

inercia commented Apr 28, 2015

@awh Yes, returning NXDOMAIN instead of NOTIMP is trivial... no idea of what the smoke test would involve though...

@awh
Copy link
Contributor

awh commented Apr 28, 2015

no idea of what the smoke test would involve though...

Something that simply asserts that NXDOMAIN is in fact returned for query types we don't handle should suffice...

@rade
Copy link
Member

rade commented Apr 28, 2015

you could just run what's in #588, asserting that you get only get one line as an answer / get no NOTIMPs.

@rade
Copy link
Member

rade commented May 4, 2015

@inercia ping

@inercia
Copy link
Contributor Author

inercia commented May 5, 2015

@rade Just updated, with some integration tests now...

@rade rade assigned awh and unassigned inercia May 5, 2015
@rade
Copy link
Member

rade commented May 5, 2015

Hmm. Do we have to use dig? All of the other tests use getent.

@inercia
Copy link
Contributor Author

inercia commented May 5, 2015

I'm afraid we can't: getent is just a frontend to the resolver database, so it does not return low-level return codes obtained from the DNS queries (eg, NXDOMAIN). (in fact, I'm not sure it is a good thing to do in these tests...)

@rade
Copy link
Member

rade commented May 5, 2015

getent does not return low-level return codes obtained from the DNS queries (eg, NXDOMAIN)

Well, as you can see from #588, it does return some error codes, but ignores NXDOMAIN. No idea whether that's a feature of the resolver library or getent.

I'm not sure [using the resolver library] is a good thing to do in these tests

The smoke tests are meant to operate at a very high level, close to what we expect users/applications to do. Few users/apps query DNS directly; they go through the resolver library. Hence getent is preferable to dig. Except of course when it can't test what we want. So if we really want to check that NXDOMAIN gets returned, I guess we are stuck with using dig.

@rade
Copy link
Member

rade commented May 5, 2015

The code still returns NOTIMP for ANY queries. I thought we had agreed we'd always return NXDOMAIN.

assert_dig_on() {
ok=$(dig_on "$1" "$2" "+short $3")
assert "echo $ok" "$4"
}

This comment was marked as abuse.

# assert_dns_status <host> <container> <name> <query> <status>
assert_dns_status() {
res=$(dig_on "$1" "$2" "$3" | grep -q "status: $4" && echo "FOUND")
assert "echo $res" "FOUND"

This comment was marked as abuse.

@inercia
Copy link
Contributor Author

inercia commented May 5, 2015

I thought we had agreed to return NOTIMP on ANY queries... anyway, I will remove anything that has to do with NOTIMP

@rade rade changed the title Return NOTIMP for some unimplemented query types, NXDOMAIN otherwise return NXDOMAIN instead of NOTIMP May 6, 2015
@rade rade assigned rade and unassigned awh May 6, 2015
rade added a commit that referenced this pull request May 6, 2015
return NXDOMAIN instead of NOTIMP

Fixes #588.
@rade rade merged commit efd704c into weaveworks:master May 6, 2015
@rade rade modified the milestone: 0.11.0 May 12, 2015
@inercia inercia deleted the weave-588 branch June 9, 2015 12:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dns] return NXDOMAIN instead of NOTIMP for most query types
3 participants