libnetwork: ServeDNS(): don't panic on unsupported query types

This was added in b3c883bb2f, but resulted
in a panic if the embedded DNS had to handle an unsupported query-type,
such as ANY.

This patch adds a debug log for this case (to better describe how it's
handled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-10-13 11:57:26 +02:00
parent 4e6dbb3f5c
commit 9a09448540
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -384,7 +384,8 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
case dns.TypeSRV:
resp, err = r.handleSRVQuery(name, query)
default:
panic("error")
queryType := dns.TypeToString[query.Question[0].Qtype]
logrus.Debugf("[resolver] query type %s is not supported by the embedded DNS and will be forwarded to external DNS", queryType)
}
if err != nil {