mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Netcon build fixes.
This commit is contained in:
parent
1f4c667646
commit
bf4cab5f2f
2 changed files with 20 additions and 17 deletions
|
@ -44,7 +44,7 @@ NetconEthernetTap::NetconEthernetTap(
|
||||||
const char *friendlyName,
|
const char *friendlyName,
|
||||||
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
|
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
|
||||||
void *arg) :
|
void *arg) :
|
||||||
_phy(this,false,true),
|
_phy(new Phy<NetconEthernetTap *>(this,false,true)),
|
||||||
_unixListenSocket((PhySocket *)0),
|
_unixListenSocket((PhySocket *)0),
|
||||||
_handler(handler),
|
_handler(handler),
|
||||||
_arg(arg),
|
_arg(arg),
|
||||||
|
@ -61,7 +61,7 @@ NetconEthernetTap::NetconEthernetTap(
|
||||||
Utils::snprintf(sockPath,sizeof(sockPath),"/tmp/.ztnc_%.16llx",(unsigned long long)nwid);
|
Utils::snprintf(sockPath,sizeof(sockPath),"/tmp/.ztnc_%.16llx",(unsigned long long)nwid);
|
||||||
_dev = sockPath;
|
_dev = sockPath;
|
||||||
|
|
||||||
_unixListenSocket = _phy.unixListen(sockPath,(void *)this);
|
_unixListenSocket = _phy->unixListen(sockPath,(void *)this);
|
||||||
if (!_unixListenSocket)
|
if (!_unixListenSocket)
|
||||||
throw std::runtime_error(std::string("unable to bind to ")+sockPath);
|
throw std::runtime_error(std::string("unable to bind to ")+sockPath);
|
||||||
|
|
||||||
|
@ -71,10 +71,11 @@ NetconEthernetTap::NetconEthernetTap(
|
||||||
NetconEthernetTap::~NetconEthernetTap()
|
NetconEthernetTap::~NetconEthernetTap()
|
||||||
{
|
{
|
||||||
_run = false;
|
_run = false;
|
||||||
_phy.whack();
|
_phy->whack();
|
||||||
_phy.whack();
|
_phy->whack();
|
||||||
Thread::join(_thread);
|
Thread::join(_thread);
|
||||||
_phy.close(_unixListenSocket,false);
|
_phy->close(_unixListenSocket,false);
|
||||||
|
delete _phy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetconEthernetTap::setEnabled(bool en)
|
void NetconEthernetTap::setEnabled(bool en)
|
||||||
|
@ -126,7 +127,7 @@ void NetconEthernetTap::threadMain()
|
||||||
|
|
||||||
// TODO: compute timeout from LWIP stuff
|
// TODO: compute timeout from LWIP stuff
|
||||||
|
|
||||||
_phy.poll(pollTimeout);
|
_phy->poll(pollTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: cleanup -- destroy LWIP state, kill any clients, unload .so, etc.
|
// TODO: cleanup -- destroy LWIP state, kill any clients, unload .so, etc.
|
||||||
|
|
|
@ -45,12 +45,14 @@
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
class NetconEthernetTap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network Containers instance -- emulates an Ethernet tap device as far as OneService knows
|
* Network Containers instance -- emulates an Ethernet tap device as far as OneService knows
|
||||||
*/
|
*/
|
||||||
class NetconEthernetTap
|
class NetconEthernetTap
|
||||||
{
|
{
|
||||||
friend class Phy<NetconEthernetTap>;
|
friend class Phy<NetconEthernetTap *>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetconEthernetTap(
|
NetconEthernetTap(
|
||||||
|
@ -93,7 +95,7 @@ private:
|
||||||
void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int);
|
void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int);
|
||||||
void *_arg;
|
void *_arg;
|
||||||
|
|
||||||
Phy<NetconEthernetTap> _phy;
|
Phy<NetconEthernetTap *> *_phy;
|
||||||
PhySocket *_unixListenSocket;
|
PhySocket *_unixListenSocket;
|
||||||
|
|
||||||
uint64_t _nwid;
|
uint64_t _nwid;
|
||||||
|
|
Loading…
Add table
Reference in a new issue