; config options
server:
	edns-client-string: 10.0.0.0/24 "abc d"
	outbound-msg-retry: 1

stub-zone:
	name: "edns-string-abc."
	stub-addr: 10.0.0.3
	stub-first: yes

forward-zone:
	name: "."
	forward-addr: 10.0.0.1

CONFIG_END

SCENARIO_BEGIN Test that upstream specific EDNS is attached once; uses string tag option

RANGE_BEGIN 0 1000
	ADDRESS 10.0.0.3
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR SERVFAIL
SECTION QUESTION
edns-string-abc. IN A
ENTRY_END
RANGE_END

RANGE_BEGIN 0 1000
	ADDRESS 10.0.0.1
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
edns-string-abc. IN A
SECTION ANSWER
edns-string-abc. IN A 10.20.30.40
SECTION ADDITIONAL
ENTRY_END
RANGE_END

STEP 10 QUERY
ENTRY_BEGIN
REPLY RD
SECTION QUESTION
edns-string-abc. IN A
ENTRY_END

; This will receive SERVFAIL and the next address will be queried
STEP 20 CHECK_OUT_QUERY ADDRESS  10.0.0.3
ENTRY_BEGIN
MATCH qname qtype opcode ednsdata
SECTION QUESTION
edns-string-abc. IN A
SECTION ADDITIONAL
	HEX_EDNSDATA_BEGIN
		fd e9           ; Opcode 65001
		00 05           ; Length 5
		61 62 63 20 64  ; "abc d"
	HEX_EDNSDATA_END
ENTRY_END

; This will receive the answer; makes sure that EDNS is attached once
STEP 22 CHECK_OUT_QUERY ADDRESS  10.0.0.1
ENTRY_BEGIN
MATCH qname qtype opcode ednsdata
SECTION QUESTION
edns-string-abc. IN A
SECTION ADDITIONAL
	HEX_EDNSDATA_BEGIN
		fd e9           ; Opcode 65001
		00 05           ; Length 5
		61 62 63 20 64  ; "abc d"
	HEX_EDNSDATA_END
ENTRY_END


STEP 30 CHECK_ANSWER
ENTRY_BEGIN
MATCH all
REPLY QR RD RA NOERROR
SECTION QUESTION
edns-string-abc. IN A
SECTION ANSWER
edns-string-abc. IN A 10.20.30.40
ENTRY_END

SCENARIO_END
