Fix VPN connections change handlers

This commit is contained in:
Mygod
2018-01-13 12:13:22 +08:00
parent 57b9463a6f
commit c25b7a3f0c
4 changed files with 7 additions and 6 deletions

View File

@@ -41,7 +41,8 @@ class Routing(private val upstream: String, val downstream: String, ownerAddress
*/
fun rule(): Routing {
startScript.add("ip rule add from all iif $downstream lookup $upstream priority 17900")
stopScript.addFirst("ip rule del from all iif $downstream lookup $upstream priority 17900")
// by the time stopScript is called, table entry for upstream may already get removed
stopScript.addFirst("ip rule del from all iif $downstream priority 17900")
return this
}