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)) } }