@@ -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.
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
<string name="settings_service_repeater_oc_summary">"自动 (1\u201114 = 2.4GHz, 15\u2011165 = 5GHz)"</string>
|
||||
<string name="settings_service_repeater_strict">严格模式</string>
|
||||
<string name="settings_service_repeater_strict_summary">只允许通过 VPN 隧道的包通过,不适用于系统共享</string>
|
||||
<string name="settings_service_disable_ipv6">禁用 IPv6 共享</string>
|
||||
<string name="settings_service_disable_ipv6_summary">防止 IPv6 VPN 泄漏。</string>
|
||||
<string name="settings_service_dns">备用 DNS 服务器[:端口]</string>
|
||||
<string name="settings_service_clean">清理/重新应用路由规则</string>
|
||||
<string name="settings_misc">杂项</string>
|
||||
|
||||
@@ -64,6 +64,8 @@
|
||||
<string name="settings_service_repeater_strict">Strict mode</string>
|
||||
<string name="settings_service_repeater_strict_summary">Only allow packets that goes through VPN tunnel. Does not
|
||||
apply to system tethering.</string>
|
||||
<string name="settings_service_disable_ipv6">Disable IPv6 tethering</string>
|
||||
<string name="settings_service_disable_ipv6_summary">Enabling this option will prevent VPN leaks via IPv6.</string>
|
||||
<string name="settings_service_dns">Fallback DNS server[:port]</string>
|
||||
<string name="settings_service_clean">Clean/reapply routing rules</string>
|
||||
<string name="settings_misc">Misc</string>
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
android:key="service.repeater.strict"
|
||||
android:title="@string/settings_service_repeater_strict"
|
||||
android:summary="@string/settings_service_repeater_strict_summary"/>
|
||||
<SwitchPreference
|
||||
android:key="service.disableIpv6"
|
||||
android:title="@string/settings_service_disable_ipv6"
|
||||
android:summary="@string/settings_service_disable_ipv6_summary"/>
|
||||
<AutoSummaryEditTextPreference
|
||||
android:key="service.dns"
|
||||
android:title="@string/settings_service_dns"
|
||||
|
||||
Reference in New Issue
Block a user