avoid a potential crash

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-10 03:42:48 +00:00
parent d6f15e9e22
commit e476e50d48
1 changed files with 7 additions and 0 deletions

View File

@ -64,6 +64,13 @@ func HandleConnection(conn *net.TCPConn) {
log.Println("Recieved client hostname as:", clientHostname)
dnsRR := Dnstrace(clientHostname, "AAAA")
if (dnsRR == nil) {
log.Println("dnsRR IS NIL")
log.Println("dnsRR IS NIL")
log.Println("dnsRR IS NIL")
conn.Close()
return
}
ipaddr := dns.Field(dnsRR, 1)
log.Println("Client claims to be: ", ipaddr)
log.Println("Serving to IPv6 client:", ipv6client)