Skip to content

Fix build with RNS_NEIGHBOR_PROBING=0 - #95

Open
tmierzwa wants to merge 1 commit into
attermann:masterfrom
tmierzwa:fix-probes-received-without-probing
Open

tmierzwa wants to merge 1 commit into
attermann:masterfrom
tmierzwa:fix-probes-received-without-probing

Conversation

@tmierzwa

Copy link
Copy Markdown

Problem

Type.h documents -DRNS_NEIGHBOR_PROBING=0 as the way to compile neighbor probing out entirely, but the build fails with it on current master (40fa628):

src/microReticulum/Transport.cpp:4307:11: error: '_probes_received' was not declared in this scope; did you mean '_packets_received'?

Transport::probe_request_handler increments _probes_received unconditionally, while the counter's declaration, definition, getter (probes_received()) and its provisioning metric are all inside #if RNS_NEIGHBOR_PROBING. Anyone who disables the feature (for example to save flash or to avoid probe traffic on a shared channel) cannot build the library.

To reproduce: PLATFORMIO_BUILD_FLAGS=-DRNS_NEIGHBOR_PROBING=0 pio run -e native.

Change

Wrap the increment in #if RNS_NEIGHBOR_PROBING, matching the guards around the rest of the counter. Two lines, no behavior change with the default setting.

The probe responder (_probe_destination, enabled by Reticulum::probe_destination_enabled()) is created and answers probes either way; with the feature off it simply does not count them, which is consistent with probes_received() not existing in that configuration. An alternative would be to move _probes_received out of the guard because it counts responder-side traffic, but that changes the public API surface of the feature flag, so I kept the minimal fix.

Testing

Target RNS_NEIGHBOR_PROBING Result
native (Ubuntu 24.04, GCC 13.3, PlatformIO 6.2.0), master 0 build fails (error above)
native, this branch 0 pio test -e native: 181/181 passed
native, this branch default (1) pio test -e native: 182/182 passed
ttgo-t-beam (ESP32), this branch default / 0 builds
wiscore_rak4631 (nRF52840), this branch default / 0 builds

Not tested on hardware: the change only affects compilation, and with the default setting the compiled code is identical.

Found while using microReticulum in WICI, where we build with neighbor probing disabled and have carried this as a local patch.

🤖 Generated with Claude Code

Transport::probe_request_handler increments _probes_received
unconditionally, but the counter is only declared and defined when
RNS_NEIGHBOR_PROBING is enabled, so compiling the feature out fails:

  Transport.cpp:4307: error: '_probes_received' was not declared in this scope

Guard the increment like the counter's declaration, definition, getter
and metric. The probe responder itself is unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant