Skip to content

iterator: correctly handle cases of EDNS version != 0.

menakite requested to merge menakite/knot-resolver:badvers into master

Answer with rcode BADVERS if the requested EDNS version is not supported by libknot.

RFC 6891: [...] If a responder does not implement the VERSION level of the request, then it MUST respond with RCODE=BADVERS [...]

Fixes #404

Before (note the EDNS version mismatch):

$ kdig +edns=1 soa cz @::1
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 31712
;; Flags: qr rd ra ad; QUERY: 1; ANSWER: 1; AUTHORITY: 0; ADDITIONAL: 1

;; EDNS PSEUDOSECTION:
;; Version: 0; flags: ; UDP size: 1232 B; ext-rcode: NOERROR

;; QUESTION SECTION:
;; cz.                 		IN	SOA

;; ANSWER SECTION:
cz.                 	3562	IN	SOA	a.ns.nic.cz. hostmaster.nic.cz. 1724719720 900 300 604800 900

;; Received 87 B
;; Time 2024-08-27 03:02:04 CEST
;; From ::1@53(UDP) in 0.7 ms

After:

$ kdig +edns=1 soa cz @::1
;; ->>HEADER<<- opcode: QUERY; status: BADVERS; id: 42880
;; Flags: qr rd ra ad; QUERY: 1; ANSWER: 0; AUTHORITY: 0; ADDITIONAL: 1

;; EDNS PSEUDOSECTION:
;; Version: 0; flags: ; UDP size: 1232 B; ext-rcode: BADVERS

;; QUESTION SECTION:
;; cz.                 		IN	SOA

;; Received 31 B
;; Time 2024-08-27 03:04:38 CEST
;; From ::1@53(UDP) in 0.7 ms
Edited by menakite

Merge request reports