@@ -49,6 +49,7 @@ class TetheringService : IpNeighbourMonitoringService(), VpnMonitor.Callback {
|
||||
// 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().masquerade().dnsRedirect(dns)
|
||||
if (app.pref.getBoolean("service.disableIpv6", false)) routing.disableIpv6()
|
||||
routings[downstream] = routing
|
||||
if (!routing.start()) failed = true
|
||||
} catch (e: SocketException) {
|
||||
|
||||
@@ -47,6 +47,12 @@ class Routing(val upstream: String?, private val downstream: String, ownerAddres
|
||||
return this
|
||||
}
|
||||
|
||||
fun disableIpv6(): Routing {
|
||||
startScript.add("echo 1 >/proc/sys/net/ipv6/conf/$downstream/disable_ipv6")
|
||||
stopScript.add("echo 0 >/proc/sys/net/ipv6/conf/$downstream/disable_ipv6")
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Since Android 5.0, RULE_PRIORITY_TETHERING = 18000.
|
||||
* This also works for Wi-Fi direct where there's no rule at 18000.
|
||||
|
||||
Reference in New Issue
Block a user