diff --git a/wgengine/tsdns/tsdns_test.go b/wgengine/tsdns/tsdns_test.go index 5b3f83c07..22e9cbf72 100644 --- a/wgengine/tsdns/tsdns_test.go +++ b/wgengine/tsdns/tsdns_test.go @@ -593,6 +593,42 @@ var ptrResponse = []byte{ 0x05, 0x74, 0x65, 0x73, 0x74, 0x31, 0x03, 0x69, 0x70, 0x6e, 0x03, 0x64, 0x65, 0x76, 0x00, } +var ptrResponse6 = []byte{ + 0x00, 0x00, // transaction id: 0 + 0x84, 0x00, // flags: response, authoritative, no error + 0x00, 0x01, // one question + 0x00, 0x01, // one answer + 0x00, 0x00, 0x00, 0x00, // no authority or additional RRs + // Question: f.0.e.0.d.0.c.0.b.0.a.0.9.0.8.0.7.0.6.0.5.0.4.0.3.0.2.0.1.0.0.0.ip6.arpa + 0x01, 0x66, 0x01, 0x30, 0x01, 0x65, 0x01, 0x30, + 0x01, 0x64, 0x01, 0x30, 0x01, 0x63, 0x01, 0x30, + 0x01, 0x62, 0x01, 0x30, 0x01, 0x61, 0x01, 0x30, + 0x01, 0x39, 0x01, 0x30, 0x01, 0x38, 0x01, 0x30, + 0x01, 0x37, 0x01, 0x30, 0x01, 0x36, 0x01, 0x30, + 0x01, 0x35, 0x01, 0x30, 0x01, 0x34, 0x01, 0x30, + 0x01, 0x33, 0x01, 0x30, 0x01, 0x32, 0x01, 0x30, + 0x01, 0x31, 0x01, 0x30, 0x01, 0x30, 0x01, 0x30, + 0x03, 0x69, 0x70, 0x36, + 0x04, 0x61, 0x72, 0x70, 0x61, 0x00, + 0x00, 0x0c, 0x00, 0x01, // type PTR, class IN6 + // Answer: f.0.e.0.d.0.c.0.b.0.a.0.9.0.8.0.7.0.6.0.5.0.4.0.3.0.2.0.1.0.0.0.ip6.arpa + 0x01, 0x66, 0x01, 0x30, 0x01, 0x65, 0x01, 0x30, + 0x01, 0x64, 0x01, 0x30, 0x01, 0x63, 0x01, 0x30, + 0x01, 0x62, 0x01, 0x30, 0x01, 0x61, 0x01, 0x30, + 0x01, 0x39, 0x01, 0x30, 0x01, 0x38, 0x01, 0x30, + 0x01, 0x37, 0x01, 0x30, 0x01, 0x36, 0x01, 0x30, + 0x01, 0x35, 0x01, 0x30, 0x01, 0x34, 0x01, 0x30, + 0x01, 0x33, 0x01, 0x30, 0x01, 0x32, 0x01, 0x30, + 0x01, 0x31, 0x01, 0x30, 0x01, 0x30, 0x01, 0x30, + 0x03, 0x69, 0x70, 0x36, + 0x04, 0x61, 0x72, 0x70, 0x61, 0x00, + 0x00, 0x0c, 0x00, 0x01, // type PTR, class IN + 0x00, 0x00, 0x02, 0x58, // TTL: 600 + 0x00, 0x0f, // length: 15 bytes + // PTR: test2.ipn.dev + 0x05, 0x74, 0x65, 0x73, 0x74, 0x32, 0x03, 0x69, 0x70, 0x6e, 0x03, 0x64, 0x65, 0x76, 0x00, +} + var nxdomainResponse = []byte{ 0x00, 0x00, // transaction id: 0 0x84, 0x03, // flags: response, authoritative, error: nxdomain @@ -636,6 +672,8 @@ func TestFull(t *testing.T) { {"no-ipv6", dnspacket("test1.ipn.dev.", dns.TypeAAAA), emptyResponse}, {"upper", dnspacket("TEST1.IPN.DEV.", dns.TypeA), ipv4UppercaseResponse}, {"ptr", dnspacket("4.3.2.1.in-addr.arpa.", dns.TypePTR), ptrResponse}, + {"ptr", dnspacket("f.0.e.0.d.0.c.0.b.0.a.0.9.0.8.0.7.0.6.0.5.0.4.0.3.0.2.0.1.0.0.0.ip6.arpa.", + dns.TypePTR), ptrResponse6}, {"nxdomain", dnspacket("test3.ipn.dev.", dns.TypeA), nxdomainResponse}, }