Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void TapEthernetSystem::run()

void TapEthernetSystem::shutdown()
{
_driver.stop();
_rxTimeout.cancel();
transitionDone();
}
Expand Down
24 changes: 21 additions & 3 deletions platforms/posix/bsp/tapEthernetDriver/src/TapEthernetDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,29 @@ TapEthernetDriver::TapEthernetDriver(::etl::array<uint8_t const, 6> const macAdd

bool TapEthernetDriver::start(char const* const ifName)
{
_tapFd = allocTapInterface(ifName);
return _tapFd >= 0;
if (_tapFd >= 0)
{
close(_tapFd);
_tapFd = -1;
}

int const fd = allocTapInterface(ifName);
if (fd < 0)
{
return false;
}
_tapFd = fd;
return true;
}

void TapEthernetDriver::stop() { _tapFd = -1; }
void TapEthernetDriver::stop()
{
if (_tapFd >= 0)
{
close(_tapFd);
_tapFd = -1;
}
}

void TapEthernetDriver::readFrame()
{
Expand Down
Loading