mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 23:27:46 +00:00
[srp-server] allow service instance label with dot character (#9198)
This commit updates the `Srp::Server` class to correctly handle the case where a service is registered with a dot character in its service instance name. The first label in a service instance name is intended as a user-friendly name and can contain dot characters (it has fewer restrictions than other labels in a DNS name). In particular, this commit contains the following changes: - The `PtrRecords::ReadPtrName()` method is used in `Srp::Server` to read and validate the first label and the rest of the labels separately. This also validates the format of the parsed PTR record. - The `Service::Description` class now remembers the instance label in addition to the full instance name. This allows the instance label to be easily retrieved. - The `Dns::Name::ReadName()` method is updated to only verify that the labels after the first label do not contain any dot characters. This allows it to be used to read instance service names. - The tests are updated to validate the behavior of the SRP server when the instance label contains a dot character.
This commit is contained in:
@@ -287,7 +287,7 @@ static const char kHostName[] = "myhost";
|
||||
void PrepareService1(Srp::Client::Service &aService)
|
||||
{
|
||||
static const char kServiceName[] = "_srv._udp";
|
||||
static const char kInstanceLabel[] = "srv-instance";
|
||||
static const char kInstanceLabel[] = "srv.instance";
|
||||
static const char kSub1[] = "_sub1";
|
||||
static const char kSub2[] = "_V1234567";
|
||||
static const char kSub3[] = "_XYZWS";
|
||||
|
||||
Reference in New Issue
Block a user