Skip to content

Fix link_native link request size mismatch (and add trace flag) #17

@jlpoolen

Description

@jlpoolen

The native link example fails to establish a link even though announce/path discovery succeeds. The server logs: “Invalid link request payload size, dropping request”.

Root cause: the client includes MTU signalling bytes in the link request (ECPUBSIZE + LINK_MTU_SIZE), but the server only accepts ECPUBSIZE. This patch accepts both sizes, which unblocks link establishment.

Changes:

  • Accept link request payloads of size ECPUBSIZE + LINK_MTU_SIZE
  • Add --log_trace flag to enable TRACE without source edits
  • Add <signal.h> for SIGINT on native builds

Patch:
microreticulum-link-fix.patch

Logs:
client.log
server_failure.log

Here are sessions (no TRACE) showing success (on same workstation, 2 consoles):

Client

(reticenv) jlpoole@ryzdesk /usr/local/src/microreticulum/chad/examples/link_native $ date; ./.pio/build/native/program 08a54696e7717901de591bae43aafb7f
Thu Jan 22 01:08:32 PM PST 2026
2026-01-22 13:08:32 [---] contiguous_size: 0
2026-01-22 13:08:32 [---] buffer_size: 1024000
2026-01-22 13:08:32 [---] Initializing RNG...
2026-01-22 13:08:32 [---] RNG initial random value: 4278124286
2026-01-22 13:08:32 [ERR] file_exists: failed to open file ./transport_identity
2026-01-22 13:08:32 [NOT] Destination is not yet known. Requesting path and waiting for announce to arrive...
2026-01-22 13:08:32 [NOT] Establishing link with server...
2026-01-22 13:08:32 [NOT] Waiting for link to become active...
2026-01-22 13:08:32 [NOT] Link established with server, enter some text to send, or "quit" to quit
> First transmission from client ryzdesk
(sending data: First transmission from client ryzdesk)
> 2026-01-22 13:08:57 [NOT] Received data on the link: I received "First transmission from client ryzdesk" over the link
> 2nd transmission from client ryzdesk
(sending data: 2nd transmission from client ryzdesk)
> 2026-01-22 13:09:07 [NOT] Received data on the link: I received "2nd transmission from client ryzdesk" over the link
> ^C
Ctrl+C detected. Performing cleanup...
Cleanup complete. Exiting.
(reticenv) jlpoole@ryzdesk /usr/local/src/microreticulum/chad/examples/link_native $ 

Server

(rnsenv) jlpoole@jp /usr/local/src/microreticulum/chad/examples/link_native $ date; time ./.pio/build/native/program --server
Thu Jan 22 13:08:08 PST 2026
2026-01-22 13:08:08 [---] contiguous_size: 0
2026-01-22 13:08:08 [---] buffer_size: 1024000
2026-01-22 13:08:08 [---] Initializing RNG...
2026-01-22 13:08:08 [---] RNG initial random value: 151587081
2026-01-22 13:08:08 [ERR] file_exists: failed to open file ./transport_identity
2026-01-22 13:08:08 [NOT] Link example <08a54696e7717901de591bae43aafb7f> running, waiting for a connection.
2026-01-22 13:08:08 [NOT] Hit enter to manually send an announce (Ctrl-C to quit)
2026-01-22 13:08:32 [NOT] Client connected
2026-01-22 13:08:57 [NOT] Received data on the link: First transmission from client ryzdesk
2026-01-22 13:09:07 [NOT] Received data on the link: 2nd transmission from client ryzdesk
^C
Ctrl+C detected. Performing cleanup...
Cleanup complete. Exiting.

real 1m51.089s
user 0m40.938s
sys 1m9.907s
(rnsenv) jlpoole@jp /usr/local/src/microreticulum/chad/examples/link_native $

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions