Skip to content

net: LookupIP("doesnotexist.domain") returns "server misbehaving" when resolv.conf contains search lists #12712

Closed
@mbenkmann

Description

@mbenkmann

The following test program returns "lookup doesnotexist.domain: no such host" when run with https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz but returns "lookup doesnotexist.domain on 172.16.2.203:53: server misbehaving" with https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz and https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz

package main

import "net"
import "fmt"

func main() {
  _, err := net.LookupIP("doesnotexist.domain")
  fmt.Println(err)
}

When I change resolv.conf to use nameserver 8.8.8.8 the output is correct. Apparently something has changed in Go 1.5 that prevents it from understanding the reply from our internal DNS server.

nslookup does not have a problem:

> nslookup doesnotexist.domain 172.16.2.203
Server:         172.16.2.203
Address:        172.16.2.203#53

** server can't find doesnotexist.domain: NXDOMAIN

> nslookup doesnotexist.domain 8.8.8.8
Server:         8.8.8.8
Address:        8.8.8.8#53

** server can't find doesnotexist.domain: NXDOMAIN

dig also has no problem

> dig @172.16.2.203 doesnotexist.domain
; <<>> DiG 9.9.5-3ubuntu0.4-Ubuntu <<>> @172.16.2.203 doesnotexist.domain
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 37809
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;doesnotexist.domain.               IN      A

;; AUTHORITY SECTION:
.                   1200    IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2015092200 1800 900 604800 86400

;; Query time: 2 msec
;; SERVER: 172.16.2.203#53(172.16.2.203)
;; WHEN: Tue Sep 22 13:13:11 CEST 2015
;; MSG SIZE  rcvd: 123

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions