diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt index 8e74bed7..7a025baf 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt @@ -29,7 +29,8 @@ class Routing(val upstream: String?, private val downstream: String, ownerAddres "quiet while $IPTABLES -t nat -D POSTROUTING -j vpnhotspot_masquerade; do done", "$IPTABLES -t nat -F vpnhotspot_masquerade", "$IPTABLES -t nat -X vpnhotspot_masquerade", - "quiet while ip rule del priority 17900; do done") + "quiet while ip rule del priority 17900; do done", + report = false) } class InterfaceNotFoundException : SocketException() { @@ -125,6 +126,6 @@ class Routing(val upstream: String?, private val downstream: String, ownerAddres fun stop(): Boolean { if (!started) return true started = false - return noisySu(stopScript) == true + return noisySu(stopScript, false) == true } } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/util/NoisySu.kt b/mobile/src/main/java/be/mygod/vpnhotspot/util/NoisySu.kt index 5b9c41f1..8626b3b5 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/util/NoisySu.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/util/NoisySu.kt @@ -45,7 +45,7 @@ fun loggerSu(command: String): String? { } } -fun noisySu(commands: Iterable): Boolean? { +fun noisySu(commands: Iterable, report: Boolean = true): Boolean? { var out = loggerSu("""function noisy() { "$@" || echo "$@" exited with $?; } ${commands.joinToString("\n") { if (it.startsWith("quiet ")) it.substring(6) else "noisy $it" }} echo $NOISYSU_SUFFIX""") @@ -53,8 +53,8 @@ echo $NOISYSU_SUFFIX""") out = out?.removeSuffix(NOISYSU_SUFFIX) if (!out.isNullOrBlank()) { Crashlytics.log(Log.INFO, NOISYSU_TAG, out) - Crashlytics.logException(SuFailure()) + if (report) Crashlytics.logException(SuFailure()) } return result } -fun noisySu(vararg commands: String) = noisySu(commands.asIterable()) +fun noisySu(vararg commands: String, report: Boolean = true) = noisySu(commands.asIterable(), report)