mirror of
https://github.com/espressif/openthread.git
synced 2026-08-10 20:57:47 +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();
|
||||
|
||||
case Dtls::kStateOpen:
|
||||
IgnoreError(mSocket.Connect(Ip6::SockAddr(aMessageInfo.GetPeerAddr(), aMessageInfo.GetPeerPort())));
|
||||
|
||||
mMessageInfo.SetPeerAddr(aMessageInfo.GetPeerAddr());
|
||||
mMessageInfo.SetPeerPort(aMessageInfo.GetPeerPort());
|
||||
mMessageInfo.SetIsHostInterface(aMessageInfo.IsHostInterface());
|
||||
|
||||
if (Get<ThreadNetif>().HasUnicastAddress(aMessageInfo.GetSockAddr()))
|
||||
{
|
||||
mMessageInfo.SetSockAddr(aMessageInfo.GetSockAddr());
|
||||
}
|
||||
|
||||
mMessageInfo.SetSockAddr(aMessageInfo.GetSockAddr());
|
||||
mMessageInfo.SetSockPort(aMessageInfo.GetSockPort());
|
||||
|
||||
SuccessOrExit(Setup(false));
|
||||
|
||||
Reference in New Issue
Block a user