tests: cover a channel-open rejection on a forwarding channel - #1205
Conversation
There was a problem hiding this comment.
Pull request overview
Adds missing regression coverage for a forwarding-channel edge case where a channelOpenCb rejection could be overwritten by a forwarding callback result (a v1.5.0 behavior that shipped due to lack of combined-callback tests). This PR strengthens the test suite to ensure the peer receives the correct channel-open failure and the forwarding hooks are invoked (or not) as intended.
Changes:
- Adds an “accept” channel-open callback and counting forwarding callbacks to exercise ordering/precedence.
- Introduces three new direct-tcpip regression tests covering: open-callback rejection precedence, fwdCb rejection after accept, and rejection on the channel-id handoff path.
- Registers the new tests in the
WOLFSSH_FWDtest block inmain().
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
No regress case registered a channelOpenCb and a fwdCb at the same time, which is why the v1.5.0 clobber -- fwdCb(LOCAL_SETUP) overwriting the open callback's rejection -- shipped unnoticed. The fix is on master already (0317c40, 616eb68); this is the missing gate. - TestDirectTcpipOpenCbRejectBeatsFwdCb: both callbacks registered and the open callback rejects, so the peer must get a channel-open failure and the forwarding hook must not run at all - TestDirectTcpipFwdCbRejectAfterOpenCbAccept: the other half, where the open callback accepts and the fwdCb's rejection has to reach the peer - TestDirectTcpipFwdCbRejectsChannelId: DoChannelOpen() consults the fwdCb twice, and only the setup rejection was covered All three pin the recipient channel and the reason code, not just the message id. The call counter is file scope rather than reached through the callback ctx, so the zero the first test asserts cannot be a ctx that stopped being delivered; the third test reads 2 on the same counter as the positive control.
d19da16 to
240c904
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1205
Scan targets checked: wolfssh-bugs, wolfssh-src
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
No regress case registered a
channelOpenCband afwdCbat the same time, which is why the v1.5.0 clobber --fwdCb(LOCAL_SETUP)overwriting the open callback's rejection -- shipped unnoticed. The fix is on master already (0317c40, 616eb68); this is the missing gate.TestDirectTcpipOpenCbRejectBeatsFwdCb: both callbacks registered and the open callback rejects, so the peer must get a channel-open failure and the forwarding hook must not run at allTestDirectTcpipFwdCbRejectAfterOpenCbAccept: the other half, where the open callback accepts and the fwdCb's rejection has to reach the peerTestDirectTcpipFwdCbRejectsChannelId:DoChannelOpen()consults the fwdCb twice, and only the setup rejection was coveredAll three pin the recipient channel and the reason code, not just the message id. The call counter is file scope rather than reached through the callback ctx, so the zero the first test asserts cannot be a ctx that stopped being delivered; the third test reads 2 on the same counter as the positive control.
Tests only, no library change.