-
Notifications
You must be signed in to change notification settings - Fork 0
feat: S28.06 SolidSyslogLwipRaw_SetMarshal — marshal injection for NO_SYS=0 #470
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b9cb956
feat: S28.06 SolidSyslogLwipRawMarshal — global setter + null-object …
DavidCozens e8e71ee
feat: S28.06 route LwipRawDatagram + LwipRawTcpStream through the mar…
DavidCozens 86291a8
docs: S28.06 note why LwipRawResolver takes no marshal hop
DavidCozens 5f47f25
docs: S28.06 rewrite integrating-lwip threading section + CLAUDE.md row
DavidCozens e419ad0
style: S28.06 clang-format reflow over touched LwipRaw files
DavidCozens 1bf3de6
refactor: S28.06 explicit void* casts in marshal callbacks (MISRA 11.5)
DavidCozens a2e8517
refactor: S28.06 one CallFromContext per class for marshal void* reco…
DavidCozens 33f8036
fix: S28.06 rename marshal call structs to Tier-2 PascalCase (clang-t…
DavidCozens 104d074
docs: S28.06 address CodeRabbit review (narrow claim, story IDs, test…
DavidCozens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #ifndef SOLIDSYSLOGLWIPRAWMARSHAL_H | ||
| #define SOLIDSYSLOGLWIPRAWMARSHAL_H | ||
|
|
||
| #include "ExternC.h" | ||
|
|
||
| EXTERN_C_BEGIN | ||
|
|
||
| /* Every lwIP Raw API call the SolidSyslog wrappers make is routed through | ||
| a single marshal hop so an integrator can pin those calls to the thread | ||
| that owns the lwIP core. | ||
|
|
||
| NO_SYS=1 (bare metal, no RTOS): the default direct-call marshal is | ||
| correct — there is one execution context and no core to protect. | ||
|
|
||
| NO_SYS=0 (RTOS with a tcpip thread): the integrator installs a marshal | ||
| that hops onto the tcpip thread — e.g. tcpip_callback_with_block, or a | ||
| LOCK_TCPIP_CORE / UNLOCK_TCPIP_CORE pair. | ||
|
|
||
| Contract: the marshal MUST invoke its callback synchronously — before | ||
| the marshal function returns. The wrapper reads results the callback | ||
| writes immediately after the hop, so an asynchronous marshal is caller | ||
| error. tcpip_callback_with_block(.., block=1) honours this; a bare | ||
| tcpip_callback(..) does not. */ | ||
| typedef void (*SolidSyslogLwipRawCallback)(void* context); | ||
| typedef void (*SolidSyslogLwipRawMarshalFunction)(SolidSyslogLwipRawCallback callback, void* context); | ||
|
|
||
| /* Installs a process-global marshal. There is one lwIP instance and one | ||
| tcpip thread per process, so a single global slot suffices — same shape | ||
| as SolidSyslog_SetErrorHandler. Passing NULL restores the direct-call | ||
| default. Intended for setup-time configuration; not synchronised with | ||
| concurrent installs. */ | ||
| void SolidSyslogLwipRaw_SetMarshal(SolidSyslogLwipRawMarshalFunction marshal); | ||
|
|
||
| EXTERN_C_END | ||
|
|
||
| #endif /* SOLIDSYSLOGLWIPRAWMARSHAL_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #include "SolidSyslogLwipRawMarshalPrivate.h" | ||
|
|
||
| #include <stddef.h> | ||
|
|
||
| static void Marshal_NullMarshal(SolidSyslogLwipRawCallback callback, void* context) | ||
| { | ||
| callback(context); | ||
| } | ||
|
|
||
| static SolidSyslogLwipRawMarshalFunction currentMarshal = Marshal_NullMarshal; | ||
|
|
||
| void SolidSyslogLwipRaw_SetMarshal(SolidSyslogLwipRawMarshalFunction marshal) | ||
| { | ||
| if (marshal == NULL) | ||
| { | ||
| currentMarshal = Marshal_NullMarshal; | ||
| } | ||
| else | ||
| { | ||
| currentMarshal = marshal; | ||
| } | ||
| } | ||
|
|
||
| void SolidSyslogLwipRaw_Marshal(SolidSyslogLwipRawCallback callback, void* context) | ||
| { | ||
| currentMarshal(callback, context); | ||
| } |
17 changes: 17 additions & 0 deletions
17
Platform/LwipRaw/Source/SolidSyslogLwipRawMarshalPrivate.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #ifndef SOLIDSYSLOGLWIPRAWMARSHALPRIVATE_H | ||
| #define SOLIDSYSLOGLWIPRAWMARSHALPRIVATE_H | ||
|
|
||
| #include "ExternC.h" | ||
| #include "SolidSyslogLwipRawMarshal.h" | ||
|
|
||
| EXTERN_C_BEGIN | ||
|
|
||
| /* Library-internal dispatch call site. The LwipRaw wrapper classes batch | ||
| the lwIP API calls for one public operation into a single callback and | ||
| hand it here; we run it through the currently-installed marshal. No NULL | ||
| check — the null-object default direct-calls. */ | ||
| void SolidSyslogLwipRaw_Marshal(SolidSyslogLwipRawCallback callback, void* context); | ||
|
|
||
| EXTERN_C_END | ||
|
|
||
| #endif /* SOLIDSYSLOGLWIPRAWMARSHALPRIVATE_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 288
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 6328
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 35125
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 18309
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 8528
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 6935
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 17536
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 19640
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 50453
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 15914
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 5871
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 12499
🏁 Script executed:
Repository: DavidCozens/solid-syslog
Length of output: 12545
Prevent silent truncation of the
pbuf_alloclength cast tou16_t.SolidSyslogLwipRawDatagram_DoSendTocastscall->Sizetou16_tinpbuf_alloc(..., (u16_t) call->Size, ...)(line 142). Ifcall->Size > UINT16_MAX, the value can wrap and lwIP may allocate/send the wrong length. Add a bound check againstUINT16_MAX(and keepcall->ResultasFAILED/return early) before the cast.🤖 Prompt for AI Agents
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.
Declined as out-of-scope. This
(u16_t)cast is pre-existing (S28.04 baseline), not introduced here — the redesign just moved the line. It's lwIP-specific (pbuf_alloctakesu16_t; the Posix/PlusTcp datagram siblings passsize_tto their socket APIs so have no such cast), andsizeis contract-bounded byDatagram_MaxPayload(~1232 B IPv6-safe) withUdpSenderrunning an oversize-retry path above it, so asize > UINT16_MAXdatagram cannot reach here. Not changing it in this PR to keep scope to the marshal seam.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.
@DavidCozens, understood — the contract layering (caller-sideMaxPayload→UdpSenderoversize-retry →SendTo) means an out-of-range value cannot reach the cast, and it's a pre-existing S28.04 baseline pattern rather than anything introduced here. I'll note this for future reviews.Would you like me to resolve this comment?
(>_<) 🐇
✏️ Learnings added
🧠 Learnings used