Loading core/java/android/net/LinkProperties.java +17 −0 Original line number Diff line number Diff line Loading @@ -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 = Loading Loading @@ -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; } } services/core/java/com/android/server/ConnectivityService.java +7 −1 Original line number Diff line number Diff line Loading @@ -1534,11 +1534,17 @@ public class ConnectivityService extends IConnectivityManager.Stub { return; } if (mtu < 68 || mtu > 10000) { if (LinkProperties.isValidMtu(mtu, newLp.hasGlobalIPv6Address())) { loge("Unexpected mtu value: " + mtu + ", " + iface); return; } // Cannot set MTU without interface name if (TextUtils.isEmpty(iface)) { loge("Setting MTU size with null iface."); return; } try { if (VDBG) log("Setting MTU size: " + iface + ", " + mtu); mNetd.setMtu(iface, mtu); Loading telephony/java/com/android/internal/telephony/PhoneConstants.java +3 −0 Original line number Diff line number Diff line Loading @@ -187,4 +187,7 @@ public class PhoneConstants { REASON_RADIO_UNAVAILABLE, REASON_SIM_REFRESH_RESET }; // Initial MTU value. public static final int UNSET_MTU = 0; } Loading
core/java/android/net/LinkProperties.java +17 −0 Original line number Diff line number Diff line Loading @@ -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 = Loading Loading @@ -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; } }
services/core/java/com/android/server/ConnectivityService.java +7 −1 Original line number Diff line number Diff line Loading @@ -1534,11 +1534,17 @@ public class ConnectivityService extends IConnectivityManager.Stub { return; } if (mtu < 68 || mtu > 10000) { if (LinkProperties.isValidMtu(mtu, newLp.hasGlobalIPv6Address())) { loge("Unexpected mtu value: " + mtu + ", " + iface); return; } // Cannot set MTU without interface name if (TextUtils.isEmpty(iface)) { loge("Setting MTU size with null iface."); return; } try { if (VDBG) log("Setting MTU size: " + iface + ", " + mtu); mNetd.setMtu(iface, mtu); Loading
telephony/java/com/android/internal/telephony/PhoneConstants.java +3 −0 Original line number Diff line number Diff line Loading @@ -187,4 +187,7 @@ public class PhoneConstants { REASON_RADIO_UNAVAILABLE, REASON_SIM_REFRESH_RESET }; // Initial MTU value. public static final int UNSET_MTU = 0; }