1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-27 02:09:41 +00:00

Revert "Do not route system traffic into the VPN when not managing system apps"

This reverts commit 41f9ec6644.

Refs #321
This commit is contained in:
M66B 2016-02-14 15:06:45 +01:00
parent 41f9ec6644
commit f1c2c13193

View file

@ -94,9 +94,8 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
private boolean last_connected = false; private boolean last_connected = false;
private boolean last_metered = true; private boolean last_metered = true;
private boolean last_interactive = false; private boolean last_interactive = false;
private boolean last_manage_system = false;
private boolean last_filter = false;
private boolean last_tethering = false; private boolean last_tethering = false;
private boolean last_filter = false;
private String last_vpn4 = null; private String last_vpn4 = null;
private String last_vpn6 = null; private String last_vpn6 = null;
private InetAddress last_dns = null; private InetAddress last_dns = null;
@ -358,7 +357,6 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
boolean tethering = prefs.getBoolean("tethering", false); boolean tethering = prefs.getBoolean("tethering", false);
boolean filter = prefs.getBoolean("filter", false); boolean filter = prefs.getBoolean("filter", false);
boolean manage_system = prefs.getBoolean("manage_system", false);
String vpn4 = prefs.getString("vpn4", "10.1.10.1"); String vpn4 = prefs.getString("vpn4", "10.1.10.1");
String vpn6 = prefs.getString("vpn6", "fd00:1:fd00:1:fd00:1:fd00:1"); String vpn6 = prefs.getString("vpn6", "fd00:1:fd00:1:fd00:1:fd00:1");
InetAddress dns = getDns(SinkholeService.this); InetAddress dns = getDns(SinkholeService.this);
@ -377,7 +375,6 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
List<Rule> listAllowed = getAllowedRules(listRule); List<Rule> listAllowed = getAllowedRules(listRule);
if (filter && if (filter &&
manage_system == last_manage_system &&
filter == last_filter && filter == last_filter &&
tethering == last_tethering && tethering == last_tethering &&
vpn4.equals(last_vpn4) && vpn4.equals(last_vpn4) &&
@ -834,11 +831,9 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private ParcelFileDescriptor startVPN(List<Rule> listAllowed) { private ParcelFileDescriptor startVPN(List<Rule> listAllowed) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean manage_system = prefs.getBoolean("manage_system", false);
boolean filter = prefs.getBoolean("filter", false);
boolean tethering = prefs.getBoolean("tethering", false); boolean tethering = prefs.getBoolean("tethering", false);
boolean filter = prefs.getBoolean("filter", false);
last_manage_system = manage_system;
last_filter = filter; last_filter = filter;
last_tethering = tethering; last_tethering = tethering;
last_vpn4 = prefs.getString("vpn4", "10.1.10.1"); last_vpn4 = prefs.getString("vpn4", "10.1.10.1");
@ -889,14 +884,6 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
} catch (PackageManager.NameNotFoundException ex) { } catch (PackageManager.NameNotFoundException ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
} }
else if (filter && !manage_system && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
for (Rule rule : listAllowed)
if (rule.system)
try {
builder.addDisallowedApplication(rule.info.packageName);
} catch (PackageManager.NameNotFoundException ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
// Build configure intent // Build configure intent
Intent configure = new Intent(this, ActivityMain.class); Intent configure = new Intent(this, ActivityMain.class);