-
Notifications
You must be signed in to change notification settings - Fork 8.3k
LwM2M: fix block transfer with TLV #34936
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
LwM2M: fix block transfer with TLV #34936
Conversation
rlubos
left a comment
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, current implementation indeed was limited to firmware update only, thanks for making this more generic. It also leaves an opening for further improvements in the future, as currently block transfer writes are limited to a single resource only.
You'd need to update your commit message in order to satisfy Zephyr CI - please add net: lwm2m: prefix to the commit title, a signoff entry and stick to char/line limit of the commit message. You can check what's wrong in the compliance check results.
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.
Please move the variable declaration to the beginning of the block.
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.
Would be nice to keep the indentation from the original 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.
We typically avoid assignments inside the if condition
| if ((ret = write_tlv_resource(msg, &tlv2))) { | |
| ret = write_tlv_resource(msg, &tlv2); | |
| if (ret < 0) { |
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.
Same here.
ec8d57e to
498e762
Compare
rlubos
left a comment
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.
One more nit, there's a duplicated signoff entry in the commit message, but otherwise looks good.
498e762 to
9c7ea52
Compare
|
Thanks for the Feedback @rlubos ! After editing the existing commit message, git appended the signoff message a second time and I didn't notice. I hope everything is in order now. |
jukkar
left a comment
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
|
@jukkar Any idea why is the gitlint complaining about the signoff entry? It looks correct to me... |
|
The original message had the signoff entry as well, and it also complained. I figured gitlint might have gotten confused because of other issues with the message, but those are fixed now. Maybe it doesn't like the umlaut? |
I'm not sure to be honest - it doesn't seem like any of the typical issues I've seen so far. gitlint is fairly easy to run locally, perhaps you could give it a show w/o umlaut. Just not that another gitlint requirement is that the commit author name matches the signoff entry, so you might need to run |
|
The exact message is
Hmm, I am seeing chars like @galak any idea what is going on here? |
9c7ea52 to
55e6c52
Compare
|
I saw the issue locally, amended the commit without any changes and without |
|
@jb-gcx Now the complaint is different:
|
|
I'm stumped by this one. My local gitlint is OK with everything, and the Curious: the output of the online check references |
It's likely due to the fact, that compliance check rebases the PR branch to the latest master before running the checks - hence different SHA of your commit. I'm not gitlint expert, but from experience I can tell that it only reports results if the |
55e6c52 to
1e07cb4
Compare
Unfortunately no, I'm in the root directory. I've tried rebasing onto master and pushing again, maybe this will help. I thought maybe the rebase modifies the author somehow. Although then this error would occur a lot, so it doesn't seem likely. |
|
Indeed, I've just tried locally on my side and I cannot reproduce the error as well... I'm totally out of ideas right now, @galak @carlescufi @nashif any clues what could be the gitlint problem here? |
I can reproduce the error: But I am unsure what is causing it, the entries seem correct in both places. |
|
Maybe there is a difference in behavior between linux and macos? I am on mac OS. |
|
It's an encoding problem: Your email: The first one is using an actual ASCII |
1e07cb4 to
52341fd
Compare
Thanks, I didn't see that! I am now using the same encoding as the author field in the commit message, but the old error is back: But now I know why it worked one time, when I had the double signoff message; the two lines must have been encoded differently, so gitlint used one encoding to compare to the author and the other one to check for a full name. I'm out of time for today, but tomorrow I'll either change the encoding of my author field, or just use "Buenker" everywhere to make myself future proof. |
This was already implemented for firmware update packages. For other opaque resources it failed to determine the target resource id, which is now stored in the block_context. Signed-off-by: Jan Buenker <jan.buenker@grandcentrix.net>
52341fd to
d2ee8f4
Compare
| return ret; | ||
| } | ||
|
|
||
| return 0; |
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.
This "return 0;" seems to cause a problem.
If the current packet contains writes to other resources in the object, those will not be processed. Only the first item is written, and function returns without processing the rest.
If I remove the "return 0", it seems to resolve my problem and the other writes are processed. However, that "return 0" was specifically added for a reason, so I am not confident that is the correct fix.
Follow-up packets do not contain the TLV header but just continuations of the value. Tested with a Leshan server and a custom opaque resource.
Fixes #34935
Signed-off-by: Jan Bünker jan.buenker@grandcentrix.net