Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Unable to start YggdrasilTunService due to incorrect defaults in MulticastInterfaces.Port (required uint16 but returned Double) #15

Open
vikulin opened this issue Oct 14, 2021 · 2 comments

Comments

@vikulin
Copy link
Member

vikulin commented Oct 14, 2021

Unable to start YggdrasilTunService due to incorrect defaults in MulticastInterfaces.Port (required uint16 but returned Double).

Preconditions:
Build native lib for Android in Yggdrasil develop branch.

vadym@ubuntu:~/yggdrasil-go$ go get github.com/yggdrasil-network/yggdrasil-extras@ffba69b
go: downloading github.com/yggdrasil-network/yggdrasil-extras v0.0.0-20210927081343-ffba69bac4cd
go get: added github.com/yggdrasil-network/yggdrasil-extras v0.0.0-20210927081343-ffba69bac4cd
vadym@ubuntu:~/yggdrasil-go$ ./clean 
vadym@ubuntu:~/yggdrasil-go$ ANDROID=true ./build 
Building aar for Android
go get: upgraded golang.org/x/mobile v0.0.0-20210527171505-7e972142eb43 => v0.0.0-20210924032853-1c027f395ef7
vadym@ubuntu:~/yggdrasil-go$

Start YggdrasilTunService which receives

var configJson = Mobile.generateConfigJSON()

Appropriate line in extras:
https://github.com/yggdrasil-network/yggdrasil-extras/blob/master/src/mobile/mobile.go#L109

AR: app crashes, configJson has following structure and icorrect port typ
2021-10-14_16h20_29
e

Stack trace:

     Caused by: go.Universe$proxyerror: json: cannot unmarshal number 0.0 into Go struct field MulticastInterfaceConfig.MulticastInterfaces.Port of type uint16
        at mobile.Yggdrasil.startJSON(Native Method)
        at org.yggdrasil.app.crispa.YggdrasilTunService.setupTunInterface(YggdrasilTunService.kt:122)
        at org.yggdrasil.app.crispa.YggdrasilTunService.onStartCommand(YggdrasilTunService.kt:62)
        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3326)
        at android.app.ActivityThread.-wrap21(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1582) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6119) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

Probable solution: set default port 0 for defauts in MulticastInterfaceConfig
https://github.com/yggdrasil-network/yggdrasil-go/blob/f92d812f3cc02f5f1aa49fa4085dfe523afd313b/src/defaults/defaults_other.go#L18

@neilalexander neilalexander transferred this issue from yggdrasil-network/yggdrasil-go Oct 14, 2021
@neilalexander
Copy link
Member

I don't think setting the value to 0 in the defaults package will help — that's already the default value and even the IfMTU is showing 65535.0 in your screenshot.

I wonder if this is a bug in the gomobile bindings?

@vikulin
Copy link
Member Author

vikulin commented Oct 14, 2021

I don't think setting the value to 0 in the defaults package will help — that's already the default value and even the IfMTU is showing 65535.0 in your screenshot.

I wonder if this is a bug in the gomobile bindings?

Anyway I was able to run the native lib by overriding incorrect values:

        config["IfMTU"] = 65535
        var multicastInterface = emptyMap<String, Any>().toMutableMap()
        multicastInterface["Regex"] = ".*"
        multicastInterface["Beacon"] = true
        multicastInterface["Listen"] = true
        multicastInterface["Port"] = 0
        (config["MulticastInterfaces"] as MutableList<Any>)[0] = multicastInterface

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants