diff --git a/src/core/net/srp_server.cpp b/src/core/net/srp_server.cpp index a065880ce..f31244c3c 100644 --- a/src/core/net/srp_server.cpp +++ b/src/core/net/srp_server.cpp @@ -1296,6 +1296,48 @@ exit: void Server::InformUpdateHandlerOrCommit(Error aError, Host &aHost, const MessageMetadata &aMetadata) { +#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO) + if (aError == kErrorNone) + { + uint8_t numAddrs; + const Ip6::Address *addrs; + + LogInfo("Processed DNS update info"); + LogInfo(" Host:%s", aHost.GetFullName()); + LogInfo(" Lease:%u, key-lease:%u, ttl:%u", aHost.GetLease(), aHost.GetKeyLease(), aHost.GetTtl()); + + addrs = aHost.GetAddresses(numAddrs); + + if (numAddrs == 0) + { + LogInfo(" No host address"); + } + else + { + LogInfo(" %d host address(es):", numAddrs); + + for (; numAddrs > 0; addrs++, numAddrs--) + { + LogInfo(" %s", addrs->ToString().AsCString()); + } + } + + for (const Service &service : aHost.GetServices()) + { + char subLabel[Dns::Name::kMaxLabelSize]; + + IgnoreError(service.GetServiceSubTypeLabel(subLabel, sizeof(subLabel))); + + LogInfo(" %s service '%s'%s%s", service.IsDeleted() ? "Deleting" : "Adding", service.GetInstanceName(), + service.IsSubType() ? " subtype:" : "", subLabel); + } + } + else + { + LogInfo("Error %s processing received DNS update", ErrorToString(aError)); + } +#endif // OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO) + if ((aError == kErrorNone) && (mServiceUpdateHandler != nullptr)) { UpdateMetadata *update = UpdateMetadata::Allocate(GetInstance(), aHost, aMetadata); @@ -1740,7 +1782,7 @@ void Server::Service::Log(Action aAction) const "Update existing", // (1) kUpdateExisting "Remove but retain name of", // (2) kRemoveButRetainName "Fully remove", // (3) kFullyRemove - "LEASE expired for ", // (4) kLeaseExpired + "LEASE expired for", // (4) kLeaseExpired "KEY LEASE expired for", // (5) kKeyLeaseExpired };