java/com/tailscale/ipn: explicitly allow IPv4 and IPv6 traffic

The VPNService.Builder object blocks traffic to IP families for which no
route, local address, nor DNS are defined. The Tailscale tunnel doesn't
cover all traffic, so both IP families should be kept open.

Updates tailscale/tailscale#453 (maybe fixes it)
Updates tailscale/tailscale#431 (another DNS problem)

Signed-off-by: Elias Naur <mail@eliasnaur.com>
pull/2/head
Elias Naur 4 years ago
parent c290ccf388
commit 271d40978e

@ -9,6 +9,7 @@ import android.app.PendingIntent;
import android.app.NotificationChannel;
import android.content.Intent;
import android.net.VpnService;
import android.system.OsConstants;
import org.gioui.GioActivity;
@ -56,7 +57,10 @@ public class IPNService extends VpnService {
}
protected VpnService.Builder newBuilder() {
return new VpnService.Builder().setConfigureIntent(configIntent());
return new VpnService.Builder()
.setConfigureIntent(configIntent())
.allowFamily(OsConstants.AF_INET)
.allowFamily(OsConstants.AF_INET6);
}
public void notify(String title, String message) {

@ -135,6 +135,8 @@ func (b *backend) updateTUN(service jni.Object, cfg *router.Config) error {
}
err := jni.Do(b.jvm, func(env jni.Env) error {
cls := jni.GetObjectClass(env, service)
// Construct a VPNService.Builder. IPNService.newBuilder calls
// setConfigureIntent, and allowFamily for both IPv4 and IPv6.
m := jni.GetMethodID(env, cls, "newBuilder", "()Landroid/net/VpnService$Builder;")
builder, err := jni.CallObjectMethod(env, service, m)
if err != nil {

Loading…
Cancel
Save