--- a/cmvr-es/service/quic_edge/src/msquic_transport.cpp +++ b/cmvr-es/service/quic_edge/src/msquic_transport.cpp @@ -75,6 +75,7 @@ { disconnect(); QUIC_STATUS status = QUIC_STATUS_SUCCESS; + const char* connect_operation = "ConnectionOpen/Start"; { // Configuration creation and connection publication are one API // operation. A concurrent disconnect can therefore never close a @@ -112,20 +113,40 @@ const std::string& server_name = config.tls().allow_insecure() || config.tls().server_name().empty() ? config.server_host() : config.tls().server_name(); + // Pin the network destination independently of the TLS identity. + // Same-name/IP configurations retain the original MsQuic path. + if (server_name != config.server_host()) { + QUIC_ADDR remote_address{}; + if (!QuicAddrFromString(config.server_host().c_str(), + static_cast(config.server_port()), + &remote_address)) { + connect_operation = "server_host must be a literal IPv4/IPv6 address when tls.server_name differs"; + status = QUIC_STATUS_INVALID_PARAMETER; + } else { + connect_operation = "SetParam(REMOTE_ADDRESS)"; + status = api_->SetParam(opened_connection, + QUIC_PARAM_CONN_REMOTE_ADDRESS, + static_cast(sizeof(remote_address)), + &remote_address); + } + } CMVR_LOG(INFO) << "[MsQuicTransport] ConnectionStart" << ", connect_host=" << server_name << ", configured_server_host=" << config.server_host() << ", port=" << config.server_port() << ", ca_file=" << config.tls().ca_file() << ", allow_insecure=" << config.tls().allow_insecure(); - status = api_->ConnectionStart( - opened_connection, configuration_, QUIC_ADDRESS_FAMILY_UNSPEC, - server_name.c_str(), - static_cast(config.server_port())); + if (QUIC_SUCCEEDED(status)) { + connect_operation = "ConnectionStart"; + status = api_->ConnectionStart( + opened_connection, configuration_, QUIC_ADDRESS_FAMILY_UNSPEC, + server_name.c_str(), + static_cast(config.server_port())); + } } } if (QUIC_FAILED(status)) { - setError(error, statusText("ConnectionOpen/Start", status)); + setError(error, statusText(connect_operation, status)); closeConnectionHandles(); return false; } --- a/cmvr-es/config/tasks/quic_edge_task/quic_edge_task.pb.txt +++ b/cmvr-es/config/tasks/quic_edge_task/quic_edge_task.pb.txt @@ -25,7 +25,7 @@ tls { ca_file: "certs/cmvr-quic-ca.crt" - server_name: "192.168.0.222" + server_name: "am-freescan.internal" allow_insecure: false }