diff options
author | cyberta <cyberta@riseup.net> | 2020-03-08 05:05:01 -0700 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2020-03-08 05:05:01 -0700 |
commit | 20843f531af829088d736f37cc5c2a6f733244a5 (patch) | |
tree | c8772adf74a4c44ccaf0a3d95b84df247e433693 /app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java | |
parent | c5d5494e0e0d3cb8bb9c97583af3205143f5dea1 (diff) | |
parent | 432a9885451dafb47e0feafb6070b415d93aac03 (diff) |
Merge branch 'tethering_improvements' into 'master'
Tethering improvements
See merge request leap/bitmask_android!101
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java b/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java index 7abd01a8..edf79add 100644 --- a/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java +++ b/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java @@ -130,7 +130,7 @@ public class SetupTetheringTask extends AsyncTask<Void, Boolean, Boolean> { } private boolean removeWifiTetheringRules(TetheringState state, StringBuilder log) throws Exception { - Log.d(TAG, "add Wifi tethering Rules"); + Log.d(TAG, "remove Wifi tethering Rules"); String[] removeRules = getDeletionRules(state, state.lastSeenWifiAddress, state.lastSeenWifiInterface); return runBlockingCmd(removeRules, log) == 0; } @@ -142,20 +142,24 @@ public class SetupTetheringTask extends AsyncTask<Void, Boolean, Boolean> { } private boolean removeUsbTetheringRules(TetheringState state, StringBuilder log) throws Exception { - Log.d(TAG, "add usb tethering rules"); + Log.d(TAG, "remove usb tethering rules"); String[] addRules = getDeletionRules(state, state.lastSeenUsbAddress, state.lastSeenUsbInterface); return runBlockingCmd(addRules, log) == 0; } - //TODO: implement the follwing methods -v - private boolean removeBluetoothTetheringRules(TetheringState state, StringBuilder log) { - return true; + private boolean addBluetoothTetheringRules(TetheringState state, StringBuilder log) throws Exception { + Log.d(TAG, "add bluetooth tethering rules"); + String[] addRules = getAdditionRules(state.bluetoothAddress, state.bluetoothInterface); + return runBlockingCmd(addRules, log) == 0; } - private boolean addBluetoothTetheringRules(TetheringState state, StringBuilder log) { - return true; + private boolean removeBluetoothTetheringRules(TetheringState state, StringBuilder log) throws Exception { + Log.d(TAG, "remove bluetooth tethering rules"); + String[] addRules = getDeletionRules(state, state.lastSeenBluetoothAddress, state.lastSeenBluetoothInterface); + return runBlockingCmd(addRules, log) == 0; } + private String[] getAdditionRules(String addressRange, String interfaceName) { return new String[] { "su", |