Updated setting default interfaces

This commit is contained in:
Uwe Seimet 2021-09-05 19:04:33 +02:00
parent 35302addd5
commit 210abc775d

View File

@ -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
@ -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;
@ -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__);
@ -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__);
@ -470,11 +445,6 @@ bool CTapDriver::Disable(){
return result;
}
//---------------------------------------------------------------------------
//
// Flush
//
//---------------------------------------------------------------------------
BOOL CTapDriver::Flush(){
LOGTRACE("%s", __PRETTY_FUNCTION__);
while(PendingPackets()){
@ -483,11 +453,6 @@ BOOL CTapDriver::Flush(){
return TRUE;
}
//---------------------------------------------------------------------------
//
// MGet MAC Address
//
//---------------------------------------------------------------------------
void CTapDriver::GetMacAddr(BYTE *mac)
{
ASSERT(mac);
@ -495,11 +460,6 @@ void CTapDriver::GetMacAddr(BYTE *mac)
memcpy(mac, m_MacAddr, sizeof(m_MacAddr));
}
//---------------------------------------------------------------------------
//
// Receive
//
//---------------------------------------------------------------------------
BOOL CTapDriver::PendingPackets()
{
struct pollfd fds;
@ -519,11 +479,6 @@ BOOL CTapDriver::PendingPackets()
}
}
//---------------------------------------------------------------------------
//
// Receive
//
//---------------------------------------------------------------------------
int CTapDriver::Rx(BYTE *buf)
{
ASSERT(m_hTAP != -1);
@ -576,11 +531,6 @@ int CTapDriver::Rx(BYTE *buf)
return dwReceived;
}
//---------------------------------------------------------------------------
//
// Send
//
//---------------------------------------------------------------------------
int CTapDriver::Tx(const BYTE *buf, int len)
{
ASSERT(m_hTAP != -1);