Skip to content

Commit

Permalink
Updated setting default interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Sep 5, 2021
1 parent 35302ad commit 210abc7
Showing 1 changed file with 3 additions and 53 deletions.
56 changes: 3 additions & 53 deletions src/raspberrypi/devices/ctapdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,15 @@

using namespace std;

// The prioritized list of default interfaces
#define DEFAULT_INTERFACES "eth0,wlan0"

//---------------------------------------------------------------------------
//
// Constructor
//
//---------------------------------------------------------------------------
CTapDriver::CTapDriver(const list<string>& params)
{
if (!params.empty()) {
interfaces = params;
}
else {
stringstream s(DEFAULT_INTERFACES);
string interface;
while (getline(s, interface, ',')) {
interfaces.push_back(interface);
}
// eth0 and wlan0 are the default interfaces
interfaces.push_back("eth0");
interfaces.push_back("wlan0");
}

// Initialization
Expand Down Expand Up @@ -410,11 +400,6 @@ void CTapDriver::OpenDump(const Filepath& path) {
LOGTRACE("%s Opened %s for dumping", __PRETTY_FUNCTION__, path.GetPath());
}

//---------------------------------------------------------------------------
//
// Cleanup
//
//---------------------------------------------------------------------------
void CTapDriver::Cleanup()
{
int br_socket_fd = -1;
Expand Down Expand Up @@ -444,11 +429,6 @@ void CTapDriver::Cleanup()
}
}

//---------------------------------------------------------------------------
//
// Enable
//
//---------------------------------------------------------------------------
bool CTapDriver::Enable(){
int fd = socket(PF_INET, SOCK_DGRAM, 0);
LOGDEBUG("%s: ip link set ras0 up", __PRETTY_FUNCTION__);
Expand All @@ -457,11 +437,6 @@ bool CTapDriver::Enable(){
return result;
}

//---------------------------------------------------------------------------
//
// Disable
//
//---------------------------------------------------------------------------
bool CTapDriver::Disable(){
int fd = socket(PF_INET, SOCK_DGRAM, 0);
LOGDEBUG("%s: ip link set ras0 down", __PRETTY_FUNCTION__);
Expand All @@ -470,11 +445,6 @@ bool CTapDriver::Disable(){
return result;
}

//---------------------------------------------------------------------------
//
// Flush
//
//---------------------------------------------------------------------------
BOOL CTapDriver::Flush(){
LOGTRACE("%s", __PRETTY_FUNCTION__);
while(PendingPackets()){
Expand All @@ -483,23 +453,13 @@ BOOL CTapDriver::Flush(){
return TRUE;
}

//---------------------------------------------------------------------------
//
// MGet MAC Address
//
//---------------------------------------------------------------------------
void CTapDriver::GetMacAddr(BYTE *mac)
{
ASSERT(mac);

memcpy(mac, m_MacAddr, sizeof(m_MacAddr));
}

//---------------------------------------------------------------------------
//
// Receive
//
//---------------------------------------------------------------------------
BOOL CTapDriver::PendingPackets()
{
struct pollfd fds;
Expand All @@ -519,11 +479,6 @@ BOOL CTapDriver::PendingPackets()
}
}

//---------------------------------------------------------------------------
//
// Receive
//
//---------------------------------------------------------------------------
int CTapDriver::Rx(BYTE *buf)
{
ASSERT(m_hTAP != -1);
Expand Down Expand Up @@ -576,11 +531,6 @@ int CTapDriver::Rx(BYTE *buf)
return dwReceived;
}

//---------------------------------------------------------------------------
//
// Send
//
//---------------------------------------------------------------------------
int CTapDriver::Tx(const BYTE *buf, int len)
{
ASSERT(m_hTAP != -1);
Expand Down

0 comments on commit 210abc7

Please sign in to comment.