From 8f9d5dbdbe081ec23367413ac3f4ef47d03ef610 Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Wed, 4 Oct 2017 13:09:12 +0800 Subject: [PATCH] Fix ECS serialization --- json-dns/marshal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json-dns/marshal.go b/json-dns/marshal.go index 9e45c2a..5df0b38 100644 --- a/json-dns/marshal.go +++ b/json-dns/marshal.go @@ -82,7 +82,7 @@ func Marshal(msg *dns.Msg) *Response { if clientAddress == nil { clientAddress = net.IPv4(0, 0, 0, 0) } - scopeMask := net.CIDRMask(int(edns0.SourceScope), len(edns0.Address)) + scopeMask := net.CIDRMask(int(edns0.SourceScope), len(clientAddress)) resp.EdnsClientSubnet = clientAddress.Mask(scopeMask).String() + "/" + strconv.Itoa(int(edns0.SourceScope)) } }