OSDN Git Service

Always add local subnet routes to the interface's routing table
authorRubin Xu <rubinxu@google.com>
Tue, 5 Sep 2017 17:40:49 +0000 (18:40 +0100)
committerRubin Xu <rubinxu@google.com>
Thu, 7 Sep 2017 09:50:20 +0000 (10:50 +0100)
commit1bb5c0818f0c4fb426e13b65a3ba3db7f36c3d88
tree3f9a5df9a8dc993f04993c06026ae88b6fbcc89e
parente6793f2795e9b7df5dc68e8ebb420ba228964f61
Always add local subnet routes to the interface's routing table

For some networks such as mobile data connections, its LinkProperties
does not contain routes for the local subnet so no such route is added
to the interface's routing table. This can be problematic especially
if the device is in VPN lockdown mode where there exists high-priority
PROHIBIT routing rule which in turn blocks the network's default gateway
route from being added (next hop address hitting the prohibit rule).

We fix this by patching LinkProperties to always include direct connected routes
when they are received by ConnectivityService. This has the added advantage that
when apps get LinkProperties, they see the directly connected routes as well.

Bug: 63662962
Test: runtest frameworks-core -c android.net.LinkPropertiesTest
Test: runtest frameworks-services -c com.android.server.ConnectivityServiceTest
Test: Start with device with mobile data, set up ics-OpenVPN in always-on
      lockdown mode. Turn off mobile data then turn it back on, observe
      mobile data connectivity is restored and VPN successfully reconnects.
Change-Id: I35b614eebccfd22c4a5270f40256f9be1e25abfb
core/java/android/net/LinkProperties.java
core/tests/coretests/src/android/net/LinkPropertiesTest.java
services/core/java/com/android/server/ConnectivityService.java
tests/net/java/com/android/server/ConnectivityServiceTest.java