diff --git a/src/posix/platform/infra_if.cpp b/src/posix/platform/infra_if.cpp index def69f4d9..3c1948c6e 100644 --- a/src/posix/platform/infra_if.cpp +++ b/src/posix/platform/infra_if.cpp @@ -33,7 +33,7 @@ #include "platform-posix.h" -#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#if OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE #ifdef __APPLE__ #define __APPLE_USE_RFC_3542 @@ -682,4 +682,4 @@ InfraNetif &InfraNetif::Get(void) } // namespace Posix } // namespace ot -#endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#endif // OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE diff --git a/src/posix/platform/infra_if.hpp b/src/posix/platform/infra_if.hpp index f9cd86fb3..6885ce15a 100644 --- a/src/posix/platform/infra_if.hpp +++ b/src/posix/platform/infra_if.hpp @@ -39,7 +39,7 @@ #include "core/common/non_copyable.hpp" #include "posix/platform/mainloop.hpp" -#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#if OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE namespace ot { namespace Posix { @@ -177,4 +177,4 @@ private: } // namespace Posix } // namespace ot -#endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#endif // OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE diff --git a/src/posix/platform/openthread-posix-config.h b/src/posix/platform/openthread-posix-config.h index 891ad7f45..88a463dd7 100644 --- a/src/posix/platform/openthread-posix-config.h +++ b/src/posix/platform/openthread-posix-config.h @@ -323,4 +323,16 @@ #ifndef OPENTHREAD_POSIX_CONFIG_ANDROID_ENABLE #define OPENTHREAD_POSIX_CONFIG_ANDROID_ENABLE 0 #endif + +/** + * @def OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE + * + * Defines `1` to enable the posix implementation of platform/infra_if.h APIs. + * The default value is set to `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` if it's + * not explicit defined. + */ +#ifndef OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE +#define OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#endif + #endif // OPENTHREAD_PLATFORM_CONFIG_H_ diff --git a/src/posix/platform/system.cpp b/src/posix/platform/system.cpp index 081afbdc0..d74512efa 100644 --- a/src/posix/platform/system.cpp +++ b/src/posix/platform/system.cpp @@ -142,7 +142,7 @@ void platformInit(otPlatformConfig *aPlatformConfig) platformBackboneInit(aPlatformConfig->mBackboneInterfaceName); #endif -#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#if OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE ot::Posix::InfraNetif::Get().Init(aPlatformConfig->mBackboneInterfaceName); #endif @@ -181,7 +181,7 @@ void platformSetUp(void) platformBackboneSetUp(); #endif -#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#if OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE ot::Posix::InfraNetif::Get().SetUp(); #endif @@ -236,7 +236,7 @@ void platformTearDown(void) platformNetifTearDown(); #endif -#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#if OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE ot::Posix::InfraNetif::Get().TearDown(); #endif @@ -268,7 +268,7 @@ void platformDeinit(void) platformTrelDeinit(); #endif -#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#if OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE ot::Posix::InfraNetif::Get().Deinit(); #endif