Skip to content

nanocoap: use default blocksize2 in coap_block2_init()#21952

Merged
benpicco merged 3 commits intoRIOT-OS:masterfrom
benpicco:coap_get_blockopt
Dec 11, 2025
Merged

nanocoap: use default blocksize2 in coap_block2_init()#21952
benpicco merged 3 commits intoRIOT-OS:masterfrom
benpicco:coap_get_blockopt

Conversation

@benpicco
Copy link
Copy Markdown
Contributor

Contribution description

coap_block2_init() defaulting to 0 when no block1 option was found just looks like a bug.
But for the simple fix to work we have to prevent coap_find_option() from setting szx to 0 when no block option was found. Setting blknum to 0 does make sense though and we can use it to simplify coap_get_block() - 0 shifted by anything will always be 0, so no need for a special case.

Testing procedure

Issues/PRs references

alternative to #21951

@benpicco benpicco requested a review from miri64 as a code owner December 11, 2025 16:15
@github-actions github-actions bot added Area: network Area: Networking Area: CoAP Area: Constrained Application Protocol implementations Area: sys Area: System labels Dec 11, 2025
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 11, 2025
@riot-ci
Copy link
Copy Markdown

riot-ci commented Dec 11, 2025

Murdock results

✔️ PASSED

93b7d69 nanocoap: use default blocksize2 in coap_block2_init()

Success Failures Total Runtime
10950 0 10950 08m:27s

Artifacts

@benpicco
Copy link
Copy Markdown
Contributor Author

After thinking about it a bit more, coap_get_blockopt() should just do what is expected and not try to be clever.

@benpicco benpicco added this pull request to the merge queue Dec 11, 2025
Merged via the queue into RIOT-OS:master with commit 3264c9d Dec 11, 2025
25 checks passed
@benpicco benpicco deleted the coap_get_blockopt branch December 11, 2025 22:57
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CoAP Area: Constrained Application Protocol implementations Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants