OSDN Git Service

Fix issues with noticing that a VPN interface is gone.
authorSreeram Ramachandran <sreeram@google.com>
Sat, 26 Jul 2014 01:48:12 +0000 (18:48 -0700)
committerSreeram Ramachandran <sreeram@google.com>
Sun, 27 Jul 2014 15:27:03 +0000 (15:27 +0000)
The root cause of both bugs linked below is the same. In establish(), we call
agentConnect(), which sets the state to CONNECTED. But right before returning
from establish(), we set the state to AUTHENTICATING, which is a "CONNECTING"
state. Later, when the interface is gone (either because the VpnService closed
it, or because the process got killed), agentDisconnect() doesn't do anything
because "isConnected()" is false.

We could fix it by changing that to "isConnectedOrConnecting()", but I think a
superior fix is to get rid of the bogus AUTHENTICATING state. It was added in
http://ag/214042 two years ago, with a TODO saying to eventually make sure it
becomes CONNECTED, but that never seems to have been followed up on.

I don't see any use for this AUTHENTICATING state. Although I haven't tested it,
code inspection suggests that the legacy VPN doesn't seem to care, and it sets
its own states in execute() and such.

Bug: 16495146
Bug: 16495887
Change-Id: Ie2a40aa1a8a173665d8b7aa9fab5ae6e800ba5fb

services/core/java/com/android/server/connectivity/Vpn.java

index ba9a183..0305424 100644 (file)
@@ -495,9 +495,6 @@ public class Vpn {
             throw e;
         }
         Log.i(TAG, "Established by " + config.user + " on " + mInterface);
-
-        // TODO: ensure that contract class eventually marks as connected
-        updateState(DetailedState.AUTHENTICATING, "establish");
         return tun;
     }