mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
temp fix for ANDROID-56: crash inside newNetworkConfig from too many args
This commit is contained in:
parent
eedf270127
commit
dd627cd7f4
3 changed files with 46 additions and 32 deletions
|
@ -176,7 +176,15 @@ void setupJNICache(JavaVM *vm) {
|
||||||
EXCEPTIONANDNULLCHECK(Peer_ctor = env->GetMethodID(Peer_class, "<init>", "(JIIIILcom/zerotier/sdk/PeerRole;[Lcom/zerotier/sdk/PeerPhysicalPath;)V"));
|
EXCEPTIONANDNULLCHECK(Peer_ctor = env->GetMethodID(Peer_class, "<init>", "(JIIIILcom/zerotier/sdk/PeerRole;[Lcom/zerotier/sdk/PeerPhysicalPath;)V"));
|
||||||
EXCEPTIONANDNULLCHECK(Version_ctor = env->GetMethodID(Version_class, "<init>", "(III)V"));
|
EXCEPTIONANDNULLCHECK(Version_ctor = env->GetMethodID(Version_class, "<init>", "(III)V"));
|
||||||
EXCEPTIONANDNULLCHECK(VirtualNetworkConfigListener_onNetworkConfigurationUpdated_method = env->GetMethodID(VirtualNetworkConfigListener_class, "onNetworkConfigurationUpdated", "(JLcom/zerotier/sdk/VirtualNetworkConfigOperation;Lcom/zerotier/sdk/VirtualNetworkConfig;)I"));
|
EXCEPTIONANDNULLCHECK(VirtualNetworkConfigListener_onNetworkConfigurationUpdated_method = env->GetMethodID(VirtualNetworkConfigListener_class, "onNetworkConfigurationUpdated", "(JLcom/zerotier/sdk/VirtualNetworkConfigOperation;Lcom/zerotier/sdk/VirtualNetworkConfig;)I"));
|
||||||
EXCEPTIONANDNULLCHECK(VirtualNetworkConfig_ctor = env->GetMethodID(VirtualNetworkConfig_class, "<init>", "(JJLjava/lang/String;Lcom/zerotier/sdk/VirtualNetworkStatus;Lcom/zerotier/sdk/VirtualNetworkType;IZZZIJ[Ljava/net/InetSocketAddress;[Lcom/zerotier/sdk/VirtualNetworkRoute;Lcom/zerotier/sdk/VirtualNetworkDNS;)V"));
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// ANDROID-56: temporarily remove parameters to prevent crashing
|
||||||
|
//
|
||||||
|
// EXCEPTIONANDNULLCHECK(VirtualNetworkConfig_ctor = env->GetMethodID(VirtualNetworkConfig_class, "<init>", "(JJLjava/lang/String;Lcom/zerotier/sdk/VirtualNetworkStatus;Lcom/zerotier/sdk/VirtualNetworkType;IZZZIJ[Ljava/net/InetSocketAddress;[Lcom/zerotier/sdk/VirtualNetworkRoute;Lcom/zerotier/sdk/VirtualNetworkDNS;)V"));
|
||||||
|
EXCEPTIONANDNULLCHECK(VirtualNetworkConfig_ctor = env->GetMethodID(VirtualNetworkConfig_class, "<init>", "(JJLjava/lang/String;Lcom/zerotier/sdk/VirtualNetworkStatus;Lcom/zerotier/sdk/VirtualNetworkType;IZZZ[Ljava/net/InetSocketAddress;[Lcom/zerotier/sdk/VirtualNetworkRoute;Lcom/zerotier/sdk/VirtualNetworkDNS;)V"));
|
||||||
|
|
||||||
|
|
||||||
EXCEPTIONANDNULLCHECK(VirtualNetworkDNS_ctor = env->GetMethodID(VirtualNetworkDNS_class, "<init>", "(Ljava/lang/String;Ljava/util/ArrayList;)V"));
|
EXCEPTIONANDNULLCHECK(VirtualNetworkDNS_ctor = env->GetMethodID(VirtualNetworkDNS_class, "<init>", "(Ljava/lang/String;Ljava/util/ArrayList;)V"));
|
||||||
EXCEPTIONANDNULLCHECK(VirtualNetworkFrameListener_onVirtualNetworkFrame_method = env->GetMethodID(VirtualNetworkFrameListener_class, "onVirtualNetworkFrame", "(JJJJJ[B)V"));
|
EXCEPTIONANDNULLCHECK(VirtualNetworkFrameListener_onVirtualNetworkFrame_method = env->GetMethodID(VirtualNetworkFrameListener_class, "onVirtualNetworkFrame", "(JJJJJ[B)V"));
|
||||||
EXCEPTIONANDNULLCHECK(VirtualNetworkRoute_ctor = env->GetMethodID(VirtualNetworkRoute_class, "<init>", "(Ljava/net/InetSocketAddress;Ljava/net/InetSocketAddress;II)V"));
|
EXCEPTIONANDNULLCHECK(VirtualNetworkRoute_ctor = env->GetMethodID(VirtualNetworkRoute_class, "<init>", "(Ljava/net/InetSocketAddress;Ljava/net/InetSocketAddress;II)V"));
|
||||||
|
|
|
@ -307,8 +307,11 @@ jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &vnetConfig)
|
||||||
vnetConfig.dhcp,
|
vnetConfig.dhcp,
|
||||||
vnetConfig.bridge,
|
vnetConfig.bridge,
|
||||||
vnetConfig.broadcastEnabled,
|
vnetConfig.broadcastEnabled,
|
||||||
vnetConfig.portError,
|
//
|
||||||
vnetConfig.netconfRevision,
|
// ANDROID-56: temporarily remove parameters to prevent crashing
|
||||||
|
//
|
||||||
|
// vnetConfig.portError,
|
||||||
|
// vnetConfig.netconfRevision,
|
||||||
assignedAddrArrayObj,
|
assignedAddrArrayObj,
|
||||||
routesArrayObj,
|
routesArrayObj,
|
||||||
dnsObj);
|
dnsObj);
|
||||||
|
|
|
@ -66,9 +66,12 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
||||||
|
|
||||||
private final boolean broadcastEnabled;
|
private final boolean broadcastEnabled;
|
||||||
|
|
||||||
private final int portError;
|
//
|
||||||
|
// ANDROID-56: temporarily remove parameters to prevent crashing
|
||||||
private final long netconfRevision;
|
//
|
||||||
|
// private final int portError;
|
||||||
|
//
|
||||||
|
// private final long netconfRevision;
|
||||||
|
|
||||||
private final InetSocketAddress[] assignedAddresses;
|
private final InetSocketAddress[] assignedAddresses;
|
||||||
|
|
||||||
|
@ -76,7 +79,7 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
||||||
|
|
||||||
private final VirtualNetworkDNS dns;
|
private final VirtualNetworkDNS dns;
|
||||||
|
|
||||||
public VirtualNetworkConfig(long nwid, long mac, String name, VirtualNetworkStatus status, VirtualNetworkType type, int mtu, boolean dhcp, boolean bridge, boolean broadcastEnabled, int portError, long netconfRevision, InetSocketAddress[] assignedAddresses, VirtualNetworkRoute[] routes, VirtualNetworkDNS dns) {
|
public VirtualNetworkConfig(long nwid, long mac, String name, VirtualNetworkStatus status, VirtualNetworkType type, int mtu, boolean dhcp, boolean bridge, boolean broadcastEnabled, InetSocketAddress[] assignedAddresses, VirtualNetworkRoute[] routes, VirtualNetworkDNS dns) {
|
||||||
this.nwid = nwid;
|
this.nwid = nwid;
|
||||||
this.mac = mac;
|
this.mac = mac;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -89,11 +92,11 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
||||||
this.dhcp = dhcp;
|
this.dhcp = dhcp;
|
||||||
this.bridge = bridge;
|
this.bridge = bridge;
|
||||||
this.broadcastEnabled = broadcastEnabled;
|
this.broadcastEnabled = broadcastEnabled;
|
||||||
this.portError = portError;
|
// this.portError = portError;
|
||||||
if (netconfRevision < 0) {
|
// if (netconfRevision < 0) {
|
||||||
throw new RuntimeException("netconfRevision < 0: " + netconfRevision);
|
// throw new RuntimeException("netconfRevision < 0: " + netconfRevision);
|
||||||
}
|
// }
|
||||||
this.netconfRevision = netconfRevision;
|
// this.netconfRevision = netconfRevision;
|
||||||
this.assignedAddresses = assignedAddresses;
|
this.assignedAddresses = assignedAddresses;
|
||||||
this.routes = routes;
|
this.routes = routes;
|
||||||
this.dns = dns;
|
this.dns = dns;
|
||||||
|
@ -101,7 +104,7 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VirtualNetworkConfig(" + StringUtils.networkIdToString(nwid) + ", " + StringUtils.macAddressToString(mac) + ", " + name + ", " + status + ", " + type + ", " + mtu + ", " + dhcp + ", " + bridge + ", " + broadcastEnabled + ", " + portError + ", " + netconfRevision + ", " + Arrays.toString(assignedAddresses) + ", " + Arrays.toString(routes) + ", " + dns + ")";
|
return "VirtualNetworkConfig(" + StringUtils.networkIdToString(nwid) + ", " + StringUtils.macAddressToString(mac) + ", " + name + ", " + status + ", " + type + ", " + mtu + ", " + dhcp + ", " + bridge + ", " + broadcastEnabled + ", " + Arrays.toString(assignedAddresses) + ", " + Arrays.toString(routes) + ", " + dns + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -168,17 +171,17 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.portError != cfg.portError) {
|
// if (this.portError != cfg.portError) {
|
||||||
Log.i(TAG, "Port Error Changed. Old: " + this.portError + ", New: " + cfg.portError);
|
// Log.i(TAG, "Port Error Changed. Old: " + this.portError + ", New: " + cfg.portError);
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (this.netconfRevision != cfg.netconfRevision) {
|
// if (this.netconfRevision != cfg.netconfRevision) {
|
||||||
Log.i(TAG, "NetConfRevision Changed. Old: " + this.netconfRevision + ", New: " + cfg.netconfRevision);
|
// Log.i(TAG, "NetConfRevision Changed. Old: " + this.netconfRevision + ", New: " + cfg.netconfRevision);
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!Arrays.equals(assignedAddresses, cfg.assignedAddresses)) {
|
if (!Arrays.equals(assignedAddresses, cfg.assignedAddresses)) {
|
||||||
|
|
||||||
|
@ -277,8 +280,8 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
||||||
result = 37 * result + (dhcp ? 1 : 0);
|
result = 37 * result + (dhcp ? 1 : 0);
|
||||||
result = 37 * result + (bridge ? 1 : 0);
|
result = 37 * result + (bridge ? 1 : 0);
|
||||||
result = 37 * result + (broadcastEnabled ? 1 : 0);
|
result = 37 * result + (broadcastEnabled ? 1 : 0);
|
||||||
result = 37 * result + portError;
|
// result = 37 * result + portError;
|
||||||
result = 37 * result + (int) (netconfRevision ^ (netconfRevision >>> 32));
|
// result = 37 * result + (int) (netconfRevision ^ (netconfRevision >>> 32));
|
||||||
result = 37 * result + Arrays.hashCode(assignedAddresses);
|
result = 37 * result + Arrays.hashCode(assignedAddresses);
|
||||||
result = 37 * result + Arrays.hashCode(routes);
|
result = 37 * result + Arrays.hashCode(routes);
|
||||||
result = 37 * result + (dns == null ? 0 : dns.hashCode());
|
result = 37 * result + (dns == null ? 0 : dns.hashCode());
|
||||||
|
@ -359,18 +362,18 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
||||||
/**
|
/**
|
||||||
* If the network is in PORT_ERROR state, this is the error most recently returned by the port config callback
|
* If the network is in PORT_ERROR state, this is the error most recently returned by the port config callback
|
||||||
*/
|
*/
|
||||||
public int getPortError() {
|
// public int getPortError() {
|
||||||
return portError;
|
// return portError;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network config revision as reported by netconf master
|
* Network config revision as reported by netconf master
|
||||||
*
|
*
|
||||||
* <p>If this is zero, it means we're still waiting for our netconf.</p>
|
* <p>If this is zero, it means we're still waiting for our netconf.</p>
|
||||||
*/
|
*/
|
||||||
public long getNetconfRevision() {
|
// public long getNetconfRevision() {
|
||||||
return netconfRevision;
|
// return netconfRevision;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ZeroTier-assigned addresses (in {@link InetSocketAddress} objects)
|
* ZeroTier-assigned addresses (in {@link InetSocketAddress} objects)
|
||||||
|
|
Loading…
Add table
Reference in a new issue