Changed to accept a CIDR address and use net.IP

* In general we'll have an IP address and a subnet mask for the weave
   network address; account for this in the zone DB and in the HTTP
   server.

 * Use the net.IP type rather than string, which gives us a bit more
   generality (in theory it'll deal with Ipv6 too) and validation (we
   attempt to parse the input)
This commit is contained in:
Michael Bridgen committed 2014-10-07 12:49:52 +01:00
1 parent e7ac6dafb3
commit e8e86dadc0
3 files changed
+27 -23

No files matched your search

+2 -2
View File
@@ -38,7 +38,7 @@ func handleMDNS(w dns.ResponseWriter, r *dns.Msg) {
q := r.Question[0]
ip, err := zone.MatchLocal(q.Name)
if err == nil {
m := makeDNSReply(r, q.Name, net.ParseIP(ip))
m := makeDNSReply(r, q.Name, ip)
mdnsClient.SendResponse(m)
} else if mdnsClient.IsInflightQuery(r) {
// ignore this - it's our own query received via multicast
@@ -53,7 +53,7 @@ func handleLocal(w dns.ResponseWriter, r *dns.Msg) {
q := r.Question[0]
ip, err := zone.MatchLocal(q.Name)
if err == nil {
m := makeDNSReply(r, q.Name, net.ParseIP(ip))
m := makeDNSReply(r, q.Name, ip)
w.WriteMsg(m)
} else {
log.Printf("Failed lookup for %s; sending mDNS query", q.Name)