pelzvieh / IPv6Droid

IPv6 tunnel client for use on Android
20 stars 5 forks source link

NPE race condition after network change / socket invalidation #44

Closed pelzvieh closed 5 years ago

pelzvieh commented 5 years ago

Network changes might lead to invalidation of vpnFD by OS. In rare occasions, and, as it seems, starting with Android P, vpnFD.getFileDescriptor runs into an NPE, calling getFileDescriptor$() on a null DatagramSocket. It seems that a DatagramSocket used internally in ParcelFileDescriptor might have been set to null by OS/Android application framework. It remains unclear how to deal with it. Perhaps it helps to call checkError before accessing vpnVD.

pelzvieh commented 5 years ago

Fixed in revision a6057fd50629c3bef9684577bb9dccb5afac9f68: This issue is grounded the ugly way: I wrapped the Builder.establish call with a try/catch on NPE. This is handled as a temporary technical exception, leading to a time-delayed retry-loop.