Refine error message
This commit is contained in:
@@ -153,7 +153,9 @@ 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.
|
* 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) {
|
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 {
|
||||||
|
if (it <= 0) throw IOException("Interface $upstream not found")
|
||||||
|
}
|
||||||
val transaction = RootSession.beginTransaction().safeguard {
|
val transaction = RootSession.beginTransaction().safeguard {
|
||||||
if (upstream != null) ipRuleLookup(ifindex, priority)
|
if (upstream != null) ipRuleLookup(ifindex, priority)
|
||||||
@TargetApi(28) when (masqueradeMode) {
|
@TargetApi(28) when (masqueradeMode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user