mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Merge branch 'dev' of https://github.com/zerotier/ZeroTierOne into dev
This commit is contained in:
commit
ae70db0535
4 changed files with 10 additions and 26 deletions
|
@ -48,6 +48,10 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#ifndef IFNAMSIZ
|
||||||
|
#define IFNAMSIZ 16
|
||||||
|
#endif
|
||||||
|
|
||||||
// ff:ff:ff:ff:ff:ff with no ADI
|
// ff:ff:ff:ff:ff:ff with no ADI
|
||||||
static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0);
|
static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0);
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
|
|
||||||
|
#ifndef IFNAMSIZ
|
||||||
|
#define IFNAMSIZ 16
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
struct nl_route_req {
|
struct nl_route_req {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
#include <linux/rtnetlink.h>
|
#include <linux/rtnetlink.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <linux/if.h>
|
//#include <linux/if.h>
|
||||||
|
|
||||||
#include "../node/InetAddress.hpp"
|
#include "../node/InetAddress.hpp"
|
||||||
#include "../node/MAC.hpp"
|
#include "../node/MAC.hpp"
|
||||||
|
@ -132,7 +132,7 @@ private:
|
||||||
iface_entry()
|
iface_entry()
|
||||||
{ memset(this,0,sizeof(iface_entry)); }
|
{ memset(this,0,sizeof(iface_entry)); }
|
||||||
int index;
|
int index;
|
||||||
char ifacename[IFNAMSIZ];
|
char ifacename[16]; // IFNAMSIZ on Linux == 16
|
||||||
char mac[18];
|
char mac[18];
|
||||||
char mac_bin[6];
|
char mac_bin[6];
|
||||||
unsigned int mtu;
|
unsigned int mtu;
|
||||||
|
|
|
@ -54,8 +54,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZT_BSD_ROUTE_CMD "/sbin/route"
|
#define ZT_BSD_ROUTE_CMD "/sbin/route"
|
||||||
#define ZT_LINUX_IP_COMMAND "/sbin/ip"
|
|
||||||
#define ZT_LINUX_IP_COMMAND_2 "/usr/sbin/ip"
|
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
@ -273,28 +271,6 @@ static void _routeCmd(const char *op,const InetAddress &target,const InetAddress
|
||||||
#define ZT_ROUTING_SUPPORT_FOUND 1
|
#define ZT_ROUTING_SUPPORT_FOUND 1
|
||||||
|
|
||||||
// This has been replaced by LinuxNetLink
|
// This has been replaced by LinuxNetLink
|
||||||
/*
|
|
||||||
static void _routeCmd(const char *op,const InetAddress &target,const InetAddress &via,const char *localInterface)
|
|
||||||
{
|
|
||||||
long p = (long)fork();
|
|
||||||
if (p > 0) {
|
|
||||||
int exitcode = -1;
|
|
||||||
::waitpid(p,&exitcode,0);
|
|
||||||
} else if (p == 0) {
|
|
||||||
::close(STDOUT_FILENO);
|
|
||||||
::close(STDERR_FILENO);
|
|
||||||
char ipbuf[64],ipbuf2[64];
|
|
||||||
if (via) {
|
|
||||||
::execl(ZT_LINUX_IP_COMMAND,ZT_LINUX_IP_COMMAND,(target.ss_family == AF_INET6) ? "-6" : "-4","route",op,target.toString(ipbuf),"via",via.toIpString(ipbuf2),(const char *)0);
|
|
||||||
::execl(ZT_LINUX_IP_COMMAND_2,ZT_LINUX_IP_COMMAND_2,(target.ss_family == AF_INET6) ? "-6" : "-4","route",op,target.toString(ipbuf),"via",via.toIpString(ipbuf2),(const char *)0);
|
|
||||||
} else if ((localInterface)&&(localInterface[0])) {
|
|
||||||
::execl(ZT_LINUX_IP_COMMAND,ZT_LINUX_IP_COMMAND,(target.ss_family == AF_INET6) ? "-6" : "-4","route",op,target.toString(ipbuf),"dev",localInterface,(const char *)0);
|
|
||||||
::execl(ZT_LINUX_IP_COMMAND_2,ZT_LINUX_IP_COMMAND_2,(target.ss_family == AF_INET6) ? "-6" : "-4","route",op,target.toString(ipbuf),"dev",localInterface,(const char *)0);
|
|
||||||
}
|
|
||||||
::_exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif // __LINUX__ ----------------------------------------------------------
|
#endif // __LINUX__ ----------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue