mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-21 23:29:39 +00:00
Updated setting default interfaces
This commit is contained in:
parent
35302addd5
commit
210abc775d
@ -30,25 +30,15 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
// The prioritized list of default interfaces
|
|
||||||
#define DEFAULT_INTERFACES "eth0,wlan0"
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Constructor
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
CTapDriver::CTapDriver(const list<string>& params)
|
CTapDriver::CTapDriver(const list<string>& params)
|
||||||
{
|
{
|
||||||
if (!params.empty()) {
|
if (!params.empty()) {
|
||||||
interfaces = params;
|
interfaces = params;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stringstream s(DEFAULT_INTERFACES);
|
// eth0 and wlan0 are the default interfaces
|
||||||
string interface;
|
interfaces.push_back("eth0");
|
||||||
while (getline(s, interface, ',')) {
|
interfaces.push_back("wlan0");
|
||||||
interfaces.push_back(interface);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
@ -410,11 +400,6 @@ void CTapDriver::OpenDump(const Filepath& path) {
|
|||||||
LOGTRACE("%s Opened %s for dumping", __PRETTY_FUNCTION__, path.GetPath());
|
LOGTRACE("%s Opened %s for dumping", __PRETTY_FUNCTION__, path.GetPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Cleanup
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
void CTapDriver::Cleanup()
|
void CTapDriver::Cleanup()
|
||||||
{
|
{
|
||||||
int br_socket_fd = -1;
|
int br_socket_fd = -1;
|
||||||
@ -444,11 +429,6 @@ void CTapDriver::Cleanup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Enable
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
bool CTapDriver::Enable(){
|
bool CTapDriver::Enable(){
|
||||||
int fd = socket(PF_INET, SOCK_DGRAM, 0);
|
int fd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
LOGDEBUG("%s: ip link set ras0 up", __PRETTY_FUNCTION__);
|
LOGDEBUG("%s: ip link set ras0 up", __PRETTY_FUNCTION__);
|
||||||
@ -457,11 +437,6 @@ bool CTapDriver::Enable(){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Disable
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
bool CTapDriver::Disable(){
|
bool CTapDriver::Disable(){
|
||||||
int fd = socket(PF_INET, SOCK_DGRAM, 0);
|
int fd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
LOGDEBUG("%s: ip link set ras0 down", __PRETTY_FUNCTION__);
|
LOGDEBUG("%s: ip link set ras0 down", __PRETTY_FUNCTION__);
|
||||||
@ -470,11 +445,6 @@ bool CTapDriver::Disable(){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Flush
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
BOOL CTapDriver::Flush(){
|
BOOL CTapDriver::Flush(){
|
||||||
LOGTRACE("%s", __PRETTY_FUNCTION__);
|
LOGTRACE("%s", __PRETTY_FUNCTION__);
|
||||||
while(PendingPackets()){
|
while(PendingPackets()){
|
||||||
@ -483,11 +453,6 @@ BOOL CTapDriver::Flush(){
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// MGet MAC Address
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
void CTapDriver::GetMacAddr(BYTE *mac)
|
void CTapDriver::GetMacAddr(BYTE *mac)
|
||||||
{
|
{
|
||||||
ASSERT(mac);
|
ASSERT(mac);
|
||||||
@ -495,11 +460,6 @@ void CTapDriver::GetMacAddr(BYTE *mac)
|
|||||||
memcpy(mac, m_MacAddr, sizeof(m_MacAddr));
|
memcpy(mac, m_MacAddr, sizeof(m_MacAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Receive
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
BOOL CTapDriver::PendingPackets()
|
BOOL CTapDriver::PendingPackets()
|
||||||
{
|
{
|
||||||
struct pollfd fds;
|
struct pollfd fds;
|
||||||
@ -519,11 +479,6 @@ BOOL CTapDriver::PendingPackets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Receive
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
int CTapDriver::Rx(BYTE *buf)
|
int CTapDriver::Rx(BYTE *buf)
|
||||||
{
|
{
|
||||||
ASSERT(m_hTAP != -1);
|
ASSERT(m_hTAP != -1);
|
||||||
@ -576,11 +531,6 @@ int CTapDriver::Rx(BYTE *buf)
|
|||||||
return dwReceived;
|
return dwReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Send
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
int CTapDriver::Tx(const BYTE *buf, int len)
|
int CTapDriver::Tx(const BYTE *buf, int len)
|
||||||
{
|
{
|
||||||
ASSERT(m_hTAP != -1);
|
ASSERT(m_hTAP != -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user