Skip to content

Preserve the observe request's local address for notifications - #2146

Merged
mrdeep1 merged 1 commit into
obgm:developfrom
michieldwitte:develop
Sep 7, 2026
Merged

Preserve the observe request's local address for notifications#2146
mrdeep1 merged 1 commit into
obgm:developfrom
michieldwitte:develop

Conversation

@michieldwitte

Copy link
Copy Markdown

Packets from the same peer can overwrite a session's local address with a multicast destination. Save the address when an observation is created or renewed and restore it before generating notifications, so deferred responses snapshot the correct address instead of being dropped as invalid multicast.

Add regression coverage for CON and NON observations, including renewals and the local address captured by a notification's async response.

Validation: 215 unit tests passed (1712 assertions).

@mrdeep1 mrdeep1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for doing this work.

Only a generic comment to code ordering.

Comment thread tests/test_session.c Outdated
Comment on lines +77 to +79
coap_add_resource(ctx, resource);
coap_resource_set_get_observable(resource, 1);
coap_register_request_handler(resource, COAP_REQUEST_GET, observe_address_handler);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As a general comment, coap_add_resource() should be the last thing called when setting up a resource, as a multi-threaded server could start acting on the partially set up resource on another thread.

Packets from the same peer can overwrite a session's local address with a
multicast destination. Save the address when an observation is created or
renewed and restore it before generating notifications, so deferred responses
snapshot the correct address instead of being dropped as invalid multicast.

Add regression coverage for CON and NON observations, including renewals and
the local address captured by a notification's async response.

Validation: 215 unit tests passed (1712 assertions).
@mrdeep1

mrdeep1 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

LGTM

@mrdeep1
mrdeep1 merged commit e61c8c8 into obgm:develop Sep 7, 2026
60 checks passed
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.

2 participants