fix(plugin): prevent panic when ListenHosts is empty (#7565)

This commit is contained in:
Ville Vesilehto
2025-09-19 13:59:37 +03:00
committed by GitHub
parent 051d8d6f05
commit 5532ba8484
3 changed files with 29 additions and 2 deletions

24
test/bind_test.go Normal file
View File

@@ -0,0 +1,24 @@
package test
import "testing"
func TestBind_FilterAll(t *testing.T) {
t.Parallel()
corefile := `.:0 {
bind 127.0.0.1 {
except 127.0.0.1
}
trace
loop
whoami
}`
inst, err := CoreDNSServer(corefile)
if inst != nil {
CoreDNSServerStop(inst)
}
if err == nil {
t.Log("server started; stopping immediately")
} else {
t.Logf("server failed to start as expected without listeners: %v", err)
}
}