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

Add a minimal SRP client API #15

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Conversation

nand-nor
Copy link
Contributor

Description

Adds logic to expose minimal functionality for supporting SRP service registration (supports acting as client only). Also adds an example bin as well as a slight reworking of the examples dir to match the same style as present in the esp-hal crate. If accepted, this will be the first in a series of PRs working on this general area of functionality.

I opted to build the openthread libs with SRP functionality and include them precompiled, even though the SRP client functionality (as exposed via the publicly accessible Openthread object's methods) is gated via feature flag. This has the downside of making the openthread libs bigger even though a user of the esp-openthread crate may not want to ever use SRP. Do you have any thoughts on this @bjoernQ @jessebraham or preferences as to how this is handled? If this was a bad choice I can restructure the build.rs file in esp-openthread-sys to handle pulling in different libraries at build time, and include multiple copies of the various libs based on compile-time feature flags.

Testing

Tested with a v1.3 Border Router and esp32c6, running the srp-client-example bin. When running, should see logs like the following showing successful service registration and add proxying as output in the otbr-agent logs:

otbr-agent[1289574]: [INFO]-ADPROXY-: Advertise SRP service updates: host=ot-esp32.default.service.arpa.
otbr-agent[1289574]: [INFO]-ADPROXY-: Handle publish SRP host 'ot-esp32.default.service.arpa.': OK
otbr-agent[1289574]: [INFO]-ADPROXY-: Handle publish SRP service 'ot-service._ipps._tcp.default.service.arpa.': OK
otbr-agent[1289574]: 7d.09:39:43.782 [I] SrpServer-----: Handler result of SRP update (id = 1960774133) is received: OK
otbr-agent[1289574]: 7d.09:39:43.782 [I] SrpServer-----: Committing update for new host ot-esp32.default.service.arpa.
otbr-agent[1289574]: 7d.09:39:43.782 [I] SrpServer-----:     Granted lease:7200, key-lease:680400, ttl:7200
otbr-agent[1289574]: 7d.09:39:43.782 [I] SrpServer-----: Add new service 'ot-service._ipps._tcp.default.service.arpa.'
otbr-agent[1289574]: 7d.09:39:43.782 [I] SrpServer-----: Send success response with granted lease: 7200 and key lease: 680400
otbr-agent[1289574]: 7d.09:39:45.209 [I] SrpServer-----: Received DNS update from fd2e:c69b:fa93:1:d42a:bd6b:6419:29b
otbr-agent[1289574]: 7d.09:39:45.220 [I] SrpServer-----: Processed SRP update info
otbr-agent[1289574]: 7d.09:39:45.220 [I] SrpServer-----:     Host:ot-esp32.default.service.arpa.
otbr-agent[1289574]: 7d.09:39:45.220 [I] SrpServer-----:     Lease:7200, key-lease:1209600, ttl:7200
otbr-agent[1289574]: 7d.09:39:45.220 [I] SrpServer-----:     1 host address(es):
otbr-agent[1289574]: 7d.09:39:45.220 [I] SrpServer-----:       fd2e:c69b:fa93:1:d42a:bd6b:6419:29b
otbr-agent[1289574]: 7d.09:39:45.220 [I] SrpServer-----:     Adding service 'ot-service._ipps._tcp.default.service.arpa.'
otbr-agent[1289574]: 7d.09:39:45.220 [I] SrpServer-----: SRP update handler is notified (updatedId = 1960774134)

Also checked that add proxying is working; Im able to discover the service on the LAN using the service discovery app on my android phone, should also work with avahi-browse and/or dns-sd

Copy link
Collaborator

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you

This has the downside of making the openthread libs bigger even though a user of the esp-openthread crate may not want to ever use SRP.

I think it's fine - the precompiled libraries are quite small and luckily, we don't need to compile them to multiple architectures here. If that ever becomes a problem, we can revisit this but for now this is definitely not a problem

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