diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2019-03-15 12:45:28 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2019-03-28 08:47:36 +0000 |
commit | b2f1a52b66b1a14ec1d43b4bceac7bbf0e2d6d4b (patch) | |
tree | 74146d1c5dabd8a4beb08dffd172ab726561ad07 | |
parent | e11870bef1f12493ea12f3ab3498a59031f419af (diff) |
Fix sending KNXnet/IP session request frames
AN159 - 2.2.3.6.4 Reception and decoding
* A KNXnet/IP Session Request frame is only valid when received
over a TCP endpoint with a TCP HPAI set to zero (Route Back).
Change-Id: I7edec7f08a898784e7c690c8d449af5e506066f3
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r-- | src/knx/netip/qknxnetipendpointconnection.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/knx/netip/qknxnetipendpointconnection.cpp b/src/knx/netip/qknxnetipendpointconnection.cpp index 59e6472..c983c59 100644 --- a/src/knx/netip/qknxnetipendpointconnection.cpp +++ b/src/knx/netip/qknxnetipendpointconnection.cpp @@ -1361,15 +1361,13 @@ void QKnxNetIpEndpointConnection::connectToHostEncrypted(const QHostAddress &add if (d->m_serialNumber.size() != 6) return d->setAndEmitErrorOccurred(Error::SerialNumber, tr("Invalid device serial number.")); - d->m_tcpSocket->connectToHost(address, port); - connect(d->m_tcpSocket, &QTcpSocket::connected, this, [&]() { Q_D(QKnxNetIpEndpointConnection); d->m_localEndpoint = Endpoint(d->m_tcpSocket->localAddress(), d->m_tcpSocket->localPort(), QKnxNetIp::HostProtocol::TCP_IPv4); auto request = QKnxNetIpSessionRequestProxy::builder() - .setControlEndpoint(d->m_nat ? d->m_routeBack : d->m_localEndpoint) + .setControlEndpoint(d->m_routeBack) .setPublicKey(d->m_secureConfig.d->publicKey.bytes()) .create(); d->m_controlEndpointVersion = request.header().protocolVersion(); @@ -1386,6 +1384,7 @@ void QKnxNetIpEndpointConnection::connectToHostEncrypted(const QHostAddress &add }); d->m_secureTimer->start(QKnxNetIp::SecureSessionRequestTimeout); }); + d->m_tcpSocket->connectToHost(address, port); } /*! |