Fix crash on Android 9 and below (#81)

This commit is contained in:
John Maguire 2022-11-08 08:08:07 -07:00 committed by GitHub
parent 552d16bce2
commit 5ec6004a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -92,10 +92,13 @@ class NebulaVpnService : VpnService() {
.addRoute(ipNet.network, ipNet.maskSize.toInt()) .addRoute(ipNet.network, ipNet.maskSize.toInt())
.setMtu(site!!.mtu) .setMtu(site!!.mtu)
.setSession(TAG) .setSession(TAG)
.setMetered(false)
.allowFamily(OsConstants.AF_INET) .allowFamily(OsConstants.AF_INET)
.allowFamily(OsConstants.AF_INET6); .allowFamily(OsConstants.AF_INET6);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
builder.setMetered(false);
}
// Add our unsafe routes // Add our unsafe routes
site!!.unsafeRoutes.forEach { unsafeRoute -> site!!.unsafeRoutes.forEach { unsafeRoute ->
val ipNet = mobileNebula.MobileNebula.parseCIDR(unsafeRoute.route) val ipNet = mobileNebula.MobileNebula.parseCIDR(unsafeRoute.route)