Question about SRP service creation #8320
Replies: 5 comments 8 replies
-
I have tried to use otSrpClientGetServices() to know the currently existing SRP services but it doesn't work: It is returning NULL (whereas I can see with Service Browser that the SRP service is present). I suspect that otSrpClientGetServices() can only be used to know the service started during current execution. I have rebooted the device so that's probably why it is not aware any more about this service. It that's correct, I think that only Solution 2 remains... |
Beta Was this translation helpful? Give feedback.
-
I have also tried to call otSrpClientRemoveHostAndServices() to remove an existing SRP service but it doesn't work. It fails with this error:
|
Beta Was this translation helpful? Give feedback.
-
An SRP client can unregister all host and services from the SRP server using otSrpClientRemoveHostAndServices(). Note, however, that SRP cryptographically signs all messages with a key. OpenThread's SRP Client stores the key in non-volatile memory, so this should work after a simple reboot. However, if you factory reset the device or otherwise delete the SRP client key from non-volatile storage in any way, the SRP client will not be able to update information that it had previously registered with the SRP server. |
Beta Was this translation helpful? Give feedback.
-
About the names,
The first device (SRP client) which registers a host name will be considered as the owner of that name by sever and only the same device (using the same SRP key) can change the registration (add/remove services, IPv6 addresses, or remove the host) for the same host name. If later another device tries to register the same host name it will be rejected by server. |
Beta Was this translation helpful? Give feedback.
-
@jwhui I don't know what I could have done wrong but what you described doesn't work for me.
I then click on reset button. Do you know what I could have done wrong? Is it necessary to save the OT data in NVM after the creation of the SRP service?
That's just a guess... |
Beta Was this translation helpful? Give feedback.
-
I have recently changed my application to use the persistent memory. By this way, if I commission a Thread device and reboot it, it will be able to reconnect to the Thread network. I have implemented it and it works.
This leads me to some questions about SRP:
Once the device reconnected to Thread network, I want to ensure that it indicates its presence via SRP.
2 cases are possible:
I'm wondering what is the nice way to handle this.
I have thought to the following possibilities:
Solution 1:
Once the device reconnected on Thread network, use otSrpClientGetServices() to know if a SRP service with a special name is present (the name if the name of my service followed by the EUI64 of the device).
Solution 2:
Try to do the SRP registration every times. If the SRP is already present, it will fail with the error OT_ERROR_DUPLICATED.
In that case I will probably have to cancel the registration otherwise there is an automatic retry.
Solution 3:
Once the device reconnected on Thread network, use otSrpClientGetServices() and otSrpClientRemoveService() to remove a possibly existing service with the same name and then recreate it.
Can you please tell me what is the recommended way?
Is it a problem if all my devices use the same SRP Host name but a different SRP Service name? As indicated above the service name would contain the EUI64 of the device.
Exemple:
Host name: "ot-st25-host"
Service Instance name: "ot-st25-service-0080e105005ec74a"
Thank you
Beta Was this translation helpful? Give feedback.
All reactions