summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2014-08-15 22:11:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-15 19:10:34 +0000
commitbd431ee5d302f46ac3cc846797fa7a5551f7b42e (patch)
tree40a795f7b3d0b9d88af543d2cf68e466a1b9fed0 /core/java
parentcab3eb0c0b29d8c4b58652c40687a5a4309f94ef (diff)
parent15afd8115869bf22534a1f26fe6e389c9e5ef413 (diff)
Merge "Configure MTU based on network MTU parameter" into lmp-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/LinkProperties.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 6160bc2ad942..dcb28922ac78 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -56,6 +56,10 @@ public final class LinkProperties implements Parcelable {
private ProxyInfo mHttpProxy;
private int mMtu;
+ private static final int MIN_MTU = 68;
+ private static final int MIN_MTU_V6 = 1280;
+ private static final int MAX_MTU = 10000;
+
// Stores the properties of links that are "stacked" above this link.
// Indexed by interface name to allow modification and to prevent duplicates being added.
private Hashtable<String, LinkProperties> mStackedLinks =
@@ -996,4 +1000,17 @@ public final class LinkProperties implements Parcelable {
return new LinkProperties[size];
}
};
+
+ /**
+ * Check the valid MTU range based on IPv4 or IPv6.
+ * @hide
+ */
+ public static boolean isValidMtu(int mtu, boolean ipv6) {
+ if (ipv6) {
+ if ((mtu >= MIN_MTU_V6 && mtu <= MAX_MTU)) return true;
+ } else {
+ if ((mtu >= MIN_MTU && mtu <= MAX_MTU)) return true;
+ }
+ return false;
+ }
}