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:
parent
88d6e74e6d
commit
f0fd6c2e0d
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue