Fix persistent group on Android 11

Also only request persistent group when necessary.
This commit is contained in:
Mygod
2020-07-02 06:26:55 +08:00
parent a5adff4b65
commit d462b3ac07
6 changed files with 67 additions and 87 deletions

View File

@@ -48,7 +48,7 @@ abstract class RoutingManager(private val caller: Any, val downstream: String, p
/**
* Both repeater and local-only hotspot are Wi-Fi based.
*/
open class LocalOnly(caller: Any, downstream: String) : RoutingManager(caller, downstream, true) {
class LocalOnly(caller: Any, downstream: String) : RoutingManager(caller, downstream, true) {
override fun Routing.configure() {
ipForward() // local only interfaces need to enable ip_forward
forward()
@@ -84,10 +84,8 @@ abstract class RoutingManager(private val caller: Any, val downstream: String, p
}
}
open fun ifaceHandler(iface: NetworkInterface) { }
private fun initRoutingLocked() = try {
routing = Routing(caller, downstream, this::ifaceHandler).apply {
routing = Routing(caller, downstream).apply {
try {
configure()
} catch (e: Exception) {