[meshcop] JR: don't wait for previous rsp to send a new JOIN_ENT.ntf (#5199)

The existing Joiner Entrust process is as follows:

- The Joiner sends JOIN_FIN.req and receives JOIN_FIN.rsp from the
  Joiner Router.

- The Joiner sets up a 4000 ms timer to receive the JOIN_ENT.ntf.

- The Joiner Router generates the JOIN_ENT.ntf and enqueues it,
  setting up a 50 ms timer to send it.

- When the Joiner Router timer triggers it sends the heading message
  from the queue ONLY if the previous transaction already
  completed. This is done like this because whenever a new
  JOIN_ENT.ntf is sent the KEK in the KeyManager is changed, and it's
  required to keep it in order to decrypt the CoAP ACK.

This approach presents a couple of issues:

- It blocks the message queue up to the maximum CoAP transaction time,
  which can be much longer than the Joiner 4 seconds timeout.

- Even worse, if the CoAP ACK never arrives, no more messages would be
  released from the queue, even future enqueued ones.

This commit removes this queue blocking, assuming the risk of an
enqueued JOIN_ENT.ntf being sent before the previous ACK has
arrived. In that case there are two options:

- The previous JOIN_ENT.ntf was not delivered and the previous Joiner
  would need to start over the whole Commissioning process again.

- The previous JOIN_ENT.ntf was delivered but the ACK was not
  received. This has impact only in the Joiner Router logs.

But even for the first case the chances are very low (a JOIN_ENT.ntf
enqueued to be triggered just a few milliseconds after the first one)
and situation is much better than the previously existing one.
This commit is contained in:
Eduardo Montoya
2020-07-07 11:40:26 -07:00
committed by GitHub
parent d3a429b1ea
commit 9f0df30493
2 changed files with 0 additions and 11 deletions
-10
View File
@@ -61,7 +61,6 @@ JoinerRouter::JoinerRouter(Instance &aInstance)
, mTimer(aInstance, JoinerRouter::HandleTimer, this)
, mJoinerUdpPort(0)
, mIsJoinerPortConfigured(false)
, mExpectJoinEntRsp(false)
{
Get<Coap::Coap>().AddResource(mRelayTransmit);
}
@@ -294,12 +293,6 @@ void JoinerRouter::SendDelayedJoinerEntrust(void)
metadata.ReadFrom(*message);
// The message can be sent during CoAP transaction if KEK did not
// change (i.e., retransmission). Otherweise, we wait for Joiner
// Entrust Response before handling any other pending delayed
// Jointer Entrust message.
VerifyOrExit(!mExpectJoinEntRsp || (Get<KeyManager>().GetKek() == metadata.mKek), OT_NOOP);
if (TimerMilli::GetNow() < metadata.mSendTime)
{
mTimer.FireAt(metadata.mSendTime);
@@ -338,8 +331,6 @@ otError JoinerRouter::SendJoinerEntrust(const Ip6::MessageInfo &aMessageInfo)
otLogInfoMeshCoP("Sent joiner entrust length = %d", message->GetLength());
otLogCertMeshCoP("[THCI] direction=send | type=JOIN_ENT.ntf");
mExpectJoinEntRsp = true;
exit:
if (error != OT_ERROR_NONE && message != nullptr)
{
@@ -453,7 +444,6 @@ void JoinerRouter::HandleJoinerEntrustResponse(Coap::Message * aMessage,
{
OT_UNUSED_VARIABLE(aMessageInfo);
mExpectJoinEntRsp = false;
SendDelayedJoinerEntrust();
VerifyOrExit(aResult == OT_ERROR_NONE && aMessage != nullptr, OT_NOOP);
-1
View File
@@ -127,7 +127,6 @@ private:
uint16_t mJoinerUdpPort;
bool mIsJoinerPortConfigured : 1;
bool mExpectJoinEntRsp : 1;
};
} // namespace MeshCoP