Skip to content
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

sys/net/nanocoap: Fix sending bogus separate responses #21076

Conversation

maribu
Copy link
Member

@maribu maribu commented Dec 12, 2024

Contribution description

When module nanocoap_server_separate is not used, the functions to send separate responses are still provided, just in a broken version: They will send the separate replies from a different endpoint than the request was received at (even on machines with only one IP address, as also the source port is randomized).

This changes the behavior to only provide the functions for separate response when the do work, so that others will detect an invalid configuration at compile time rather than at run time.

The documentation is duly updated.

Testing procedure

$ make BOARD=same54-xpro flash term -C examples/nanocoap_server
[...]
2024-12-12 10:30:46,488 # {"IPv6 addresses": ["fe80::fec2:3dff:fe0b:cf49"]}
2024-12-12 10:30:49,421 # _separate_handler(): send ACK, schedule response
2024-12-12 10:30:50,425 # _separate_handler(): send delayed response
$ coap-client-notls -p 1234 -a 'fe80::183:ade0:3cd0:d5b%enp1s0f0' -m get 'coap://[fe80::fec2:3dff:fe0b:cf49]/separate'
This is a delayed response.

Issues/PRs references

None

@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 12, 2024
@maribu maribu requested a review from benpicco December 12, 2024 09:34
@github-actions github-actions bot added Area: CoAP Area: Constrained Application Protocol implementations Area: sys Area: System labels Dec 12, 2024
@riot-ci
Copy link

riot-ci commented Dec 12, 2024

Murdock results

✔️ PASSED

ab116ec sys/net/nanocoap: Fix sending bogus separate responses

Success Failures Total Runtime
10248 0 10249 18m:15s

Artifacts

When module `nanocoap_server_separate` is not used, the functions to
send separate responses are still provided, just in a broken version:
They will send the separate replies from a different endpoint than the
request was received at (even on machines with only one IP address, as
also the source port is randomized).

This changes the behavior to only provide the functions for separate
response when the do work, so that others will detect an invalid
configuration at compile time rather than at run time.

The documentation is duly updated.
@maribu maribu force-pushed the sys/net/nanocoap/fix-invalid-conf-separate-response branch from 0d62ba6 to ab116ec Compare December 13, 2024 07:41
@maribu maribu enabled auto-merge December 13, 2024 07:41
@maribu maribu added this pull request to the merge queue Dec 13, 2024
Merged via the queue into RIOT-OS:master with commit d394f62 Dec 13, 2024
25 checks passed
@maribu maribu deleted the sys/net/nanocoap/fix-invalid-conf-separate-response branch December 15, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CoAP Area: Constrained Application Protocol implementations Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants