-
Notifications
You must be signed in to change notification settings - Fork 3k
BLE: Fix writing attributes larger than MTU size #13449
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
Conversation
|
@paul-szczepanek-arm, thank you for your changes. |
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 PR @paul-szczepanek-arm it looks good. I left few comments.
connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattServerImpl.cpp
Show resolved
Hide resolved
connectivity/FEATURE_BLE/libraries/ble-api-implementation/source/GattServerImpl.cpp
Outdated
Show resolved
Hide resolved
if (write_happened) { | ||
WsfTaskLock(); | ||
|
||
memcpy((pAttr->pValue + offset), pValue, len); |
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.
Out of curiosity, I see no memcpy in the diff what was writing to memory before ?
Wouldn't it make sense to memcpy
after the authorization code ?
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 the diff it was inside:
AttsSetAttr(handle, len, pValue)
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.
but good catch, that's bug number 5 in the over mtu flow
uint16_t attribute_handle, | ||
uint8_t* data, | ||
uint16_t write_length, | ||
uint16_t chunk_size |
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.
Do we beed to expose this parameter ?
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 don't understand your question
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.
chunk_size
, does it has to be exposed in the constructor ?
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.
yes, I need to know how big the elements being sent are
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.
It sends prep writes at this size, and when it gets to through all data it sends exec write, I need to know the chunk size so I know when I'm done
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 my defence, mtu was already queried before the call, ready and available so I passed it in instead of querying it again inside.
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.
That would clarify the API. I was confused at first by what was expected for this parameter.
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.
OK, I changed it to an even better combination, now it uses the reported length from the packet since that is now correct
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 believe you forgot to push that commit. Everything looks good besides this.
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.
Yeah, I did push but didn't notice the error: Authentication failed.
connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/include/ble/internal/PalAttClientImpl.h
Show resolved
Hide resolved
I have rerun the tests to verify and it still works, log is the same so I'm not posting it |
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.
LGTM
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
Attribute writes for attributes longer than MTU are broken because prepare write flow is broken at multiple stages. This fixes all the bugs. I have added a test to cover this and test run result is below.
Impact of changes
Migration actions required
Documentation
none
Pull request type
Test results
Reviewers