-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure that we send MRP acks to incoming messages as needed. #19398
Merged
bzbarsky-apple
merged 1 commit into
project-chip:master
from
bzbarsky-apple:fix-encryption-mismatch-acks
Jun 10, 2022
Merged
Ensure that we send MRP acks to incoming messages as needed. #19398
bzbarsky-apple
merged 1 commit into
project-chip:master
from
bzbarsky-apple:fix-encryption-mismatch-acks
Jun 10, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pullapprove
bot
requested review from
andy31415,
anush-apple,
arkq,
Byungjoo-Lee,
carol-apple,
chrisdecenzo,
chshu,
chulspro,
Damian-Nordic,
dhrishi,
electrocucaracha,
emargolis,
erjiaqing,
franck-apple,
gjc13,
harimau-qirex,
hawk248,
harsha-rajendran,
isiu-apple,
jelderton,
jepenven-silabs,
jmartinez-silabs,
jtung-apple,
kpschoedel,
lazarkov,
LuDuda,
mlepage-google,
mrjerryjohns,
msandstedt and
mspang
June 9, 2022 17:18
pullapprove
bot
requested review from
robszewczyk,
sagar-apple,
saurabhst,
selissia,
tecimovic,
vijs,
vivien-apple,
wbschiller,
woody-apple,
xylophone21 and
yufengwangca
June 9, 2022 17:18
bzbarsky-apple
force-pushed
the
fix-encryption-mismatch-acks
branch
from
June 9, 2022 17:19
fde9af8
to
4bfbee0
Compare
kghost
reviewed
Jun 9, 2022
woody-apple
approved these changes
Jun 9, 2022
bzbarsky-apple
force-pushed
the
fix-encryption-mismatch-acks
branch
from
June 9, 2022 19:57
4bfbee0
to
e7795a8
Compare
There were two ways we could fail to send an ack to an incoming reliable message: 1) If we found no matching handler, and hence created an ephemeral exchange to handle the message, but the message was unencrypted. In this case our ephemeral exchange would return true for IsEncryptionRequired(), because it would default to an ApplicationExchangeDispatch, and we would never call into ExchangeContext::HandleMessage. 2) If ExchangeMessageDispatch::MessagePermitted returned false for the message. In particular, for an ApplicationExchangeDispatch, this would happen for all the handshake messages except StatusReport. The fix for issue 1 is to ensure we always call into HandleMEssage if we manage to allocate an exchange. If there is an encryption mismatch, which only matters when the exchange is non-ephemeral, we close the exchange first to prevent event delivery to the delegate. The fix for issue 2 is to move the MRP processing out of ExchangeMessageDispatch and into ExchangeContext, and to move the MessagePermitted check so the only thing it prevents is delivery of the message to the delegate, not any other processing by the exchange. Fixes project-chip#10515
bzbarsky-apple
force-pushed
the
fix-encryption-mismatch-acks
branch
from
June 9, 2022 21:01
e7795a8
to
fa18784
Compare
PR #19398: Size comparison from 0adc4f3 to fa18784 Increases (27 builds for cc13x2_26x2, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
Decreases (14 builds for cc13x2_26x2, cyw30739, esp32, linux, telink)
Full report (30 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
kghost
approved these changes
Jun 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There were two ways we could fail to send an ack to an incoming reliable message:
If we found no matching handler, and hence created an ephemeral exchange to
handle the message, but the message was unencrypted. In this case our ephemeral
exchange would return true for IsEncryptionRequired(), because it would default
to an ApplicationExchangeDispatch, and we would never call into
ExchangeContext::HandleMessage.
If ExchangeMessageDispatch::MessagePermitted returned false for the message.
In particular, for an ApplicationExchangeDispatch, this would happen for all the
handshake messages except StatusReport.
The fix for issue 1 is to ensure we always call into HandleMEssage if we manage
to allocate an exchange. If there is an encryption mismatch, which only matters
when the exchange is non-ephemeral, we close the exchange first to prevent event
delivery to the delegate.
The fix for issue 2 is to move the MRP processing out of ExchangeMessageDispatch
and into ExchangeContext, and to move the MessagePermitted check so the only
thing it prevents is delivery of the message to the delegate, not any other
processing by the exchange.
Fixes #10515
Problem
See above.
Change overview
See above.
Testing
Introduced a 10-second sleep in CASE StatusReport processing, which without these changes caused acks to the resent Sigma3 or Sigma2Resume message to be dropped. Verified that with these changes those acks are sent correctly. That exercises problem 1.
In addition to the above, added StatusReport to the list of disallowed messages in
ApplicationExchangeDispatch::MessagePermitted
and verified that without the changes to fix problem 2 above acks failed to be sent, but with the changes in this PR acks were sent correctly.