* DNS: set default blocking mode to Null IP for A/AAAA, empty response for others
Close #1914 Squashed commit of the following: commit cb127a9a409b2f228848fb838535f3db6e9d32a9 Author: Simon Zolin <s.zolin@adguard.com> Date: Fri Oct 2 12:37:11 2020 +0300 return empty response if not A/AAAA qtype commit 175a736d7d69619022db92a9250c382ad7fc9996 Author: Simon Zolin <s.zolin@adguard.com> Date: Fri Oct 2 12:21:51 2020 +0300 fix commit 03aab89d2da00ede3aad6eb5a5bb2d545444a186 Author: Simon Zolin <s.zolin@adguard.com> Date: Fri Oct 2 12:18:11 2020 +0300 fix tests commit 4225d511df910aae2df4651231c01a8a13bb937f Author: Simon Zolin <s.zolin@adguard.com> Date: Fri Oct 2 12:02:11 2020 +0300 * DNS: set default blocking mode to Null IP for A/AAAA, NXDOMAIN for others
This commit is contained in:
@@ -267,7 +267,7 @@ func TestBlockedRequest(t *testing.T) {
|
||||
addr := s.dnsProxy.Addr(proxy.ProtoUDP)
|
||||
|
||||
//
|
||||
// Default blocking - REFUSED
|
||||
// Default blocking - NULL IP
|
||||
//
|
||||
req := dns.Msg{}
|
||||
req.Id = dns.Id()
|
||||
@@ -280,7 +280,8 @@ func TestBlockedRequest(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Couldn't talk to server %s: %s", addr, err)
|
||||
}
|
||||
assert.Equal(t, dns.RcodeRefused, reply.Rcode)
|
||||
assert.Equal(t, dns.RcodeSuccess, reply.Rcode)
|
||||
assert.True(t, reply.Answer[0].(*dns.A).A.Equal(net.ParseIP("0.0.0.0")))
|
||||
|
||||
err = s.Stop()
|
||||
if err != nil {
|
||||
@@ -442,7 +443,8 @@ func TestBlockCNAME(t *testing.T) {
|
||||
req := createTestMessage("badhost.")
|
||||
reply, err := dns.Exchange(req, addr.String())
|
||||
assert.Nil(t, err, nil)
|
||||
assert.Equal(t, dns.RcodeRefused, reply.Rcode)
|
||||
assert.Equal(t, dns.RcodeSuccess, reply.Rcode)
|
||||
assert.True(t, reply.Answer[0].(*dns.A).A.Equal(net.ParseIP("0.0.0.0")))
|
||||
|
||||
// 'whitelist.example.org' has a canonical name 'null.example.org' which is blocked by filters
|
||||
// but 'whitelist.example.org' is in a whitelist:
|
||||
@@ -457,7 +459,8 @@ func TestBlockCNAME(t *testing.T) {
|
||||
req = createTestMessage("example.org.")
|
||||
reply, err = dns.Exchange(req, addr.String())
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, dns.RcodeRefused, reply.Rcode)
|
||||
assert.Equal(t, dns.RcodeSuccess, reply.Rcode)
|
||||
assert.True(t, reply.Answer[0].(*dns.A).A.Equal(net.ParseIP("0.0.0.0")))
|
||||
|
||||
_ = s.Stop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user