From c8d69b6059637d5ba74c893bebfeb944c0cbf477 Mon Sep 17 00:00:00 2001 From: Mygod Date: Mon, 20 Jul 2020 10:47:50 -0400 Subject: [PATCH] Account for legacy behavior for if_nametoindex --- mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt index f2da99f8..26b998de 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt @@ -153,7 +153,7 @@ class Routing(private val caller: Any, private val downstream: String) : IpNeigh * The only case when upstream is null is on API 23- and we are using system default rules. */ inner class Subrouting(priority: Int, val upstream: String? = null) { - val ifindex = if (upstream == null) 0 else if_nametoindex(upstream).also { check(it != 0) } + val ifindex = if (upstream == null) 0 else if_nametoindex(upstream).also { check(it > 0) } val transaction = RootSession.beginTransaction().safeguard { if (upstream != null) ipRuleLookup(ifindex, priority) @TargetApi(28) when (masqueradeMode) {