diff --git a/pkg/transport/listener_tls.go b/pkg/transport/listener_tls.go index ecc12454899..5d1a9cd44cb 100644 --- a/pkg/transport/listener_tls.go +++ b/pkg/transport/listener_tls.go @@ -142,7 +142,11 @@ func checkCert(ctx context.Context, cert *x509.Certificate, remoteAddr string) e return herr } if len(cert.IPAddresses) > 0 { - if cerr := cert.VerifyHostname(h); cerr != nil && len(cert.DNSNames) == 0 { + cerr := cert.VerifyHostname(h) + if cerr == nil { + return nil + } + if len(cert.DNSNames) == 0 { return cerr } }