Skip to content

Commit

Permalink
Merge pull request grandcat#48 from neilalexander/master
Browse files Browse the repository at this point in the history
Fix appendAddrs behavior for proxy services
  • Loading branch information
grandcat authored Jan 18, 2019
2 parents ce4c7ef + e1b1450 commit c2d1b41
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,15 @@ func (s *Server) unregister() error {
}

func (s *Server) appendAddrs(list []dns.RR, ttl uint32, ifIndex int, flushCache bool) []dns.RR {
var v4, v6 []net.IP
iface, _ := net.InterfaceByIndex(ifIndex)
if iface != nil {
v4, v6 = addrsForInterface(iface)
} else {
v4 = s.service.AddrIPv4
v6 = s.service.AddrIPv6
v4 := s.service.AddrIPv4
v6 := s.service.AddrIPv6
if len(v4) == 0 && len(v6) == 0 {
iface, _ := net.InterfaceByIndex(ifIndex)
if iface != nil {
a4, a6 := addrsForInterface(iface)
v4 = append(v4, a4...)
v6 = append(v6, a6...)
}
}
if ttl > 0 {
// RFC6762 Section 10 says A/AAAA records SHOULD
Expand Down

0 comments on commit c2d1b41

Please sign in to comment.