gcoap: propagate local tx aux to gcoap_req_send() and in _handler_req()#20711
Merged
benpicco merged 5 commits intoRIOT-OS:masterfrom Jul 5, 2024
Merged
gcoap: propagate local tx aux to gcoap_req_send() and in _handler_req()#20711benpicco merged 5 commits intoRIOT-OS:masterfrom
benpicco merged 5 commits intoRIOT-OS:masterfrom
Conversation
maribu
reviewed
May 30, 2024
Member
There was a problem hiding this comment.
Thx. The change looks good to me.
I guess it would be possible to rename the function and provide a backward compatible version. But I do believe that having a gcoap_req_send() and a gcoap_req_send2() or whatever would cause more confusion than it would save time for app developers that would profit from a deprecation period. And updating the calls is relatively easy by adding the additional parameter.
6d2d511 to
f50dd7d
Compare
benpicco
approved these changes
Jul 4, 2024
Contributor
benpicco
left a comment
There was a problem hiding this comment.
Looks good to me and the explanation makes sense.
Member
|
🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
The gcoap forward proxy must respond to the client from the same address and port where it has received the request.
The address towards the server can be different.
For that the usual information in
sock_udp_aux_tx_tare propated to where they are needed ingcoap_req_send()and_handle_req()ingcoap.cAnother fix is included by setting the correct payload size in the forwarded PDU right after it is copied.
Testing procedure
Use this branch to run a client and proxy with
examples/gcoap./dist/tools/tapsetupClient:
CFLAGS+=-DCONFIG_GCOAP_PDU_BUF_SIZE=512 make flash termProxy:
Add another link local address only to the proxy by adding the following to
examples/gcoap/Makefile:CFLAGS+=-DCONFIG_GCOAP_PDU_BUF_SIZE=512 USEMODULE+=gcoap_forward_proxy make flash term PORT=tap1Server:
Run a libcoap server on the
tapbr0interface:coap-server-openssl -A fe80::f0da:e9ff:fe74:594a%tapbr0Client:
Set the proxy:
coap proxy set coap://[fe80::a0ae:a2ff:fe2f:af16]:5683Send a request to the server:
coap get coap://[fe80::f0da:e9ff:fe74:594a]:5683/.well-known/coreAs you can see in the wireshark picture, the proxy uses different address toward the client and towards the server.
The same procedure does not work in
masterright now.Issues/PRs references
This is the next split out of #20696.