Skip to content

RxD Fix#874

Open
ejohnstown wants to merge 3 commits intowolfSSL:masterfrom
ejohnstown:rxd-fix
Open

RxD Fix#874
ejohnstown wants to merge 3 commits intowolfSSL:masterfrom
ejohnstown:rxd-fix

Conversation

@ejohnstown
Copy link
Contributor

@ejohnstown ejohnstown commented Feb 2, 2026

  1. Forwarding fixes in echoserver. (Really a general channel issue.)
  2. Agent fixes in echoserver.
  3. Added a test for forwarding.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes handling around “channel RX’d” (WS_CHAN_RXD) and agent setup paths, primarily to improve forwarding behavior in the echoserver and make agent-related code compile cleanly.

Changes:

  • Treat WS_CHAN_RXD as a successful outcome for returning lastRxId from wolfSSH_worker().
  • Silence unused-parameter warnings in agent stubs.
  • Fix echoserver agent UNIX-socket setup flow so it proceeds correctly after snprintf() and simplifies the socket() error assignment.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/ssh.c Returns channelId not only on WS_SUCCESS but also on WS_CHAN_RXD so callers can identify the channel that received data.
src/agent.c Adds WOLFSSH_UNUSED(agent) to avoid unused-parameter warnings when logging is compiled out.
examples/echoserver/echoserver.c Corrects agent local setup flow after snprintf() and adjusts UNIX-socket bind/setup logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@JacobBarthelmeh JacobBarthelmeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look okay. I sent a message asking about expected output and return values from running the new scripts/fwd.test.

@JacobBarthelmeh
Copy link
Contributor

Assigning to John for investigating into the test case behavior.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

examples/portfwd/portfwd.c:325

  • The new -R <readyFile> option is parsed, but ShowUsage() doesn’t mention it. This makes the CLI help inaccurate; please update the usage text to document -R and what it writes to the file.
    while ((ch = mygetopt(argc, argv, "?f:h:p:t:u:F:P:R:T:")) != -1) {
        switch (ch) {
            case 'h':
                host = myoptarg;
                break;

            case 'f':
                if (myoptarg == NULL)
                    err_sys("null argument found");
                fwdFromPort = (word16)atoi(myoptarg);
                break;

            case 'p':
                if (myoptarg == NULL)
                    err_sys("null argument found");
                port = (word16)atoi(myoptarg);
                #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
                    if (port == 0)
                        err_sys("port number cannot be 0");
                #endif
                break;

            case 't':
                if (myoptarg == NULL)
                    err_sys("null argument found");
                fwdToPort = (word16)atoi(myoptarg);
                break;

            case 'u':
                username = myoptarg;
                break;

            case 'F':
                fwdFromHost = myoptarg;
                break;

            case 'P':
                password = myoptarg;
                break;

            case 'R':
                readyFile = myoptarg;
                break;

            case 'T':
                fwdToHost = myoptarg;
                break;

            case '?':
                ShowUsage();
                exit(EXIT_SUCCESS);

            default:
                ShowUsage();
                exit(MY_EX_USAGE);
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

1. When wolfSSH_worker() receives channel data, it should set the
   channelId for the data. It was not happening. Change the check for
   WS_SUCCESS to also check for WS_CHAN_RXD.
1. Fix a couple unused variable warnings.
2. In wolfSSH_AGENT_DefaultActions(), fix comparison to the result of
   snprintf() treating normal result as an error. Reset the return code
   for the error state of the socket() command. Better cleanup of agent
   startup failures.
1. Add a test script and expect script for testing forwarding.
2. Update portfwd to have a ready file option.
3. Fix echoserver error string, needed NL.
Copilot AI review requested due to automatic review settings February 26, 2026 19:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{Ut enim ad minim veniam, quis nostrud exercitation ullamco}
{laboris nisi ut aliquip ex ea commodo consequat.}
{Duis aute irure dolor in reprehenderit in voluptate velit esse}
{cillum dolore eu fugat nulla pariatur.}
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'fugat' to 'fugiat'.

Suggested change
{cillum dolore eu fugat nulla pariatur.}
{cillum dolore eu fugiat nulla pariatur.}

Copilot uses AI. Check for mistakes.
"/tmp/wolfserver.%d", ctx->pid);

if (ret == 0) {
if (ret <= 0) {
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition ret <= 0 is incorrect for snprintf. On success, snprintf returns the number of characters that would have been written (excluding null terminator), which is positive. A return value of 0 would indicate an empty string was written, not an error. The condition should be ret < 0 to catch actual errors, or ret >= sizeof(name->sun_path) to catch truncation.

Suggested change
if (ret <= 0) {
if (ret < 0 || (size_t)ret >= sizeof(name->sun_path)) {

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants