mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 00:57:47 +00:00
[posix] expose platformInfraIfIsRunning() as otSysInfraIfIsRunning() (#9672)
When we are switching to another infra netif via `otBorderRoutingInit()`, we may want to read the state of the new infra netif via `otSysInfraIfIsRunning()`.
This commit is contained in:
@@ -246,6 +246,14 @@ void otSysCountInfraNetifAddresses(otSysInfraNetIfAddressCounters *aAddressCount
|
||||
*/
|
||||
void otSysSetInfraNetif(const char *aInfraNetifName, int aIcmp6Socket);
|
||||
|
||||
/**
|
||||
* Returns TRUE if the infrastructure interface is running.
|
||||
*
|
||||
* @returns TRUE if the infrastructure interface is running, FALSE if not.
|
||||
*
|
||||
*/
|
||||
bool otSysInfraIfIsRunning(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // end of extern "C"
|
||||
#endif
|
||||
|
||||
@@ -112,7 +112,7 @@ otError otPlatInfraIfDiscoverNat64Prefix(uint32_t aInfraIfIndex)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool platformInfraIfIsRunning(void) { return ot::Posix::InfraNetif::Get().IsRunning(); }
|
||||
bool otSysInfraIfIsRunning(void) { return ot::Posix::InfraNetif::Get().IsRunning(); }
|
||||
|
||||
const char *otSysGetInfraNetifName(void) { return ot::Posix::InfraNetif::Get().GetNetifName(); }
|
||||
|
||||
@@ -452,7 +452,7 @@ void InfraNetif::SetUp(void)
|
||||
VerifyOrExit(mNetLinkSocket != -1);
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
SuccessOrDie(otBorderRoutingInit(gInstance, mInfraIfIndex, platformInfraIfIsRunning()));
|
||||
SuccessOrDie(otBorderRoutingInit(gInstance, mInfraIfIndex, otSysInfraIfIsRunning()));
|
||||
SuccessOrDie(otBorderRoutingSetEnabled(gInstance, /* aEnabled */ true));
|
||||
#endif
|
||||
|
||||
@@ -546,7 +546,7 @@ void InfraNetif::ReceiveNetLinkMessage(void)
|
||||
case RTM_NEWLINK:
|
||||
case RTM_DELLINK:
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||
SuccessOrDie(otPlatInfraIfStateChanged(gInstance, mInfraIfIndex, platformInfraIfIsRunning()));
|
||||
SuccessOrDie(otPlatInfraIfStateChanged(gInstance, mInfraIfIndex, otSysInfraIfIsRunning()));
|
||||
#endif
|
||||
break;
|
||||
case NLMSG_ERROR:
|
||||
|
||||
@@ -415,14 +415,6 @@ extern unsigned int gNetifIndex;
|
||||
*/
|
||||
extern otInstance *gInstance;
|
||||
|
||||
/**
|
||||
* Tells if the infrastructure interface is running.
|
||||
*
|
||||
* @returns TRUE if the infrastructure interface is running, FALSE if not.
|
||||
*
|
||||
*/
|
||||
bool platformInfraIfIsRunning(void);
|
||||
|
||||
/**
|
||||
* Initializes backtrace module.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user