Merge "Fix ConnectivityServiceTest for NATT Keepalive" am: 6d5aea8811
am: ad96984eb5
Change-Id: I3c28cbb55f8226776792df9cacf1b5e527389157
This commit is contained in:
@@ -1602,8 +1602,12 @@ public class ConnectivityManager {
|
||||
/** The hardware returned an error. */
|
||||
public static final int ERROR_HARDWARE_ERROR = -31;
|
||||
|
||||
/** The NAT-T destination port for IPsec */
|
||||
public static final int NATT_PORT = 4500;
|
||||
|
||||
/** The minimum interval in seconds between keepalive packet transmissions */
|
||||
public static final int MIN_INTERVAL = 10;
|
||||
|
||||
private final Network mNetwork;
|
||||
private final PacketKeepaliveCallback mCallback;
|
||||
private final Looper mLooper;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package android.net;
|
||||
|
||||
import android.system.OsConstants;
|
||||
import android.net.ConnectivityManager;
|
||||
import static android.net.ConnectivityManager.PacketKeepalive.*;
|
||||
|
||||
import android.net.util.IpUtils;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -25,13 +25,10 @@ import android.system.OsConstants;
|
||||
import android.util.Log;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import static android.net.ConnectivityManager.PacketKeepalive.*;
|
||||
|
||||
/**
|
||||
* Represents the actual packets that are sent by the
|
||||
* {@link android.net.ConnectivityManager.PacketKeepalive} API.
|
||||
@@ -98,13 +95,6 @@ public class KeepalivePacketData implements Parcelable {
|
||||
InetAddress srcAddress, int srcPort, InetAddress dstAddress, int dstPort)
|
||||
throws InvalidPacketException {
|
||||
|
||||
// FIXME: remove this and actually support IPv6 keepalives
|
||||
if (srcAddress instanceof Inet6Address && dstAddress instanceof Inet6Address) {
|
||||
// Optimistically returning an IPv6 Keepalive Packet with no data,
|
||||
// which currently only works on cellular
|
||||
return new KeepalivePacketData(srcAddress, srcPort, dstAddress, dstPort, new byte[0]);
|
||||
}
|
||||
|
||||
if (!(srcAddress instanceof Inet4Address) || !(dstAddress instanceof Inet4Address)) {
|
||||
throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user