Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect udp_answer_limit parameter even if UDP payload size is not 512 #3356

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ func trimUDPResponse(config *DNSConfig, req, resp *dns.Msg) (trimmed bool) {

// This cuts UDP responses to a useful but limited number of responses.
maxAnswers := lib.MinInt(maxUDPAnswerLimit, config.UDPAnswerLimit)
if maxSize == defaultMaxUDPSize && numAnswers > maxAnswers {
if numAnswers > maxAnswers {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea here is that, if request is edns and the size has changed from the default max size, we don't want to trim the answers or else they will be truncated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sethvargo I'm not sure to understand what you mean. Would you have an example?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can try "+bufsize=512" with dig , because the dig may not build with edns.

resp.Answer = resp.Answer[:maxAnswers]
if hasExtra {
syncExtra(index, resp)
Expand Down