mirror of
https://github.com/espressif/openthread.git
synced 2026-09-10 11:10:08 +00:00
[dtls] fix DTLS connection issues (#8168)
This commit fixes two DTLS session issues on Posix: - Fix the issue that UDP connect would cause the kernel socket to bind to an address that might be different from the address used by the Commissioner. - Set the socket address to avoid kernel selecting an incorrect source address.
This commit is contained in:
@@ -184,17 +184,11 @@ void Dtls::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageI
|
|||||||
ExitNow();
|
ExitNow();
|
||||||
|
|
||||||
case Dtls::kStateOpen:
|
case Dtls::kStateOpen:
|
||||||
IgnoreError(mSocket.Connect(Ip6::SockAddr(aMessageInfo.GetPeerAddr(), aMessageInfo.GetPeerPort())));
|
|
||||||
|
|
||||||
mMessageInfo.SetPeerAddr(aMessageInfo.GetPeerAddr());
|
mMessageInfo.SetPeerAddr(aMessageInfo.GetPeerAddr());
|
||||||
mMessageInfo.SetPeerPort(aMessageInfo.GetPeerPort());
|
mMessageInfo.SetPeerPort(aMessageInfo.GetPeerPort());
|
||||||
mMessageInfo.SetIsHostInterface(aMessageInfo.IsHostInterface());
|
mMessageInfo.SetIsHostInterface(aMessageInfo.IsHostInterface());
|
||||||
|
|
||||||
if (Get<ThreadNetif>().HasUnicastAddress(aMessageInfo.GetSockAddr()))
|
mMessageInfo.SetSockAddr(aMessageInfo.GetSockAddr());
|
||||||
{
|
|
||||||
mMessageInfo.SetSockAddr(aMessageInfo.GetSockAddr());
|
|
||||||
}
|
|
||||||
|
|
||||||
mMessageInfo.SetSockPort(aMessageInfo.GetSockPort());
|
mMessageInfo.SetSockPort(aMessageInfo.GetSockPort());
|
||||||
|
|
||||||
SuccessOrExit(Setup(false));
|
SuccessOrExit(Setup(false));
|
||||||
|
|||||||
Reference in New Issue
Block a user