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

resolver/dns: error if target ends with a colon instead of assuming the default port #2150

Merged
merged 3 commits into from
Jun 22, 2018

Conversation

dfawley
Copy link
Member

@dfawley dfawley commented Jun 14, 2018

Technically this is a behavior change, but any usage of "host:" or ":" should be considered invalid, since dialing a target with a trailing ":" attempts to dial port zero, which is never valid (and we always used to pass the target directly to net.Dial).

In grpc/grpc#15618, the target format will be defined as: host[:port] -- not: host[:[port]]. (This is potentially subject to change.)

@dfawley dfawley added the Type: Behavior Change Behavior changes not categorized as bugs label Jun 14, 2018
@dfawley dfawley requested a review from lyuxuan June 14, 2018 16:46
@@ -51,7 +51,8 @@ const (
)

var (
errMissingAddr = errors.New("missing address")
errMissingAddr = errors.New("dns resolver: missing address")
errEndsWithColon = errors.New("dns resolver: address ends with colon")
Copy link
Contributor

Choose a reason for hiding this comment

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

"::" also ends with colon but it is a valid case.
I think more explanation will be better, may be just add a comment above the definition, like "address ending with a colon that is supposed to be the separator between host and port is not allowed. e.g. "::" is a valid address as it is an IPv6 address(host only) and [::]: is invalid as it ends with a colon as the host and port separator.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated error and added comment. PTAL

@dfawley dfawley merged commit 0c16dc1 into grpc:master Jun 22, 2018
@dfawley dfawley deleted the dns_default_port branch June 25, 2018 16:50
@dfawley dfawley added this to the 1.14 Release milestone Jun 28, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Dec 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Behavior Change Behavior changes not categorized as bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants