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

clientconn: set dial target "Authority" with target address #2650

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
13 changes: 13 additions & 0 deletions clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,19 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
Metadata: addr.Metadata,
Authority: ac.cc.authority,
}
if target.Addr != target.Authority {
target.Authority = target.Addr

// When user dials with "grpc.WithDialer", "grpc.DialContext" "cc.parsedTarget"
// update only happpens once. This is problematic, because when TLS is enabled,
// retries happen through "grpc.WithDialer" with static "cc.parsedTarget" from
// the initial dial call.
// If the server authenticates by IP addresses, we want to set a new endpoint as
// a new authority. Otherwise
// "transport: authentication handshake failed: x509: certificate is valid for 127.0.0.1, 192.168.154.254, not 192.168.208.149"
// when the new dial target is "192.168.154.254" whose certificate host name is also "192.168.154.254"
// but client tries to authenticate with previously set "cc.parsedTarget" field "192.168.208.149"
}

prefaceTimer := time.NewTimer(time.Until(connectDeadline))

Expand Down