mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
middleware/secondary: multiple fixes (#745)
Fix transferring the zone from a master and the matching of notifies to source and dst IP addresses. Add `upstream` keyword as well, because it is needed for the same reasons as in the *file* middlware. Add some dire warning about upstream in the readme of both middlewares. Out of band testing, hidden by net build tag was added. Integration testing still needs to be setup.
This commit is contained in:
@@ -3,8 +3,8 @@ package file
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
|
||||
"github.com/coredns/coredns/middleware"
|
||||
"github.com/coredns/coredns/middleware/pkg/rcode"
|
||||
"github.com/coredns/coredns/request"
|
||||
|
||||
@@ -21,8 +21,13 @@ func (z *Zone) isNotify(state request.Request) bool {
|
||||
if len(z.TransferFrom) == 0 {
|
||||
return false
|
||||
}
|
||||
remote := middleware.Addr(state.IP()).Normalize()
|
||||
for _, from := range z.TransferFrom {
|
||||
// If remote IP matches we accept.
|
||||
remote := state.IP()
|
||||
for _, f := range z.TransferFrom {
|
||||
from, _, err := net.SplitHostPort(f)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if from == remote {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user