; Ask the same question twice. Check to see second is answered
; from cache

server:
	trust-anchor-signaling: no
	target-fetch-policy: "0 0 0 0 0"
	send-client-subnet: 1.2.3.4
	max-client-subnet-ipv4: 17
	module-config: "subnetcache validator iterator"
	verbosity: 3
	qname-minimisation: no
	minimal-responses: no
	ede: yes
	val-log-level: 2
        trust-anchor: "example.nl. DS 50602 8 2 FA8EE175C47325F4BD46D8A4083C3EBEB11C977D689069F2B41F1A29B22446B1"

stub-zone:
	name: "example.nl"
	stub-addr:  1.2.3.4
CONFIG_END

SCENARIO_BEGIN Test subnetcache support for caching EDEs.

; ns.example.com.
RANGE_BEGIN 0 10
	ADDRESS 1.2.3.4
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
example.nl.	IN	DNSKEY
SECTION ANSWER
SECTION ADDITIONAL
	HEX_EDNSDATA_BEGIN
				; client is 127.0.0.1
		00 08 		; OPC
		00 07 		; option length
		00 01 		; Family
		11 00 		; source mask, scopemask
		7f 00 00 	; address
	HEX_EDNSDATA_END
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR AA NOERROR
SECTION QUESTION
example.nl.	IN	A
SECTION ANSWER
example.nl.	IN	A	1.2.3.4
SECTION ADDITIONAL
	HEX_EDNSDATA_BEGIN
				; client is 127.0.0.1
		00 08 		; OPC
		00 07 		; option length
		00 01 		; Family
		11 00 		; source mask, scopemask
		7f 00 00 	; address
	HEX_EDNSDATA_END
ENTRY_END
RANGE_END
			ns.example.com.		IN 	A	1.2.3.4
	ENTRY_END
RANGE_END

; get the entry in cache.
STEP 1 QUERY
ENTRY_BEGIN
REPLY RD DO
SECTION QUESTION
example.nl. IN A
SECTION ADDITIONAL
	HEX_EDNSDATA_BEGIN
		00 08 00 07	; OPC, optlen
		00 01 11 00	; ip4, scope 17, source 0
		7f 00 00   	; 127.0.0.0/17
	HEX_EDNSDATA_END
ENTRY_END

; get the answer for it
STEP 10 CHECK_ANSWER
ENTRY_BEGIN
MATCH all ede=9
REPLY QR RD RA DO SERVFAIL
SECTION QUESTION
example.nl. IN A
ENTRY_END

; query again for the cached entry
STEP 20 QUERY
ENTRY_BEGIN
REPLY RD
SECTION QUESTION
example.nl. IN A
SECTION ADDITIONAL
	HEX_EDNSDATA_BEGIN
		00 08 00 07	; OPC, optlen
		00 01 11 00	; ip4, scope 17, source 0
		7f 00 00   	; 127.0.0.0/17
	HEX_EDNSDATA_END
ENTRY_END

; this must be a cached answer since stub is not answering in this range
STEP 30 CHECK_ANSWER
ENTRY_BEGIN
MATCH all ede=9
REPLY QR RD RA DO SERVFAIL
SECTION QUESTION
example.nl. IN A
ENTRY_END

SCENARIO_END
