dnsforward/ipset: add support for wildcard subdomain ipset matches

This matches dnsmasq behavior and the alternative is not really useful.
See http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=src/forward.c;hb=f60fea1fb0a288011f57a25dfb653b8f6f8b46b9#l588
This commit is contained in:
David Sheets
2020-10-06 16:45:11 +01:00
parent 2db79bf7ec
commit a93c6b6775
2 changed files with 42 additions and 1 deletions

View File

@@ -158,6 +158,22 @@ func TestIpsetSubdomainOverride(t *testing.T) {
assert.Equal(t, 1, len(b))
}
func TestIpsetSubdomainWildcard(t *testing.T) {
setup()
ctx.proxyCtx.Req = makeReqA("sub.host.com.")
ctx.proxyCtx.Res = &dns.Msg{
Answer: []dns.RR{
makeA("sub.host.com.", net.IPv4(127, 0, 0, 1)),
},
}
doProcess(t)
assert.Equal(t, 1, b[Binding{"sub.host.com", "name", "127.0.0.1"}])
assert.Equal(t, 1, len(b))
}
func TestIpsetCnameThirdParty(t *testing.T) {
setup()