Fix/fenrir13228 - #617
Fix/fenrir13228#617
Conversation
|
Can one of the admins verify this patch? |
There was a problem hiding this comment.
🟡 Changes recommended
Critical build issues and the deleted public version header must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates MQTT v5 UNSUBSCRIBE reason-code handling and adds regression tests.
Changes:
- Returns subscription-removal status and emits appropriate UNSUBACK codes.
- Adds coverage for matching and missing subscriptions.
- Deletes the tracked public version header.
File summaries
| File | Review summary |
|---|---|
wolfmqtt/version.h |
Critical: Restore the tracked fallback/public header; its deletion breaks non-Autoconf builds. |
tests/test_broker_connect.c |
Nits: Fix the spelling and incorrect RMQTT_REASON_SUCCESS reference in comments. |
src/mqtt_broker.c |
Critical: Provide bool definitions and guard removed for non-v5 builds. |
Review details
Suppressed comments (1)
wolfmqtt/version.h:1
- Deleting this tracked header removes the fallback copy that the template says is included for builds that do not run
configure; it is also installed as a public header and included by examples such asawsiot.c. A fresh checkout or non-Autoconf/package build will therefore fail to findwolfmqtt/version.h. Restore the generated header.
- Files reviewed: 3/3 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
Critical build blockers remain in src/mqtt_broker.c and wolfmqtt/version.h.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
wolfmqtt/version.h:1
- Deleting this checked-in public header breaks builds that do not run Autoconf:
CMakeLists.txt:397-403installs headers directly fromwolfmqtt/, while the examples include<wolfmqtt/version.h>. Althoughconfigure.accan regenerate it fromversion.h.in, the CMake and other non-configure paths do not, so restore the generated header or add equivalent generation logic to every affected build path.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
b25dedd to
6d9453e
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The WOLFMQTT_V5 build fails because false is used without including <stdbool.h>.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
6d9453e to
3831962
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Correct the undeclared false initializer in src/mqtt_broker.c to avoid C build failures.
Review details
Suppressed comments (1)
src/mqtt_broker.c:7250
- Although
removedis now anint, this initializer still usesfalse;mqtt_broker.cdoes not include<stdbool.h>and the project headers do not define it, so C builds fail with an undeclared identifier. Initialize it with the existing integer convention instead.
int removed = false;
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
3831962 to
4c2cae7
Compare
43cb7ce to
e0f7aa0
Compare
kojiws
left a comment
There was a problem hiding this comment.
Thank you for reflecting my comments.
LGTM
|
@embhorn @ageprocpp is an intern from Japan. |
embhorn
left a comment
There was a problem hiding this comment.
Skoll Code Review
Scan type: review
Overall recommendation: COMMENT
Findings: 5 total — 2 posted, 3 skipped
2 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [Medium] Filter-length guard failure reports 0x8F "Topic Filter invalid", which the spec reserves for an authorization outcome —
src/mqtt_broker.c:7521 - [Medium] BrokerSubs_Remove's new int return contract is undocumented and inverts the file's 0-is-success convention —
src/mqtt_broker.c:4407-4409
Skipped findings
- [Medium]
No test covers multiple Topic Filters in one UNSUBSCRIBE, so per-index reason-code ordering is unverified - [Low]
BrokerSubs_Remove is called from two preprocessor-duplicated sites and its result is discarded without a (void) cast in non-V5 builds - [Low]
Second half of the new test decodes the output buffer without first asserting the broker produced any bytes
Review generated by Skoll
embhorn
left a comment
There was a problem hiding this comment.
A couple small changes suggested by skoll
|
Reflected the changes suggested. |
embhorn
left a comment
There was a problem hiding this comment.
Excellent work, @ageprocpp ! Thanks for adding this fix to the project.
|
@ageprocpp looks like CI is failing can you please fix? |
|
@kojiws Could you rerun the CI? I don’t have permission to do so. |
Its ran twice already and failed it looks pr related please look into it |
|
@ageprocpp |
4d3e328 to
d4185c7
Compare
|
@kojiws Now this branch is rebased from updated master. Please check. |
|
@embhorn |
Fenrir #13228
Description
For every MQTT v5 Topic Filter, the broker writes MQTT_REASON_SUCCESS even when BrokerSubs_Remove() found no matching subscription. MQTT_REASON_NO_SUB_EXIST is defined and accepted by the UNSUBACK encoder but is never produced here. The success assignment also occurs when the filter-length recovery guard fails, although that path is likely unreachable for successfully decoded packets.
Investigation
MQTT V5 specification requires that the reason code be “No subscription existed” when “No matching Topic Filter is being used by the Client,” and “Topic Filter invalid” when “The Topic Filter is correctly formed but is not allowed for this Client.” (l2459-2467)
The source should be modified to meet this specification.
Measures
Test Added
unsubscribe_v5_reason_codes