Relicense: GPLv3 -> ZeroTier BSL 1.1
This commit is contained in:
parent
509da3ac34
commit
52a166a71f
129 changed files with 1094 additions and 3540 deletions
|
@ -1,28 +1,15 @@
|
|||
/*
|
||||
* ZeroTier One - Network Virtualization Everywhere
|
||||
* Copyright (C) 2011-2019 ZeroTier, Inc. https://www.zerotier.com/
|
||||
* Copyright (c)2019 ZeroTier, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* Change Date: 2023-01-01
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --
|
||||
*
|
||||
* You can be released from the requirements of the license by purchasing
|
||||
* a commercial license. Buying such a license is mandatory as soon as you
|
||||
* develop commercial closed-source software that incorporates or links
|
||||
* directly against ZeroTier software without disclosing the source code
|
||||
* of your own application.
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
*/
|
||||
/****/
|
||||
|
||||
#include "LinuxNetLink.hpp"
|
||||
|
||||
|
@ -88,7 +75,7 @@ LinuxNetLink::~LinuxNetLink()
|
|||
::close(_fd);
|
||||
}
|
||||
|
||||
void LinuxNetLink::_setSocketTimeout(int fd, int seconds)
|
||||
void LinuxNetLink::_setSocketTimeout(int fd, int seconds)
|
||||
{
|
||||
struct timeval tv;
|
||||
tv.tv_sec = seconds;
|
||||
|
@ -161,7 +148,7 @@ int LinuxNetLink::_doRecv(int fd)
|
|||
nll = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
nll += rtn;
|
||||
|
||||
_processMessage(nlp, nll);
|
||||
|
@ -196,7 +183,7 @@ void LinuxNetLink::_processMessage(struct nlmsghdr *nlp, int nll)
|
|||
{
|
||||
for(; NLMSG_OK(nlp, nll); nlp=NLMSG_NEXT(nlp, nll))
|
||||
{
|
||||
switch(nlp->nlmsg_type)
|
||||
switch(nlp->nlmsg_type)
|
||||
{
|
||||
case RTM_NEWLINK:
|
||||
_linkAdded(nlp);
|
||||
|
@ -232,7 +219,7 @@ void LinuxNetLink::_ipAddressAdded(struct nlmsghdr *nlp)
|
|||
char local[40] = {0};
|
||||
char label[40] = {0};
|
||||
char bcast[40] = {0};
|
||||
|
||||
|
||||
for(;RTA_OK(rtap, ifal); rtap=RTA_NEXT(rtap,ifal))
|
||||
{
|
||||
switch(rtap->rta_type) {
|
||||
|
@ -653,7 +640,7 @@ void LinuxNetLink::addRoute(const InetAddress &target, const InetAddress &via, c
|
|||
if(src.isV4()) {
|
||||
rtap->rta_len = RTA_LENGTH(sizeof(struct in_addr));
|
||||
memcpy(RTA_DATA(rtap), &((struct sockaddr_in*)&src)->sin_addr, sizeof(struct in_addr));
|
||||
|
||||
|
||||
} else {
|
||||
rtap->rta_len = RTA_LENGTH(sizeof(struct in6_addr));
|
||||
memcpy(RTA_DATA(rtap), &((struct sockaddr_in6*)&src)->sin6_addr, sizeof(struct in6_addr));
|
||||
|
@ -768,7 +755,7 @@ void LinuxNetLink::delRoute(const InetAddress &target, const InetAddress &via, c
|
|||
if(src.isV4()) {
|
||||
rtap->rta_len = RTA_LENGTH(sizeof(struct in_addr));
|
||||
memcpy(RTA_DATA(rtap), &((struct sockaddr_in*)&src)->sin_addr, sizeof(struct in_addr));
|
||||
|
||||
|
||||
} else {
|
||||
rtap->rta_len = RTA_LENGTH(sizeof(struct in6_addr));
|
||||
memcpy(RTA_DATA(rtap), &((struct sockaddr_in6*)&src)->sin6_addr, sizeof(struct in6_addr));
|
||||
|
@ -864,7 +851,7 @@ void LinuxNetLink::addAddress(const InetAddress &addr, const char *iface)
|
|||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int rtl = sizeof(struct ifaddrmsg);
|
||||
struct nl_adr_req req;
|
||||
bzero(&req, sizeof(struct nl_adr_req));
|
||||
|
@ -976,7 +963,7 @@ void LinuxNetLink::removeAddress(const InetAddress &addr, const char *iface)
|
|||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int rtl = sizeof(struct ifaddrmsg);
|
||||
struct nl_adr_req req;
|
||||
bzero(&req, sizeof(struct nl_adr_req));
|
||||
|
@ -1052,7 +1039,7 @@ void LinuxNetLink::removeAddress(const InetAddress &addr, const char *iface)
|
|||
close(fd);
|
||||
}
|
||||
|
||||
RouteList LinuxNetLink::getIPV4Routes() const
|
||||
RouteList LinuxNetLink::getIPV4Routes() const
|
||||
{
|
||||
return _routes_ipv4;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue