[posix] add an option to disable resolv.conf on initialization (#11343)

On Android we didn't have a chance to disable reading from
`resolv.conf` at initialization of `Resolver`. This caused a logging
line at critical level which could be confusing.
This commit is contained in:
Handa Wang
2025-03-17 09:08:44 -05:00
committed by GitHub
parent c8fa6e3b8f
commit 6ed39e657b
2 changed files with 10 additions and 1 deletions
@@ -435,4 +435,13 @@
#define OPENTHREAD_POSIX_CONFIG_TMP_STORAGE_ENABLE 1
#endif
/**
* @def OPENTHREAD_POSIX_CONFIG_RESOLV_CONF_ENABLED_INIT
*
* Define as 1 to enable reading from resolv.conf on initialization.
*/
#ifndef OPENTHREAD_POSIX_CONFIG_RESOLV_CONF_ENABLED_INIT
#define OPENTHREAD_POSIX_CONFIG_RESOLV_CONF_ENABLED_INIT (!OPENTHREAD_POSIX_CONFIG_ANDROID_ENABLE)
#endif
#endif // OPENTHREAD_PLATFORM_POSIX_CONFIG_H_
+1 -1
View File
@@ -123,7 +123,7 @@ private:
void TryRefreshDnsServerList(void);
void LoadDnsServerListFromConf(void);
bool mIsResolvConfEnabled = true;
bool mIsResolvConfEnabled = OPENTHREAD_POSIX_CONFIG_RESOLV_CONF_ENABLED_INIT;
uint32_t mUpstreamDnsServerCount = 0;
otIp6Address mUpstreamDnsServerList[kMaxUpstreamServerCount];
uint64_t mUpstreamDnsServerListFreshness = 0;