Skip to content

Commit

Permalink
Suppress eBPF not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Oct 22, 2024
1 parent 2bf93aa commit 5eae45a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import dalvik.system.PathClassLoader
import kotlinx.parcelize.Parcelize
import timber.log.Timber
import java.io.File
import java.lang.reflect.InvocationTargetException

/**
* https://android.googlesource.com/platform/system/netd/+/android-10.0.0_r1/server/NetdNativeService.cpp#1138
Expand Down Expand Up @@ -54,7 +55,13 @@ data class RemoveUidInterfaceRuleCommand(private val uid: Int) : RootCommand<Par
private val firewallRemoveUidInterfaceRules by lazy {
stub.getMethod("firewallRemoveUidInterfaceRules", IntArray::class.java)
}
operator fun invoke(uid: Int) = firewallRemoveUidInterfaceRules(netd, intArrayOf(uid))
operator fun invoke(uid: Int) {
try {
firewallRemoveUidInterfaceRules(netd, intArrayOf(uid))
} catch (e: InvocationTargetException) {
if (e.cause?.message != "[Operation not supported on transport endpoint] : eBPF not supported") throw e
}
}
}

/**
Expand Down

0 comments on commit 5eae45a

Please sign in to comment.