gcoap: Do not send responses from multicast addresses#19272
Merged
bors[bot] merged 2 commits intoRIOT-OS:masterfrom Feb 14, 2023
Merged
gcoap: Do not send responses from multicast addresses#19272bors[bot] merged 2 commits intoRIOT-OS:masterfrom
bors[bot] merged 2 commits intoRIOT-OS:masterfrom
Conversation
benpicco
approved these changes
Feb 13, 2023
Member
Author
|
Thanks bors merge |
bors bot
added a commit
that referenced
this pull request
Feb 13, 2023
18257: drivers/wdt: add periph_wdt_auto_start for early watchdog r=benpicco a=benpicco 19272: gcoap: Do not send responses from multicast addresses r=chrysn a=chrysn ### Contribution description Since #18026, CoAP requests to multicast addresses (eg. `ff02::1`) came back from that exact address, which Linux rightfully just drops. The fix uses the existing multicast check from #17978 (thanks `@benpicco` for making me write this as dedicated function, I just had to generalize it removing one struct layer), and foregoes setting the source address when responding to multicasts. ### Testing procedure * Run the gcoap example * Send a CoAP request to a multicast address RIOT listens to, eg. `./aiocoap-client coap://'[ff02::1%tapbr0]'/.well-known/core --non` Before, this got no response (while you see it arrive on wireshark). After, you get a correct response with two lines of note: ``` WARNING:coap:Sending request to multicast via unicast request method Response arrived from different address; base URI is coap://[fe80::3c63:beff:fe85:ca96%tapbr0]/.well-known/core ``` (The former is aiocoap telling us that we're not using the nonexistent multicast API so it's really more of an anycast, the latter is useful factual information). Co-authored-by: Benjamin Valentin <[email protected]> Co-authored-by: chrysn <[email protected]>
OlegHahm
reviewed
Feb 13, 2023
| .local = aux_in.local, | ||
| }; | ||
| if (_ep_is_multicast(&aux_in.local)) { | ||
| aux_out_ptr = NULL; |
Member
There was a problem hiding this comment.
Probably I'm too late, but a comment about the semantics of setting this pointer to NULL here would have been nice.
Member
Author
There was a problem hiding this comment.
Good point, given it takes several indirections before this wins up in a function where one can read the documentation.
Comment added, let's see how mad bors will get at me for throwing logs before its merge train.
96cabee to
ac3a9cd
Compare
Contributor
|
Canceled. |
Member
Author
|
bors merge |
Contributor
|
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
Contributor
|
GitHub status checks took too long to complete, so bors is giving up. You can adjust bors configuration to have it wait longer if you like. |
Contributor
|
bors merge |
Contributor
|
Build succeeded: |
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
Since #18026, CoAP requests to multicast addresses (eg.
ff02::1) came back from that exact address, which Linux rightfully just drops.The fix uses the existing multicast check from #17978 (thanks @benpicco for making me write this as dedicated function, I just had to generalize it removing one struct layer), and foregoes setting the source address when responding to multicasts.
Testing procedure
./aiocoap-client coap://'[ff02::1%tapbr0]'/.well-known/core --nonBefore, this got no response (while you see it arrive on wireshark). After, you get a correct response with two lines of note:
(The former is aiocoap telling us that we're not using the nonexistent multicast API so it's really more of an anycast, the latter is useful factual information).