diff --git a/src/core/config/mdns.h b/src/core/config/mdns.h index 61d82a685..508e2f787 100644 --- a/src/core/config/mdns.h +++ b/src/core/config/mdns.h @@ -95,6 +95,25 @@ #define OPENTHREAD_CONFIG_MULTICAST_DNS_DEFAULT_QUESTION_UNICAST_ALLOWED 1 #endif +/** + * @def OPENTHREAD_CONFIG_MULTICAST_DNS_PERSIST_STATE_ON_POST_PROBE_CONFLICT + * + * Specifies the behavior of the mDNS module when a late conflict is detected. A late conflict occurs after a name has + * been successfully probed and claimed (post-probe). When enabled, the mDNS module will continue advertising/answering + * for the claimed name. The device essentially prioritizes the stability of the established advertisement. When + * disabled the mDNS module will transition the entry to the "conflict" state and stop answering/advertising for the + * name. Regardless of this configuration, the conflict callback is still invoked, informing other modules (such as the + * module that requested the registration) so they can decide on a higher-level resolution action. + * + * This configuration is enabled by default, especially in Thread use cases like the SRP Advertising Proxy. This is + * because post-probe conflicts are often transient or benign in these environments. Since the device (acting as + * the SRP Server) has already accepted an SRP registration from a remote Thread Node (SRP client), it is desirable for + * the mDNS advertisement to mirror the SRP registered service and maintain its discoverability. + */ +#ifndef OPENTHREAD_CONFIG_MULTICAST_DNS_PERSIST_STATE_ON_POST_PROBE_CONFLICT +#define OPENTHREAD_CONFIG_MULTICAST_DNS_PERSIST_STATE_ON_POST_PROBE_CONFLICT 1 +#endif + /** * @def OPENTHREAD_CONFIG_MULTICAST_DNS_VERBOSE_LOGGING_ENABLE * diff --git a/src/core/net/mdns.cpp b/src/core/net/mdns.cpp index 53da710d9..4b2290f20 100644 --- a/src/core/net/mdns.cpp +++ b/src/core/net/mdns.cpp @@ -1351,9 +1351,15 @@ void Core::Entry::SetStateToConflict(void) switch (GetState()) { case kProbing: - case kRegistered: SetState(kConflict); break; + + case kRegistered: +#if !OPENTHREAD_CONFIG_MULTICAST_DNS_PERSIST_STATE_ON_POST_PROBE_CONFLICT + SetState(kConflict); +#endif + break; + case kConflict: case kRemoving: break;