plugin/{forward,proxy}: check for truncated (#1644)

Check for trunacted in the lookup function as well and use the Match
function here as well.
This commit is contained in:
Miek Gieben
2018-03-31 15:31:03 +01:00
committed by GitHub
parent f19a3b24ca
commit fd1501e918
4 changed files with 40 additions and 16 deletions

View File

@@ -31,15 +31,22 @@ func (f *Forward) Forward(state request.Request) (*dns.Msg, error) {
}
ret, err := proxy.connect(context.Background(), state, f.forceTCP, true)
ret, err = truncated(ret, err)
if err != nil {
if fails < len(f.proxies) {
continue
}
break
}
return ret, nil
// Check if the reply is correct; if not return FormErr.
if !state.Match(ret) {
return state.ErrorMessage(dns.RcodeFormatError), nil
}
return ret, err
}
return nil, errNoHealthy
}