Skip to content

Commit

Permalink
Merge pull request #57 from supertypo/alpine-musl-workaround
Browse files Browse the repository at this point in the history
Work around for Alpine (Musl)...
  • Loading branch information
tiram88 authored Jul 14, 2023
2 parents 46bc5cc + 9adc21f commit 96d4f1f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"fmt"
"github.com/kaspanet/kaspad/app/appmessage"
"net"
"os"
"strings"
Expand Down Expand Up @@ -178,6 +179,10 @@ func (d *DNSServer) buildDNSResponse(addr *net.UDPAddr, authority dns.RR, dnsMsg
respMsg.Ns = append(respMsg.Ns, authority)
addrs := amgr.GoodAddresses(qtype, includeAllSubnetworks, subnetworkID)
log.Infof("%s: Sending %d addresses", addr, len(addrs))
if len(addrs) == 0 && qtype == dns.TypeAAAA {
// Musl (Alpine) requires non-empty result (work-around):
addrs = append(addrs, appmessage.NewNetAddressIPPort(net.ParseIP("100::"), uint16(0)))
}
for _, a := range addrs {
rr := fmt.Sprintf("%s 30 IN %s %s", dnsMsg.Question[0].Name, atype, a.IP.String())
newRR, err := dns.NewRR(rr)
Expand Down

0 comments on commit 96d4f1f

Please sign in to comment.