-
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
Fix MRP to not happen over BTP again. #9792
Fix MRP to not happen over BTP again. #9792
Conversation
We were incorrectly doing MRP over BTP, because there was no peer connection state for our insecure session when doing a SPAKE handshake. The various header include additions were needed to fix header files that used types without declaring them and hence depended on other headers being included before them. Fixes project-chip#9738
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In retrospect, this fix is pretty obvious isn't it! But thank you for sorting it out.
I do have a question though. This brings up a bit of a concern for me about buffer ownership: obviously the BTP layer considers the transmit message buffer as 'owned' by it, and therefore assumes it can do in-place modification safely.
But is there a way for us to more cleanly track ownership in our stack? It would be nice if it were impossible for this to happen in the first place. Obviously MRP and BTP can't both own the buffer, and this totally breaks if they try to share the buffer and one of them modifies it. But shouldn't we have something in our stack that actively protects against such a thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to extra a virtual interface from all session (UnauthenticatedSession, SecureSession, and future GroupSession), and make the SessionHandle
behaves like a pointer to the session. I will try it next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hot fix. Had one high-level question regarding unsecured session handling.
Size increase report for "gn_qpg-example-build" from 747b485
Full report output
|
Absolutely, @msandstedt We have this as a long-standing issue with LwIP too, by the way, in that it modifies the buffers handed to it; the way that's handled is by having the send code, when backed by LwIP, always clone the buffer being sent before handing it off to LwIP... Another option would be to have MRP itself make a copy of the data before sending. There were concerns about doing that and the ensuing "two copies of the data when we don't need it in configurations where the network layer does not modify the buffer"... But yes, the current situation is pretty fragile. :( |
It seems to me that we should have some sort of session interface yes, one where a session has enough state internally that we can just ask it questions. The fact that I had to pass in a SecureSessionMgr from the caller in this PR is pretty unfortunate, imo. |
Size increase report for "nrfconnect-example-build" from 747b485
Full report output
|
Size increase report for "esp32-example-build" from 747b485
Full report output
|
We were incorrectly doing MRP over BTP, because there was no peer connection state for our insecure session when doing a SPAKE handshake. The various header include additions were needed to fix header files that used types without declaring them and hence depended on other headers being included before them. Fixes project-chip#9738
We were incorrectly doing MRP over BTP, because there was no peer
connection state for our insecure session when doing a SPAKE
handshake.
The various header include additions were needed to fix header files
that used types without declaring them and hence depended on other
headers being included before them.
Fixes #9738
Problem
We are doing MRP over BTP, which is very broken because BTP modifies the message packetbuffer before sending it.
Change overview
Go back to not doing MRP over BTP.
Testing
Manually did ble-wifi pairing from chip-tool to an m5stack and verified that it works again.