1.10.6 merge to main (#1930)
* add note about forceTcpRelay * Create a sample systemd unit for tcp proxy * set gitattributes for rust & cargo so hashes dont conflict on Windows * Revert "set gitattributes for rust & cargo so hashes dont conflict on Windows" This reverts commit032dc5c108
. * Turn off autocrlf for rust source Doesn't appear to play nice well when it comes to git and vendored cargo package hashes * Fix #1883 (#1886) Still unknown as to why, but the call to `nc->GetProperties()` can fail when setting a friendly name on the Windows virtual ethernet adapter. Ensure that `ncp` is not null before continuing and accessing the device GUID. * Don't vendor packages for zeroidc (#1885) * Added docker environment way to join networks (#1871) * add StringUtils * fix headers use recommended headers and remove unused headers * move extern "C" only JNI functions need to be exported * cleanup * fix ANDROID-50: RESULT_ERROR_BAD_PARAMETER typo * fix typo in log message * fix typos in JNI method signatures * fix typo * fix ANDROID-51: fieldName is uninitialized * fix ANDROID-35: memory leak * fix missing DeleteLocalRef in loops * update to use unique error codes * add GETENV macro * add LOG_TAG defines * ANDROID-48: add ZT_jnicache.cpp * ANDROID-48: use ZT_jnicache.cpp and remove ZT_jnilookup.cpp and ZT_jniarray.cpp * add Event.fromInt * add PeerRole.fromInt * add ResultCode.fromInt * fix ANDROID-36: issues with ResultCode * add VirtualNetworkConfigOperation.fromInt * fix ANDROID-40: VirtualNetworkConfigOperation out-of-sync with ZT_VirtualNetworkConfigOperation enum * add VirtualNetworkStatus.fromInt * fix ANDROID-37: VirtualNetworkStatus out-of-sync with ZT_VirtualNetworkStatus enum * add VirtualNetworkType.fromInt * make NodeStatus a plain data class * fix ANDROID-52: synchronization bug with nodeMap * Node init work: separate Node construction and init * add Node.toString * make PeerPhysicalPath a plain data class * remove unused PeerPhysicalPath.fixed * add array functions * make Peer a plain data class * make Version a plain data class * fix ANDROID-42: copy/paste error * fix ANDROID-49: VirtualNetworkConfig.equals is wrong * reimplement VirtualNetworkConfig.equals * reimplement VirtualNetworkConfig.compareTo * add VirtualNetworkConfig.hashCode * make VirtualNetworkConfig a plain data class * remove unused VirtualNetworkConfig.enabled * reimplement VirtualNetworkDNS.equals * add VirtualNetworkDNS.hashCode * make VirtualNetworkDNS a plain data class * reimplement VirtualNetworkRoute.equals * reimplement VirtualNetworkRoute.compareTo * reimplement VirtualNetworkRoute.toString * add VirtualNetworkRoute.hashCode * make VirtualNetworkRoute a plain data class * add isSocketAddressEmpty * add addressPort * add fromSocketAddressObject * invert logic in a couple of places and return early * newInetAddress and newInetSocketAddress work allow newInetSocketAddress to return NULL if given empty address * fix ANDROID-38: stack corruption in onSendPacketRequested * use GETENV macro * JniRef work JniRef does not use callbacks struct, so remove fix NewGlobalRef / DeleteGlobalRef mismatch * use PRId64 macros * switch statement work * comments and logging * Modifier 'public' is redundant for interface members * NodeException can be made a checked Exception * 'NodeException' does not define a 'serialVersionUID' field * 'finalize()' should not be overridden this is fine to do because ZeroTierOneService calls close() when it is done * error handling, error reporting, asserts, logging * simplify loadLibrary * rename Node.networks -> Node.networkConfigs * Windows file permissions fix (#1887) * Allow macOS interfaces to use multiple IP addresses (#1879) Co-authored-by: Sean OMeara <someara@users.noreply.github.com> Co-authored-by: Grant Limberg <glimberg@users.noreply.github.com> * Fix condition where full HELLOs might not be sent when necessary (#1877) Co-authored-by: Grant Limberg <glimberg@users.noreply.github.com> * 1.10.4 version bumps * Add security policy to repo (#1889) * [+] add e2k64 arch (#1890) * temp fix for ANDROID-56: crash inside newNetworkConfig from too many args * 1.10.4 release notes * Windows 1.10.4 Advanced Installer bump * Revert "temp fix for ANDROID-56: crash inside newNetworkConfig from too many args" This reverts commitdd627cd7f4
. * actual fix for ANDROID-56: crash inside newNetworkConfig cast all arguments to varargs functions as good style * Fix addIp being called with applied ips (#1897) This was getting called outside of the check for existing ips Because of the added ifdef and a brace getting moved to the wrong place. ``` if (! n.tap()->addIp(*ip)) { fprintf(stderr, "ERROR: unable to add ip address %s" ZT_EOL_S, ip->toString(ipbuf)); } WinFWHelper::newICMPRule(*ip, n.config().nwid); ``` * 1.10.5 (#1905) * 1.10.5 bump * 1.10.5 for Windows * 1.10.5 * Prevent path-learning loops (#1914) * Prevent path-learning loops * Only allow new overwrite if not bonded * fix binding temporary ipv6 addresses on macos (#1910) The check code wasn't running. I don't know why !defined(TARGET_OS_IOS) would exclude code on desktop macOS. I did a quick search and changed it to defined(TARGET_OS_MAC). Not 100% sure what the most correct solution there is. You can verify the old and new versions with `ifconfig | grep temporary` plus `zerotier-cli info -j` -> listeningOn * 1.10.6 (#1929) * 1.10.5 bump * 1.10.6 * 1.10.6 AIP for Windows. --------- Co-authored-by: travis laduke <travisladuke@gmail.com> Co-authored-by: Grant Limberg <grant.limberg@zerotier.com> Co-authored-by: Grant Limberg <glimberg@users.noreply.github.com> Co-authored-by: Leonardo Amaral <leleobhz@users.noreply.github.com> Co-authored-by: Brenton Bostick <bostick@gmail.com> Co-authored-by: Sean OMeara <someara@users.noreply.github.com> Co-authored-by: Joseph Henry <joseph-henry@users.noreply.github.com> Co-authored-by: Roman Peshkichev <roman.peshkichev@gmail.com>
This commit is contained in:
parent
1c5897895b
commit
a872cc3418
13 changed files with 184 additions and 181 deletions
|
@ -31,7 +31,7 @@
|
|||
|
||||
jobject createResultObject(JNIEnv *env, ZT_ResultCode code)
|
||||
{
|
||||
jobject resultObject = env->CallStaticObjectMethod(ResultCode_class, ResultCode_fromInt_method, code);
|
||||
jobject resultObject = env->CallStaticObjectMethod(ResultCode_class, ResultCode_fromInt_method, (jint)code);
|
||||
if(env->ExceptionCheck() || resultObject == NULL) {
|
||||
LOGE("Error creating ResultCode object");
|
||||
return NULL;
|
||||
|
@ -43,7 +43,7 @@ jobject createResultObject(JNIEnv *env, ZT_ResultCode code)
|
|||
|
||||
jobject createVirtualNetworkStatus(JNIEnv *env, ZT_VirtualNetworkStatus status)
|
||||
{
|
||||
jobject statusObject = env->CallStaticObjectMethod(VirtualNetworkStatus_class, VirtualNetworkStatus_fromInt_method, status);
|
||||
jobject statusObject = env->CallStaticObjectMethod(VirtualNetworkStatus_class, VirtualNetworkStatus_fromInt_method, (jint)status);
|
||||
if (env->ExceptionCheck() || statusObject == NULL) {
|
||||
LOGE("Error creating VirtualNetworkStatus object");
|
||||
return NULL;
|
||||
|
@ -54,7 +54,7 @@ jobject createVirtualNetworkStatus(JNIEnv *env, ZT_VirtualNetworkStatus status)
|
|||
|
||||
jobject createEvent(JNIEnv *env, ZT_Event event)
|
||||
{
|
||||
jobject eventObject = env->CallStaticObjectMethod(Event_class, Event_fromInt_method, event);
|
||||
jobject eventObject = env->CallStaticObjectMethod(Event_class, Event_fromInt_method, (jint)event);
|
||||
if (env->ExceptionCheck() || eventObject == NULL) {
|
||||
LOGE("Error creating Event object");
|
||||
return NULL;
|
||||
|
@ -65,7 +65,7 @@ jobject createEvent(JNIEnv *env, ZT_Event event)
|
|||
|
||||
jobject createPeerRole(JNIEnv *env, ZT_PeerRole role)
|
||||
{
|
||||
jobject peerRoleObject = env->CallStaticObjectMethod(PeerRole_class, PeerRole_fromInt_method, role);
|
||||
jobject peerRoleObject = env->CallStaticObjectMethod(PeerRole_class, PeerRole_fromInt_method, (jint)role);
|
||||
if (env->ExceptionCheck() || peerRoleObject == NULL) {
|
||||
LOGE("Error creating PeerRole object");
|
||||
return NULL;
|
||||
|
@ -76,7 +76,7 @@ jobject createPeerRole(JNIEnv *env, ZT_PeerRole role)
|
|||
|
||||
jobject createVirtualNetworkType(JNIEnv *env, ZT_VirtualNetworkType type)
|
||||
{
|
||||
jobject vntypeObject = env->CallStaticObjectMethod(VirtualNetworkType_class, VirtualNetworkType_fromInt_method, type);
|
||||
jobject vntypeObject = env->CallStaticObjectMethod(VirtualNetworkType_class, VirtualNetworkType_fromInt_method, (jint)type);
|
||||
if (env->ExceptionCheck() || vntypeObject == NULL) {
|
||||
LOGE("Error creating VirtualNetworkType object");
|
||||
return NULL;
|
||||
|
@ -87,7 +87,7 @@ jobject createVirtualNetworkType(JNIEnv *env, ZT_VirtualNetworkType type)
|
|||
|
||||
jobject createVirtualNetworkConfigOperation(JNIEnv *env, ZT_VirtualNetworkConfigOperation op)
|
||||
{
|
||||
jobject vnetConfigOpObject = env->CallStaticObjectMethod(VirtualNetworkConfigOperation_class, VirtualNetworkConfigOperation_fromInt_method, op);
|
||||
jobject vnetConfigOpObject = env->CallStaticObjectMethod(VirtualNetworkConfigOperation_class, VirtualNetworkConfigOperation_fromInt_method, (jint)op);
|
||||
if (env->ExceptionCheck() || vnetConfigOpObject == NULL) {
|
||||
LOGE("Error creating VirtualNetworkConfigOperation object");
|
||||
return NULL;
|
||||
|
@ -113,7 +113,7 @@ jobject newInetAddress(JNIEnv *env, const sockaddr_storage &addr)
|
|||
}
|
||||
|
||||
inetAddressObj = env->CallStaticObjectMethod(
|
||||
InetAddress_class, InetAddress_getByAddress_method, buff);
|
||||
InetAddress_class, InetAddress_getByAddress_method, (jbyteArray)buff);
|
||||
}
|
||||
break;
|
||||
case AF_INET:
|
||||
|
@ -127,7 +127,7 @@ jobject newInetAddress(JNIEnv *env, const sockaddr_storage &addr)
|
|||
}
|
||||
|
||||
inetAddressObj = env->CallStaticObjectMethod(
|
||||
InetAddress_class, InetAddress_getByAddress_method, buff);
|
||||
InetAddress_class, InetAddress_getByAddress_method, (jbyteArray)buff);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -190,7 +190,7 @@ jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr)
|
|||
|
||||
int port = addressPort(addr);
|
||||
|
||||
jobject inetSocketAddressObject = env->NewObject(InetSocketAddress_class, InetSocketAddress_ctor, inetAddressObject, port);
|
||||
jobject inetSocketAddressObject = env->NewObject(InetSocketAddress_class, InetSocketAddress_ctor, (jobject)inetAddressObject, (jint)port);
|
||||
if(env->ExceptionCheck() || inetSocketAddressObject == NULL) {
|
||||
LOGE("Error creating InetSocketAddress object");
|
||||
return NULL;
|
||||
|
@ -211,10 +211,10 @@ jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp)
|
|||
jobject pppObject = env->NewObject(
|
||||
PeerPhysicalPath_class,
|
||||
PeerPhysicalPath_ctor,
|
||||
addressObject,
|
||||
ppp.lastSend,
|
||||
ppp.lastReceive,
|
||||
ppp.preferred);
|
||||
(jobject)addressObject,
|
||||
(jlong)ppp.lastSend,
|
||||
(jlong)ppp.lastReceive,
|
||||
(jboolean)ppp.preferred); // ANDROID-56: cast to correct size
|
||||
if(env->ExceptionCheck() || pppObject == NULL)
|
||||
{
|
||||
LOGE("Error creating PPP object");
|
||||
|
@ -240,13 +240,13 @@ jobject newPeer(JNIEnv *env, const ZT_Peer &peer)
|
|||
jobject peerObject = env->NewObject(
|
||||
Peer_class,
|
||||
Peer_ctor,
|
||||
peer.address,
|
||||
peer.versionMajor,
|
||||
peer.versionMinor,
|
||||
peer.versionRev,
|
||||
peer.latency,
|
||||
peerRoleObj,
|
||||
arrayObject);
|
||||
(jlong)peer.address,
|
||||
(jint)peer.versionMajor,
|
||||
(jint)peer.versionMinor,
|
||||
(jint)peer.versionRev,
|
||||
(jint)peer.latency,
|
||||
(jobject)peerRoleObj,
|
||||
(jobjectArray)arrayObject);
|
||||
if(env->ExceptionCheck() || peerObject == NULL)
|
||||
{
|
||||
LOGE("Error creating Peer object");
|
||||
|
@ -298,23 +298,20 @@ jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &vnetConfig)
|
|||
jobject vnetConfigObj = env->NewObject(
|
||||
VirtualNetworkConfig_class,
|
||||
VirtualNetworkConfig_ctor,
|
||||
vnetConfig.nwid,
|
||||
vnetConfig.mac,
|
||||
nameStr,
|
||||
statusObject,
|
||||
typeObject,
|
||||
vnetConfig.mtu,
|
||||
vnetConfig.dhcp,
|
||||
vnetConfig.bridge,
|
||||
vnetConfig.broadcastEnabled,
|
||||
//
|
||||
// ANDROID-56: temporarily remove parameters to prevent crashing
|
||||
//
|
||||
// vnetConfig.portError,
|
||||
// vnetConfig.netconfRevision,
|
||||
assignedAddrArrayObj,
|
||||
routesArrayObj,
|
||||
dnsObj);
|
||||
(jlong)vnetConfig.nwid,
|
||||
(jlong)vnetConfig.mac,
|
||||
(jstring)nameStr,
|
||||
(jobject)statusObject,
|
||||
(jobject)typeObject,
|
||||
(jint)vnetConfig.mtu,
|
||||
(jboolean)vnetConfig.dhcp, // ANDROID-56: cast to correct size
|
||||
(jboolean)vnetConfig.bridge, // ANDROID-56: cast to correct size
|
||||
(jboolean)vnetConfig.broadcastEnabled, // ANDROID-56: cast to correct size
|
||||
(jint)vnetConfig.portError,
|
||||
(jlong)vnetConfig.netconfRevision,
|
||||
(jobjectArray)assignedAddrArrayObj,
|
||||
(jobjectArray)routesArrayObj,
|
||||
(jobject)dnsObj);
|
||||
if(env->ExceptionCheck() || vnetConfigObj == NULL)
|
||||
{
|
||||
LOGE("Error creating new VirtualNetworkConfig object");
|
||||
|
@ -327,7 +324,7 @@ jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &vnetConfig)
|
|||
jobject newVersion(JNIEnv *env, int major, int minor, int rev)
|
||||
{
|
||||
// create a com.zerotier.sdk.Version object
|
||||
jobject versionObj = env->NewObject(Version_class, Version_ctor, major, minor, rev);
|
||||
jobject versionObj = env->NewObject(Version_class, Version_ctor, (jint)major, (jint)minor, (jint)rev);
|
||||
if(env->ExceptionCheck() || versionObj == NULL)
|
||||
{
|
||||
LOGE("Error creating new Version object");
|
||||
|
@ -358,10 +355,10 @@ jobject newVirtualNetworkRoute(JNIEnv *env, const ZT_VirtualNetworkRoute &route)
|
|||
jobject routeObj = env->NewObject(
|
||||
VirtualNetworkRoute_class,
|
||||
VirtualNetworkRoute_ctor,
|
||||
targetObj,
|
||||
viaObj,
|
||||
route.flags,
|
||||
route.metric);
|
||||
(jobject)targetObj,
|
||||
(jobject)viaObj,
|
||||
(jint)route.flags, // ANDROID-56: cast to correct size
|
||||
(jint)route.metric); // ANDROID-56: cast to correct size
|
||||
if(env->ExceptionCheck() || routeObj == NULL)
|
||||
{
|
||||
LOGE("Exception creating VirtualNetworkRoute");
|
||||
|
@ -387,7 +384,7 @@ jobject newVirtualNetworkDNS(JNIEnv *env, const ZT_VirtualNetworkDNS &dns)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
jobject addrList = env->NewObject(ArrayList_class, ArrayList_ctor, 0);
|
||||
jobject addrList = env->NewObject(ArrayList_class, ArrayList_ctor, (jint)0);
|
||||
if (env->ExceptionCheck() || addrList == NULL) {
|
||||
LOGE("Exception creating new ArrayList");
|
||||
return NULL;
|
||||
|
@ -409,7 +406,7 @@ jobject newVirtualNetworkDNS(JNIEnv *env, const ZT_VirtualNetworkDNS &dns)
|
|||
continue;
|
||||
}
|
||||
|
||||
env->CallBooleanMethod(addrList, ArrayList_add_method, addr);
|
||||
env->CallBooleanMethod(addrList, ArrayList_add_method, (jobject)addr);
|
||||
if(env->ExceptionCheck())
|
||||
{
|
||||
LOGE("Exception calling add");
|
||||
|
@ -422,8 +419,8 @@ jobject newVirtualNetworkDNS(JNIEnv *env, const ZT_VirtualNetworkDNS &dns)
|
|||
jobject dnsObj = env->NewObject(
|
||||
VirtualNetworkDNS_class,
|
||||
VirtualNetworkDNS_ctor,
|
||||
domain,
|
||||
addrList);
|
||||
(jstring)domain,
|
||||
(jobject)addrList);
|
||||
if (env->ExceptionCheck() || dnsObj == NULL) {
|
||||
LOGE("Exception creating new VirtualNetworkDNS");
|
||||
return NULL;
|
||||
|
@ -450,10 +447,10 @@ jobject newNodeStatus(JNIEnv *env, const ZT_NodeStatus &status) {
|
|||
jobject nodeStatusObj = env->NewObject(
|
||||
NodeStatus_class,
|
||||
NodeStatus_ctor,
|
||||
status.address,
|
||||
pubIdentStr,
|
||||
secIdentStr,
|
||||
status.online);
|
||||
(jlong)status.address,
|
||||
(jstring)pubIdentStr,
|
||||
(jstring)secIdentStr,
|
||||
(jboolean)status.online);
|
||||
if(env->ExceptionCheck() || nodeStatusObj == NULL) {
|
||||
LOGE("Exception creating new NodeStatus");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue