diff options
author | Chad Brubaker <cbrubaker@google.com> | 2014-02-11 14:18:56 -0800 |
---|---|---|
committer | Chad Brubaker <cbrubaker@google.com> | 2014-03-11 10:58:19 -0700 |
commit | a1d7c7444990f4eabf712db8cceb6d3ab1508dde (patch) | |
tree | de6be2e27c03f9e9294b1629a8124224c56df373 /services/java | |
parent | 674f85af4c04970ec8875669b3f08eaf0465ba4b (diff) | |
download | frameworks_base-a1d7c7444990f4eabf712db8cceb6d3ab1508dde.zip frameworks_base-a1d7c7444990f4eabf712db8cceb6d3ab1508dde.tar.gz frameworks_base-a1d7c7444990f4eabf712db8cceb6d3ab1508dde.tar.bz2 |
Remove SO_BINDTODEVICE from VPN protect
SO_BINDTODEVICE is not needed with policy routing.
SO_BINDTODEVICE was also used on the default iface which causes problems
when the default iface is IPv6 only and the socket tries to connect to a
IPv4 address.
Bug: 12940882
Change-Id: I5b2bde0ac5459433fc5749f509072a548532f730
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 3 | ||||
-rw-r--r-- | services/java/com/android/server/connectivity/Vpn.java | 10 |
2 files changed, 4 insertions, 9 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 83a3bfd..df2fd5e 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -3658,8 +3658,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { int user = UserHandle.getUserId(Binder.getCallingUid()); if (ConnectivityManager.isNetworkTypeValid(type) && mNetTrackers[type] != null) { synchronized(mVpns) { - mVpns.get(user).protect(socket, - mNetTrackers[type].getLinkProperties().getInterfaceName()); + mVpns.get(user).protect(socket); } return true; } diff --git a/services/java/com/android/server/connectivity/Vpn.java b/services/java/com/android/server/connectivity/Vpn.java index 9ed3eaa..03405e7 100644 --- a/services/java/com/android/server/connectivity/Vpn.java +++ b/services/java/com/android/server/connectivity/Vpn.java @@ -284,13 +284,12 @@ public class Vpn extends BaseNetworkStateTracker { } /** - * Protect a socket from routing changes by binding it to the given - * interface. The socket is NOT closed by this method. + * Protect a socket from VPN rules by binding it to the main routing table. + * The socket is NOT closed by this method. * * @param socket The socket to be bound. - * @param interfaze The name of the interface. */ - public void protect(ParcelFileDescriptor socket, String interfaze) throws Exception { + public void protect(ParcelFileDescriptor socket) throws Exception { PackageManager pm = mContext.getPackageManager(); int appUid = pm.getPackageUid(mPackage, mUserId); @@ -304,8 +303,6 @@ public class Vpn extends BaseNetworkStateTracker { } finally { Binder.restoreCallingIdentity(token); } - // bind the socket to the interface - jniProtect(socket.getFd(), interfaze); } @@ -684,7 +681,6 @@ public class Vpn extends BaseNetworkStateTracker { private native int jniSetRoutes(String interfaze, String routes); private native void jniReset(String interfaze); private native int jniCheck(String interfaze); - private native void jniProtect(int socket, String interfaze); private static RouteInfo findIPv4DefaultRoute(LinkProperties prop) { for (RouteInfo route : prop.getAllRoutes()) { |