feat(protocol): discover advertised OCF secure ports - #36
Conversation
|
Thanks for taking this on. Two things I'd like to work through before merging, both about scope rather than correctness. The CoAP layer
Two CoAP implementations in one package means every wire-level fix has to be made twice, and the Samsung-specific ones are the ones that hurt. Token-stable Block2 and the ACK-plus-separate-CON pattern took a long time to get right in the session; a second parser that hasn't met those devices will rediscover them the hard way. Can the discovery path build on Two entry points, and what they add over probingThe PR ships
What I'd like to doLand the known-host unicast path on its own, built on Your bounds work is the strongest part of this and I'd keep all of it: the shared deadline across retries, the per-round datagram cap, the exact normalized Happy to look at a reduced version whenever you have time. If you'd rather I did the |
1ca0875 to
a9b7af6
Compare
|
Thanks — I followed the reduced-scope direction and updated the branch myself.
One clarification on the held multicast path: WD86 is shorthand here for the observed internal SmartThings/firmware family Validation on the updated head:
The new GitHub Actions run is currently awaiting maintainer approval, so I am not carrying forward the previous head's 8/8 result. |
a9b7af6 to
9d221a9
Compare
|
I’ve updated the branch again after rebasing the reduced known-host-only PR onto current
The updated head is |
|
Tested this branch against two older-firmware Samsung devices — a soundbar ( Both work, via the doxm fallback: Neither device has an That costs a full wasted directory fetch each time: One other thing: neither device advertises its plaintext port — unsecured links are "sec": false with no port key. On this firmware the port is ephemeral and changes on every reboot, and 5683 isn't listening, so discovery_port has to be established before this API can be called. The intended route is multicast GET /oic/res to 224.0.1.187, where the reply's source port is the answer; that worked intermittently for me (my AP's IGMP snooping entry for the group ages out, and the TV never joins at all), so I fell back to sweeping with a CON GET /oic/res probe, ~11 s for the full range. Might be worth a docstring line, since the discovery_port=5683 default quietly assumes this is already solved. Happy to re-run anything against either device. |
9d221a9 to
107e61b
Compare
|
@vmonkey Thanks — the two-device results and the concrete Block2 measurements are very helpful. Both observations are valid.
The documentation update is now at |
|
@QuiteYellow The current head ( The latest change only clarifies the Additional Family Hub testing also confirmed the value of this path against a moved secure port: Could you approve the new Validate workflow and confirm whether the current reduced revision matches the requested scope? https://github.com/QuiteYellow/SmartThings-Local/actions/runs/32460555370 |
5caa883 to
8bd4697
Compare
|
The workflow is approved and green on Scope matches. What I do need changedFour things, all in 1. 2. 3. The Samsung behaviour is now the non-default path. The session builds its accumulator with 4. The test-compatibility branch at On point 1, hold off before changing anything. #56 covers it: @mbillow's #54 adds Point 2 is a live bug rather than style, so I would like that one regardless of how #56 lands. If you would rather split the session changes into their own PR and let the discovery module land on top, that works too, and it would make both easier to review. The |
Summary
discover_ocf_secure_ports()API for device-advertised OCF secure portsprotocol/coap.py/oic/resfirst for source-boundcoapsendpoints, then fall back to/oic/res?rt=oic.r.doxmwithin the same monotonic deadlineWhat directory discovery adds
probe_dtls_ports()verifies only the candidate ports supplied by its caller. Directory discovery obtains the ports advertised by the device itself, including valid dynamic ports outside a caller's fixed candidate band, and then lets the caller pass those candidates to the existing stateless probe.This distinction is also visible in the current issue #16 evidence: the advertised secure endpoint can fall outside both the standard OCF port and the bridge's fixed dynamic candidates. Discovery therefore generates candidates; probing verifies listeners. Neither step authenticates a device by itself.
Scope and WD86 context
Following the maintainer feedback, this revision contains only the known-host unicast API. The identity-aware multicast API has been removed from this PR and preserved on
atc722:agent/ocf-identity-multicast-heldfor a later proposal with a concrete caller.In this discussion, WD86 is shorthand for the observed internal SmartThings/firmware family
AWM-KR-M64-24-WD86of a Samsung washer-dryer combo (oic.d.washer); it is not presented as a retail model number. Redacted testing showed that its OCF host can expose multiple logical device containers, so exactdi-to-source-to-endpoint binding is still required by that downstream target-selection path. The package does not yet have a production caller for that multicast API, which is why it is held rather than included here. Device-specific addresses, UUIDs, and advertised port values are intentionally omitted.Bounds and safety
coapsendpoints; no DNS lookup of an advertised hostnameValidation
python -m pytest -q: 328 passed locally on Python 3.13git diff --check origin/main...HEADpython tools/check_share_safety.py --changed-since origin/mainThe repository CI matrix remains responsible for Python 3.11, 3.12, and 3.14 coverage on the updated head.