1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-02-23 06:41:05 +00:00

Set underlying network

This commit is contained in:
M66B 2018-12-07 13:21:57 +01:00
parent 88d6e74e6d
commit f0fd6c2e0d

View file

@ -1338,6 +1338,16 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
if (ip6)
builder.addRoute("2000::", 3); // unicast
// Set underlying network
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
Network active = (cm == null ? null : cm.getActiveNetwork());
if (active != null) {
Log.i(TAG, "Setting underlying network=" + cm.getNetworkInfo(active));
builder.setUnderlyingNetworks(new Network[]{active});
}
}
// MTU
int mtu = jni_get_mtu();
Log.i(TAG, "MTU=" + mtu);