summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXiao Ma <xiaom@google.com>2019-08-02 01:50:02 +0000
committerXiao Ma <xiaom@google.com>2019-08-02 17:29:05 +0900
commitcf2245b0771480a40e400d13b52106c8282be6f1 (patch)
tree0d1d5534d9c3cf5347b10bdf6b9ef82d0830713a /src
parent98ed332579d20a8304b5cdbba761d49bcad75fd3 (diff)
Revert "Restore the default interface MTU when disconnecting from Wi-Fi AP."
This reverts commit 98ed332579d20a8304b5cdbba761d49bcad75fd3. Reason for revert: prepare another CL to fix the possible NPE issue. Test: atest NetworkStackIntegrationTests Change-Id: I9237b31625299162dca1c2b3e012858413639081
Diffstat (limited to 'src')
-rw-r--r--src/android/net/ip/IpClient.java39
-rw-r--r--src/com/android/server/util/NetworkStackConstants.java2
2 files changed, 3 insertions, 38 deletions
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java
index bff30b6..799184e 100644
--- a/src/android/net/ip/IpClient.java
+++ b/src/android/net/ip/IpClient.java
@@ -19,7 +19,6 @@ package android.net.ip;
import static android.net.RouteInfo.RTN_UNICAST;
import static android.net.shared.IpConfigurationParcelableUtil.toStableParcelable;
-import static com.android.server.util.NetworkStackConstants.ETHER_MTU;
import static com.android.server.util.PermissionUtil.checkNetworkStackCallingPermission;
import android.annotation.NonNull;
@@ -49,7 +48,6 @@ import android.os.ConditionVariable;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
-import android.os.ServiceSpecificException;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.LocalLog;
@@ -71,8 +69,6 @@ import com.android.server.NetworkStackService.NetworkStackServiceManager;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
@@ -384,8 +380,6 @@ public class IpClient extends StateMachine {
private final ConditionVariable mApfDataSnapshotComplete = new ConditionVariable();
public static class Dependencies {
- private static final String TAG = "IpClient.Dependencies";
-
/**
* Get interface parameters for the specified interface.
*/
@@ -394,18 +388,6 @@ public class IpClient extends StateMachine {
}
/**
- * Get the current MTU for the specified interface.
- */
- public int getInterfaceMtu(String ifname) {
- try {
- return NetworkInterface.getByName(ifname).getMTU();
- } catch (SocketException e) {
- Log.e(TAG, "unexpected failure to get the interface MTU");
- return ETHER_MTU;
- }
- }
-
- /**
* Get a INetd connector.
*/
public INetd getNetd(Context context) {
@@ -868,14 +850,10 @@ public class IpClient extends StateMachine {
return shouldLog;
}
- private void logError(String fmt, Throwable e, Object... args) {
- final String msg = "ERROR " + String.format(fmt, args);
- Log.e(mTag, msg, e);
- mLog.e(msg, e);
- }
-
private void logError(String fmt, Object... args) {
- logError(fmt, null, args);
+ final String msg = "ERROR " + String.format(fmt, args);
+ Log.e(mTag, msg);
+ mLog.log(msg);
}
// This needs to be called with care to ensure that our LinkProperties
@@ -1373,17 +1351,6 @@ public class IpClient extends StateMachine {
// There's no DHCPv4 for which to wait; proceed to stopped.
deferMessage(obtainMessage(CMD_JUMP_STOPPING_TO_STOPPED));
}
-
- // Restore the interface MTU to initial value if it has changed.
- final int mtu = mDependencies.getInterfaceMtu(mInterfaceName);
- try {
- if (mtu != mInterfaceParams.defaultMtu) {
- mNetd.interfaceSetMtu(mInterfaceName, mInterfaceParams.defaultMtu);
- }
- } catch (RemoteException | ServiceSpecificException e) {
- logError("Couldn't reset MTU from "
- + mtu + " to " + mInterfaceParams.defaultMtu + ": " + e);
- }
}
@Override
diff --git a/src/com/android/server/util/NetworkStackConstants.java b/src/com/android/server/util/NetworkStackConstants.java
index 3174a9b..804765e 100644
--- a/src/com/android/server/util/NetworkStackConstants.java
+++ b/src/com/android/server/util/NetworkStackConstants.java
@@ -54,7 +54,6 @@ public final class NetworkStackConstants {
public static final int ETHER_TYPE_IPV4 = 0x0800;
public static final int ETHER_TYPE_IPV6 = 0x86dd;
public static final int ETHER_HEADER_LEN = 14;
- public static final int ETHER_MTU = 1500;
/**
* ARP constants.
@@ -98,7 +97,6 @@ public final class NetworkStackConstants {
public static final int IPV6_PROTOCOL_OFFSET = 6;
public static final int IPV6_SRC_ADDR_OFFSET = 8;
public static final int IPV6_DST_ADDR_OFFSET = 24;
- public static final int IPV6_MIN_MTU = 1280;
/**
* ICMPv6 constants.