Merge "Fix ConnectivityServiceTest for NATT Keepalive"

am: cab3e6009c

Change-Id: Idbdffc7bbd2d9a96f6e6052810722df04a20a65c
This commit is contained in:
nharold 2018-02-20 22:55:38 +00:00 • committed by android-build-merger
commit 4e2e3f823b
2 changed files with 30 additions and 30 deletions

View file

@ -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;

View file

@ -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);
}