Add DHCP workaround

Thanks to petergunn666 for debugging this with me.
This commit is contained in:
Mygod
2018-08-13 01:41:45 +08:00
parent 60c39baf0c
commit a9e483f3ff
8 changed files with 59 additions and 30 deletions

View File

@@ -47,14 +47,17 @@ class TetheringService : IpNeighbourMonitoringService(), UpstreamMonitor.Callbac
var failed = false
for ((downstream, value) in routings) if (value == null || value.upstream != upstream)
try {
// 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()
if (app.masquerade) routing.masquerade()
routing.dnsRedirect(dns)
if (app.pref.getBoolean("service.disableIpv6", false)) routing.disableIpv6()
routings[downstream] = routing
if (!routing.start()) failed = true
routings[downstream] = Routing(upstream, downstream).apply {
if (app.dhcpWorkaround) dhcpWorkaround()
// system tethering already has working forwarding rules
// so it doesn't make sense to add additional forwarding rules
rule()
forward()
if (app.masquerade) masquerade()
dnsRedirect(dns)
if (app.pref.getBoolean("service.disableIpv6", false)) disableIpv6()
if (!start()) failed = true
}
} catch (e: SocketException) {
e.printStackTrace()
Crashlytics.logException(e)