From 4b43a6a1bafdbcdd3753e805d4051e55dc71e7df Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 22 Feb 2018 01:13:52 -0800 Subject: [PATCH] Do not assume iptables-save is available --- mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt | 2 +- mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt index ec904d95..e221480e 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/TetheringService.kt @@ -51,7 +51,7 @@ class TetheringService : Service(), VpnMonitor.Callback, IpNeighbourMonitor.Call for ((downstream, value) in routings) if (value == null) { // system tethering already has working forwarding rules // so it doesn't make sense to add additional forwarding rules - val routing = Routing(upstream, downstream).rule().forward(true).dnsRedirect(dns) + val routing = Routing(upstream, downstream).rule().forward().dnsRedirect(dns) if (routing.start()) routings[downstream] = routing else { failed = true routing.stop() 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 a89d33c9..4533171c 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt @@ -32,10 +32,10 @@ class Routing(val upstream: String?, val downstream: String, ownerAddress: InetA fun dump() = loggerSu(""" |echo iptables - |iptables-save + |sh -c 'exec -a iptables-save iptables' |echo |echo iptables -t nat - |iptables-save -t nat + |sh -c 'exec -a iptables-save iptables -t nat' |echo |echo ip rule |ip rule