mirror of
https://github.com/coredns/coredns.git
synced 2025-11-11 14:32:25 -05:00
Add missing test file and fix notify
We should not check the port of the request, we *should* actually normalize it to port 53 - as that will probably be the address of the server. Still need to double check if this will work if the axfr should actually be done from a different port. That will come later, this is good enough for now.
This commit is contained in:
@@ -19,7 +19,7 @@ func (z *Zone) isNotify(state middleware.State) bool {
|
||||
if len(z.TransferFrom) == 0 {
|
||||
return false
|
||||
}
|
||||
remote := state.RemoteAddr()
|
||||
remote := middleware.Addr(state.IP()).Normalize()
|
||||
for _, from := range z.TransferFrom {
|
||||
if from == remote {
|
||||
return true
|
||||
|
||||
@@ -138,11 +138,11 @@ func TestIsNotify(t *testing.T) {
|
||||
// need to set opcode
|
||||
state.Req.Opcode = dns.OpcodeNotify
|
||||
|
||||
z.TransferFrom = []string{"10.240.0.1:40212"} // IP from from testing/responseWriter
|
||||
z.TransferFrom = []string{"10.240.0.1:53"} // IP from from testing/responseWriter
|
||||
if !z.isNotify(state) {
|
||||
t.Fatal("should have been valid notify")
|
||||
}
|
||||
z.TransferFrom = []string{"10.240.0.2:40212"}
|
||||
z.TransferFrom = []string{"10.240.0.2:53"}
|
||||
if z.isNotify(state) {
|
||||
t.Fatal("should have been invalid notify")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user