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

nanocoap_sock: ensure response address is the same as request address #19361

Merged
merged 3 commits into from
Mar 8, 2023

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Mar 7, 2023

Contribution description

If a node has multiple addresses we must reply to a request with the same address on which the request was received.

Since nanoCoAP is not always used as a server and often with only a single address, keep it optional and only enable it when the sock_aux_local module is used.

Testing procedure

CoAP server needs to have two public addresses for this issue to occur:

e.g. set CFLAGS += -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=3 in examples/suit_update and do

> ifconfig 5 add 2001:9e8:1416:8f00::1234
success: added 2001:9e8:1416:8f00::1234/64 to interface 5

> ifconfig
Iface  5  HWaddr: 7A:37:FC:7D:1A:AF 
          L2-PDU:1500  MTU:1492  HL:255  RTR  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::7837:fcff:fe7d:1aaf  scope: link  VAL
          inet6 addr: 2001:9e8:1416:8f00:7837:fcff:fe7d:1aaf  scope: global  VAL
          inet6 addr: 2001:9e8:1416:8f00::1234  scope: global  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff7d:1aaf
          inet6 group: ff02::1:ff00:1234

CoAP requests to either public address should now be answered with the same public address to which the request was made:

> ncget coap://[2001:9e8:1416:8f00::1234]/.well-known/core -
</.well-known/core>,</riot/board>,</suit/>

> ncget coap://[2001:9e8:1416:8f00:7837:fcff:fe7d:1aaf]/.well-known/core -
</.well-known/core>,</riot/board>,</suit/>

Issues/PRs references

same as #18026

@github-actions github-actions bot added Area: CoAP Area: Constrained Application Protocol implementations Area: network Area: Networking Area: sys Area: System labels Mar 7, 2023
@benpicco benpicco force-pushed the nanocoap_server-aux branch from 74fd169 to c14872b Compare March 7, 2023 15:18
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 7, 2023
@benpicco benpicco marked this pull request as ready for review March 7, 2023 15:20
@benpicco benpicco requested a review from chrysn March 7, 2023 15:20
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

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

Code looks good and I trust your testing

@riot-ci
Copy link

riot-ci commented Mar 7, 2023

Murdock results

✔️ PASSED

ad8dd8d nanocoap_sock: ensure response address is the same as request address

Success Failures Total Runtime
6919 0 6919 13m:19s

Artifacts

@benpicco benpicco force-pushed the nanocoap_server-aux branch from c14872b to ad8dd8d Compare March 7, 2023 15:58
@benpicco
Copy link
Contributor Author

benpicco commented Mar 8, 2023

bors merge

@bors bors bot merged commit fae992e into RIOT-OS:master Mar 8, 2023
@bors
Copy link
Contributor

bors bot commented Mar 8, 2023

Build succeeded:

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants