mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 13:47:47 +00:00
[posix] add platformNetifDeinit (#4726)
Close netif file descriptors to re-open after reset.
This commit is contained in:
@@ -384,6 +384,29 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void platformNetifDeinit(void)
|
||||
{
|
||||
if (sTunFd != -1)
|
||||
{
|
||||
close(sTunFd);
|
||||
sTunFd = -1;
|
||||
}
|
||||
|
||||
if (sIpFd != -1)
|
||||
{
|
||||
close(sIpFd);
|
||||
sIpFd = -1;
|
||||
}
|
||||
|
||||
if (sNetlinkFd != -1)
|
||||
{
|
||||
close(sNetlinkFd);
|
||||
sNetlinkFd = -1;
|
||||
}
|
||||
|
||||
sTunIndex = 0;
|
||||
}
|
||||
|
||||
void platformNetifInit(otInstance *aInstance, const char *aInterfaceName)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
|
||||
@@ -217,6 +217,12 @@ void platformRadioInit(const otPlatformConfig *aPlatformConfig);
|
||||
*/
|
||||
void platformRadioDeinit(void);
|
||||
|
||||
/**
|
||||
* This function shuts down platform network interface.
|
||||
*
|
||||
*/
|
||||
void platformNetifDeinit(void);
|
||||
|
||||
/**
|
||||
* This function inputs a received radio frame.
|
||||
*
|
||||
|
||||
@@ -73,6 +73,9 @@ void otSysDeinit(void)
|
||||
virtualTimeDeinit();
|
||||
#endif
|
||||
platformRadioDeinit();
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
|
||||
platformNetifDeinit();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if OPENTHREAD_POSIX_VIRTUAL_TIME
|
||||
|
||||
Reference in New Issue
Block a user