Skip to content

Conversation

mikitsu
Copy link

@mikitsu mikitsu commented Aug 24, 2025

The new disable-ipv4 option operates completely analogously to the existing disable-ipv6 option: A records are discarded from answers.

This feature is useful on IPv6-only hosts with misbehaving applications that only attempt one connection using the first DNS answer.

Copy link

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

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

💡 To request another review, post a new comment with "/windsurf-review".

// haltA halts the processing of A requests if IPv4 is disabled. req must
// not be nil.
func (h *Default) haltA(ctx context.Context, req *dns.Msg) (resp *dns.Msg) {
if h.isIPv4Halted && req.Question[0].Qtype == dns.TypeA {
Copy link

Choose a reason for hiding this comment

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

This code could panic if req.Question is empty. Consider adding a check to ensure len(req.Question) > 0 before accessing req.Question[0].

Copy link
Author

Choose a reason for hiding this comment

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

Shouldn't be a problem, as semantically, queries have a question, and in fact the existing IPv6-specific code (which I copy-pasted from) also doesn't include a check.

The new disable-ipv4 option operates completely analogously to the existing disable-ipv6 option:
A records are discarded from answers.

This feature is useful on IPv6-only hosts with misbehaving applications
that only attempt one connection using the first DNS answer.
@mikitsu mikitsu force-pushed the add-disable-ipv4-option branch from fc6c04c to 5b00a12 Compare August 24, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant