|
|
|
|
@ -66,9 +66,12 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
|
|
|
|
|
|
|
|
|
private final boolean broadcastEnabled; |
|
|
|
|
|
|
|
|
|
private final int portError; |
|
|
|
|
|
|
|
|
|
private final long netconfRevision; |
|
|
|
|
//
|
|
|
|
|
// ANDROID-56: temporarily remove parameters to prevent crashing
|
|
|
|
|
//
|
|
|
|
|
// private final int portError;
|
|
|
|
|
//
|
|
|
|
|
// private final long netconfRevision;
|
|
|
|
|
|
|
|
|
|
private final InetSocketAddress[] assignedAddresses; |
|
|
|
|
|
|
|
|
|
@ -76,7 +79,7 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
|
|
|
|
|
|
|
|
|
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.mac = mac; |
|
|
|
|
this.name = name; |
|
|
|
|
@ -89,11 +92,11 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
|
|
|
|
this.dhcp = dhcp; |
|
|
|
|
this.bridge = bridge; |
|
|
|
|
this.broadcastEnabled = broadcastEnabled; |
|
|
|
|
this.portError = portError; |
|
|
|
|
if (netconfRevision < 0) { |
|
|
|
|
throw new RuntimeException("netconfRevision < 0: " + netconfRevision); |
|
|
|
|
} |
|
|
|
|
this.netconfRevision = netconfRevision; |
|
|
|
|
// this.portError = portError;
|
|
|
|
|
// if (netconfRevision < 0) {
|
|
|
|
|
// throw new RuntimeException("netconfRevision < 0: " + netconfRevision);
|
|
|
|
|
// }
|
|
|
|
|
// this.netconfRevision = netconfRevision;
|
|
|
|
|
this.assignedAddresses = assignedAddresses; |
|
|
|
|
this.routes = routes; |
|
|
|
|
this.dns = dns; |
|
|
|
|
@ -101,7 +104,7 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
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 |
|
|
|
|
@ -168,17 +171,17 @@ public class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.portError != cfg.portError) { |
|
|
|
|
Log.i(TAG, "Port Error Changed. Old: " + this.portError + ", New: " + cfg.portError); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.netconfRevision != cfg.netconfRevision) { |
|
|
|
|
Log.i(TAG, "NetConfRevision Changed. Old: " + this.netconfRevision + ", New: " + cfg.netconfRevision); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
// if (this.portError != cfg.portError) {
|
|
|
|
|
// Log.i(TAG, "Port Error Changed. Old: " + this.portError + ", New: " + cfg.portError);
|
|
|
|
|
//
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (this.netconfRevision != cfg.netconfRevision) {
|
|
|
|
|
// Log.i(TAG, "NetConfRevision Changed. Old: " + this.netconfRevision + ", New: " + cfg.netconfRevision);
|
|
|
|
|
//
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
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 + (bridge ? 1 : 0); |
|
|
|
|
result = 37 * result + (broadcastEnabled ? 1 : 0); |
|
|
|
|
result = 37 * result + portError; |
|
|
|
|
result = 37 * result + (int) (netconfRevision ^ (netconfRevision >>> 32)); |
|
|
|
|
// result = 37 * result + portError;
|
|
|
|
|
// result = 37 * result + (int) (netconfRevision ^ (netconfRevision >>> 32));
|
|
|
|
|
result = 37 * result + Arrays.hashCode(assignedAddresses); |
|
|
|
|
result = 37 * result + Arrays.hashCode(routes); |
|
|
|
|
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 |
|
|
|
|
*/ |
|
|
|
|
public int getPortError() { |
|
|
|
|
return portError; |
|
|
|
|
} |
|
|
|
|
// public int getPortError() {
|
|
|
|
|
// return portError;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Network config revision as reported by netconf master |
|
|
|
|
* |
|
|
|
|
* <p>If this is zero, it means we're still waiting for our netconf.</p> |
|
|
|
|
*/ |
|
|
|
|
public long getNetconfRevision() { |
|
|
|
|
return netconfRevision; |
|
|
|
|
} |
|
|
|
|
// public long getNetconfRevision() {
|
|
|
|
|
// return netconfRevision;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* ZeroTier-assigned addresses (in {@link InetSocketAddress} objects) |
|
|
|
|
|