cmd/tailscale: mask route addresses to please VpnService.Builder.addRoute

Update inet.af/netaddr for IPPrefix.Masked.

Fixes tailscale/tailscale#645

Signed-off-by: Elias Naur <mail@eliasnaur.com>
pull/3/head
Elias Naur 4 years ago
parent 454c59a4e5
commit 758e5691da

@ -207,6 +207,8 @@ func (b *backend) updateTUN(service jni.Object, cfg *router.Config) error {
// builder.addRoute. // builder.addRoute.
addRoute := jni.GetMethodID(env, bcls, "addRoute", "(Ljava/lang/String;I)Landroid/net/VpnService$Builder;") addRoute := jni.GetMethodID(env, bcls, "addRoute", "(Ljava/lang/String;I)Landroid/net/VpnService$Builder;")
for _, route := range cfg.Routes { for _, route := range cfg.Routes {
// Normalize route address; Builder.addRoute does not accept non-zero masked bits.
route = route.Masked()
_, err = jni.CallObjectMethod(env, _, err = jni.CallObjectMethod(env,
builder, builder,
addRoute, addRoute,

@ -11,6 +11,6 @@ require (
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3 golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e golang.org/x/sys v0.0.0-20200501052902-10377860bb8e
inet.af/netaddr v0.0.0-20200718043157-99321d6ad24c inet.af/netaddr v0.0.0-20200810144936-56928fe48a98
tailscale.com v0.100.1-0.20200724211229-0a42b0a72666 tailscale.com v0.100.1-0.20200724211229-0a42b0a72666
) )

@ -174,6 +174,8 @@ gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
inet.af/netaddr v0.0.0-20200718043157-99321d6ad24c h1:si3Owrfem175Ry6gKqnh59eOXxDojyBTIHxUKuvK/Eo= inet.af/netaddr v0.0.0-20200718043157-99321d6ad24c h1:si3Owrfem175Ry6gKqnh59eOXxDojyBTIHxUKuvK/Eo=
inet.af/netaddr v0.0.0-20200718043157-99321d6ad24c/go.mod h1:qqYzz/2whtrbWJvt+DNWQyvekNN4ePQZcg2xc2/Yjww= inet.af/netaddr v0.0.0-20200718043157-99321d6ad24c/go.mod h1:qqYzz/2whtrbWJvt+DNWQyvekNN4ePQZcg2xc2/Yjww=
inet.af/netaddr v0.0.0-20200810144936-56928fe48a98 h1:bWyWDZP0l6VnQ1TDKf6yNwuiEDV6Q3q1Mv34m+lzT1I=
inet.af/netaddr v0.0.0-20200810144936-56928fe48a98/go.mod h1:qqYzz/2whtrbWJvt+DNWQyvekNN4ePQZcg2xc2/Yjww=
rsc.io/goversion v1.2.0 h1:SPn+NLTiAG7w30IRK/DKp1BjvpWabYgxlLp/+kx5J8w= rsc.io/goversion v1.2.0 h1:SPn+NLTiAG7w30IRK/DKp1BjvpWabYgxlLp/+kx5J8w=
rsc.io/goversion v1.2.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo= rsc.io/goversion v1.2.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo=
tailscale.com v0.100.1-0.20200724211229-0a42b0a72666 h1:U4Jv6EAusLfOmNQmjgstVaIhtIB38onIcnx8D3a6dH4= tailscale.com v0.100.1-0.20200724211229-0a42b0a72666 h1:U4Jv6EAusLfOmNQmjgstVaIhtIB38onIcnx8D3a6dH4=

Loading…
Cancel
Save