hyperboria / android

Android app for mesh networking with cjdns
GNU General Public License v3.0
159 stars 40 forks source link

Not working #47

Closed sssemil closed 7 years ago

sssemil commented 9 years ago

This thing is not working at all(tried on One PlusOne with Android 5.1.1 and on emulator with Android 5.1). It's not creating any tun0 interface and it's impossible to connect to any hyperboria sites(even after manually adding public nodes to cjdroute.conf).

P.S. it creates tun0 interface if you run it manually from terminal emulator or adb as root.

benhylau commented 8 years ago

So I only got as far as mocking out the UI before going mia since the summer. Because of https://github.com/hyperboria/cjdns/pull/61 I am still not able to build the binary for ARM from my Mac. So this is all wip and I don't expect it to already be working :)

Thanks for the scripted build by the way, it's very helpful, although I still cannot build from Darwin.

sssemil commented 8 years ago

Well, never had Darwin for testing :P

sssemil commented 8 years ago

I can only suggest installing some Linux on a virtual machine

benhylau commented 8 years ago

I got this working through the app as su. Something like:

Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("su");
DataOutputStream dos = new DataOutputStream(process.getOutputStream());
dos.writeBytes("/data/data/berlin.meshnet.cjdns/cjdroute < /data/data/berlin.meshnet.cjdns/files/cjdroute.conf" + "\n");
dos.flush();

If I don't run in a su shell then it crashes due to permission:

INFO cjdroute2.c:601 Cjdns armel linux
INFO cjdroute2.c:605 Checking for running instance...
DEBUG UDPAddrIface.c:294 Bound to address [0.0.0.0:57090]
DEBUG AdminClient.c:333 Connecting to [127.0.0.1:11234]

Pipe.c:441 uv_pipe_bind() failed [permission denied] for pipe [/data/local/tmp/cjdns_pipe_client-core-knzmzrszpflffd9mzyy81tdmd3gcqu]
Fatal signal 6 (SIGABRT) at 0x000008eb (code=-6), thread 2283 (cjdroute)

Looks like this isn't a good place to put these files since it's only accessible with root.

@lgierth @kpcyrd

sssemil commented 8 years ago

If I run binary as root it kinda works(creates tun0 interface), but ping says that networks is unreachable :ь

benhylau commented 8 years ago

You mean running it not through the app, but adb in and manually execute:

/data/data/berlin.meshnet.cjdns/cjdroute < /data/data/berlin.meshnet.cjdns/files/cjdroute.conf

Does your cjdroute.conf have peers?

benhylau commented 8 years ago

^Forgot to mention my /data/data/berlin.meshnet.cjdns/files/cjdroute.conf is not the default generated one. I injected a set of peer credentials into that. With su I can actually reach nodes with ping6

sssemil commented 8 years ago

Yeap, I have peers and I was using ping6. Maybe that's cus of my android version which is 5.1

benhylau commented 8 years ago

Well... I am also running a different binary from the second point here: https://github.com/hyperboria/cjdns/pull/61#issuecomment-168099044

The cjdroute process is actually running and still you cannot reach the network?

sssemil commented 8 years ago

I've compiled it myself and it wasn't working. Where did you get another binary?

benhylau commented 8 years ago

@prurigro builds them. He gave me a link to a build from a previous codebase, before the change that broke Android.

sssemil commented 8 years ago

Could you please give me link to breaking changes?

kpcyrd commented 8 years ago

@sssemil this is still work in progress and I'm not sure it has ever worked, yet. (I don't own an android device currently (donations welcome tho (but there are other people who could probably put this into better use)))

Network is unreachable is unrelated to the configuration of cjdroute, the message is from the kernel saying sending a packet to that IP failed because there's no route that matches this IP. That means the fc00::/8 route hasn't been set in the kernel's routing table (and there's also no default route for IPv6) so it doesn't know what to do with that packet. You can verify the route with ip -6 r, but I'm not sure if this is supported on android. The route is set implicitly by adding an IP with /8, so I suspect the IP hasn't been configured on the tun, if the tun has been created at all.

@benhylau requiring root is ok for me until we figure out another way to do things. You can remove the \n and flush if you close stdin after sending the command. I'd merge the PR if you want to prepare one. cc @lgierth

I've merged hyperboria/cjdns#61 yesterday.

sssemil commented 8 years ago

@kpcyrd u0_a138@A0001:/ $ su root@A0001:/ # cjdroute < /cjdroute.conf 1452072917 INFO cjdroute2.c:615 Cjdns armel linux +seccomp 1452072917 INFO cjdroute2.c:619 Checking for running instance... 1452072917 DEBUG UDPAddrIface.c:293 Bound to address [0.0.0.0:39686] 1452072917 DEBUG AdminClient.c:333 Connecting to [127.0.0.1:11234] 1452072917 DEBUG Pipe.c:134 Buffering a message 1452072917 DEBUG cjdroute2.c:664 Sent [140] bytes to core 1452072917 INFO RandomSeed.c:42 Attempting to seed random number generator 1452072917 INFO RandomSeed.c:50 Trying random seed [/dev/urandom] Success 1452072917 INFO RandomSeed.c:50 Trying random seed [/proc/sys/kernel/random/uuid (Linux)] Success 1452072917 INFO RandomSeed.c:64 Seeding random number generator succeeded with [2] sources 1452072917 INFO LibuvEntropyProvider.c:59 Taking clock samples every [1000]ms for random generator 1452072917 DEBUG Core.c:263 Getting pre-configuration from client 1452072917 DEBUG Pipe.c:231 Pipe [/data/local/tmp/cjdns_pipe_client-core-frv6pzcs34f68hpyfnh8usy2r3t2gv] established connection 1452072917 DEBUG Pipe.c:231 1452072917 DEBUG Pipe.c:253 Sending buffered message Pipe [/data/local/tmp/cjdns_pipe_client-core-frv6pzcs34f68hpyfnh8usy2r3t2gv] established connection 1452072917 DEBUG Core.c:266 Finished getting pre-configuration from client 1452072917 DEBUG UDPAddrIface.c:254 Binding to address [127.0.0.1:11234]1452072917 DEBUG UDPAddrIface.c:293 Bound to address [127.0.0.1:11234] 1452072917 DEBUG UDPAddrIface.c:293 Bound to address [0.0.0.0:60177] 1452072917 DEBUG AdminClient.c:333 Connecting to [127.0.0.1:11234] 1452072917 INFO Configurator.c:135 Checking authorized password 0. 1452072917 INFO Configurator.c:159 Adding authorized password #[0] for user [default-login]. 1452072917 INFO Configurator.c:374 Setting up all ETHInterfaces... 1452072917 DEBUG Configurator.c:539 Security_noforks() 1452072917 DEBUG Configurator.c:544 Security_setUser(uid:9999, keepNetAdmin:1) 1452072917 DEBUG Configurator.c:564 Security_setupComplete() 1452072917 DEBUG Configurator.c:648 Cjdns started in the background 127|root@A0001:/ # busybox ifconfig tun0 tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet6 addr: fc98:a906:8913:344f:2628:8029:29c7:cc69/8 Scope:Global UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1304 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:500 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) root@A0001:/ # ip -6 r root@A0001:/ #

benhylau commented 8 years ago

@sssemil Made a ticket https://github.com/hyperboria/cjdns/issues/93 @kpcyrd Will put in a PR

benhylau commented 8 years ago
root@hammerhead:/data/data/berlin.meshnet.cjdns # setenforce 0
root@hammerhead:/data/data/berlin.meshnet.cjdns # getenforce                                                        │~/D/p/g/cjdns-android ❯❯❯
Permissive
root@hammerhead:/data/data/berlin.meshnet.cjdns # ./cjdroute < files/cjdroute.conf
  ...
root@hammerhead:/data/data/berlin.meshnet.cjdns # ps ax cjdroute                                                    │~/D/p/g/cjdns-android ❯❯❯
USER     PID   PPID  VSIZE  RSS     WCHAN    PC        NAME                                                         │~/D/p/g/cjdns-android ❯❯❯
nobody    3041  1     9752   1364  c02ae838 b6e16534 S /data/data/berlin.meshnet.cjdns/cjdroute

On the 4.4.4 Nexus S, the process is owned by root. But I can't get this 5.1.1 Nexus 5 to run cjdroute as root. SELinux related? http://android.stackexchange.com/questions/54577/how-can-i-change-selinux-from-enforcing-to-permissive-on-samsung-galaxy-note-3/75384#75384

benhylau commented 8 years ago

On the 4.4.4 Nexus S:

126|root@crespo:/ # cat /proc/net/ipv6_route
fcaa5785a53790db6513bba987a012a7 80 00000000000000000000000000000000 00 fcaa5785a53790db6513bba987a012a7 00000000 00000003 00000006 01000001     tun0
  ...
root@crespo:/ # ip -6 r
fc00::/8 dev tun0  proto kernel  metric 256  mtu 1304
fe80::/64 dev wlan0  proto kernel  metric 256
fe80::/64 dev tun0  proto kernel  metric 256  mtu 1304

And the 5.1.1 Nexus 5, ipv6_route doesn't contain the fc00::/8 entry and ip -6 r shows nothing. I tried manually adding with ip -6 route add to get the latter in, but don't have write permission to add the entry in ipv6_route. Looks like cjdroute didn't fully configure the tun on 5.1.1.

sssemil commented 8 years ago

Looks like we'll need to use android's API. Plus is that we can make it working without root. I think Orbot has it, so it's good place to look into. We can also try playing with user names.

kylerchin commented 8 years ago

It appears the app crashes on attempt to turn on cjdns. Opening the app is ok, but clicking the switch results in a crash. Tested on: Verizon Samsung S6 Unlocked Samsung S3

kylerchin commented 8 years ago

I installed it from the app apk from own.darkcloud.ca:90/Android-Builds

benhylau commented 8 years ago

Yes this is currently not working. Closest thing is on develop, but it has binaries missing. The source to generate the binaries need to be committed to cjdns repo still. Then I clean up the develop branch to generate a working build without root. @lgierth

benhylau commented 8 years ago

The binaries can be built from https://github.com/cjdelisle/cjdns/pull/971 Checkout https://github.com/hyperboria/android/tree/develop, drop in the binaries, connect your phone and ./install_debug.

vikulin commented 6 years ago

I'm getting license error: root@gem-01:~/android# ./install_debug ./install_debug: 3: ./install_debug: ndk-build: not found Starting Build Settings evaluated using settings file '/master/settings.gradle'. Projects loaded. Root project using build file '/root/android/build.gradle'. Included projects: [root project 'android'] Evaluating root project 'android' using build file '/root/android/build.gradle'. Creating configuration compile Creating configuration apk Creating configuration provided Creating configuration wearApp Creating configuration annotationProcessor Creating configuration androidTestCompile Creating configuration androidTestApk Creating configuration androidTestProvided Creating configuration androidTestWearApp Creating configuration androidTestAnnotationProcessor Creating configuration testCompile Creating configuration testApk Creating configuration testProvided Creating configuration testWearApp Creating configuration testAnnotationProcessor Creating configuration debugCompile Creating configuration debugApk Creating configuration debugProvided Creating configuration debugWearApp Creating configuration debugAnnotationProcessor Creating configuration testDebugCompile Creating configuration testDebugApk Creating configuration testDebugProvided Creating configuration testDebugWearApp Creating configuration testDebugAnnotationProcessor Creating configuration releaseCompile Creating configuration releaseApk Creating configuration releaseProvided Creating configuration releaseWearApp Creating configuration releaseAnnotationProcessor Creating configuration testReleaseCompile Creating configuration testReleaseApk Creating configuration testReleaseProvided Creating configuration testReleaseWearApp Creating configuration testReleaseAnnotationProcessor Parsing the SDK, no caching allowed Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-15/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-16/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-17/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-18/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-19/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-21/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-22/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-23/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-24/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_gdk-google-19/package.xml Parsing /opt/android-sdk-linux/build-tools/28.0.2/package.xml Parsing /opt/android-sdk-linux/docs/package.xml Parsing /opt/android-sdk-linux/extras/android/m2repository/package.xml Parsing /opt/android-sdk-linux/extras/google/auto/package.xml Parsing /opt/android-sdk-linux/extras/google/google_play_services/package.xml Parsing /opt/android-sdk-linux/extras/google/instantapps/package.xml Parsing /opt/android-sdk-linux/extras/google/m2repository/package.xml Parsing /opt/android-sdk-linux/extras/google/market_apk_expansion/package.xml Parsing /opt/android-sdk-linux/extras/google/market_licensing/package.xml Parsing /opt/android-sdk-linux/extras/google/simulators/package.xml Parsing /opt/android-sdk-linux/extras/google/webdriver/package.xml Parsing /opt/android-sdk-linux/platform-tools/package.xml Parsing /opt/android-sdk-linux/platforms/android-10/package.xml Parsing /opt/android-sdk-linux/platforms/android-11/package.xml Parsing /opt/android-sdk-linux/platforms/android-12/package.xml Parsing /opt/android-sdk-linux/platforms/android-13/package.xml Parsing /opt/android-sdk-linux/platforms/android-14/package.xml Parsing /opt/android-sdk-linux/platforms/android-15/package.xml Parsing /opt/android-sdk-linux/platforms/android-16/package.xml Parsing /opt/android-sdk-linux/platforms/android-17/package.xml Parsing /opt/android-sdk-linux/platforms/android-18/package.xml Parsing /opt/android-sdk-linux/platforms/android-19/package.xml Parsing /opt/android-sdk-linux/platforms/android-20/package.xml Parsing /opt/android-sdk-linux/platforms/android-21/package.xml Parsing /opt/android-sdk-linux/platforms/android-22/package.xml Parsing /opt/android-sdk-linux/platforms/android-23/package.xml Parsing /opt/android-sdk-linux/platforms/android-24/package.xml Parsing /opt/android-sdk-linux/platforms/android-25/package.xml Parsing /opt/android-sdk-linux/platforms/android-26/package.xml Parsing /opt/android-sdk-linux/platforms/android-27/package.xml Parsing /opt/android-sdk-linux/platforms/android-28/package.xml Parsing /opt/android-sdk-linux/platforms/android-7/package.xml Parsing /opt/android-sdk-linux/platforms/android-8/package.xml Parsing /opt/android-sdk-linux/platforms/android-9/package.xml Parsing /opt/android-sdk-linux/tools/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-15/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-16/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-17/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-18/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-19/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-21/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-22/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-23/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-24/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_gdk-google-19/package.xml Parsing /opt/android-sdk-linux/build-tools/28.0.2/package.xml Parsing /opt/android-sdk-linux/docs/package.xml Parsing /opt/android-sdk-linux/extras/android/m2repository/package.xml Parsing /opt/android-sdk-linux/extras/google/auto/package.xml Parsing /opt/android-sdk-linux/extras/google/google_play_services/package.xml Parsing /opt/android-sdk-linux/extras/google/instantapps/package.xml Parsing /opt/android-sdk-linux/extras/google/m2repository/package.xml Parsing /opt/android-sdk-linux/extras/google/market_apk_expansion/package.xml Parsing /opt/android-sdk-linux/extras/google/market_licensing/package.xml Parsing /opt/android-sdk-linux/extras/google/simulators/package.xml Parsing /opt/android-sdk-linux/extras/google/webdriver/package.xml Parsing /opt/android-sdk-linux/platform-tools/package.xml Parsing /opt/android-sdk-linux/platforms/android-10/package.xml Parsing /opt/android-sdk-linux/platforms/android-11/package.xml Parsing /opt/android-sdk-linux/platforms/android-12/package.xml Parsing /opt/android-sdk-linux/platforms/android-13/package.xml Parsing /opt/android-sdk-linux/platforms/android-14/package.xml Parsing /opt/android-sdk-linux/platforms/android-15/package.xml Parsing /opt/android-sdk-linux/platforms/android-16/package.xml Parsing /opt/android-sdk-linux/platforms/android-17/package.xml Parsing /opt/android-sdk-linux/platforms/android-18/package.xml Parsing /opt/android-sdk-linux/platforms/android-19/package.xml Parsing /opt/android-sdk-linux/platforms/android-20/package.xml Parsing /opt/android-sdk-linux/platforms/android-21/package.xml Parsing /opt/android-sdk-linux/platforms/android-22/package.xml Parsing /opt/android-sdk-linux/platforms/android-23/package.xml Parsing /opt/android-sdk-linux/platforms/android-24/package.xml Parsing /opt/android-sdk-linux/platforms/android-25/package.xml Parsing /opt/android-sdk-linux/platforms/android-26/package.xml Parsing /opt/android-sdk-linux/platforms/android-27/package.xml Parsing /opt/android-sdk-linux/platforms/android-28/package.xml Parsing /opt/android-sdk-linux/platforms/android-7/package.xml Parsing /opt/android-sdk-linux/platforms/android-8/package.xml Parsing /opt/android-sdk-linux/platforms/android-9/package.xml Parsing /opt/android-sdk-linux/tools/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-15/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-16/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-17/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-18/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-19/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-21/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-22/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-23/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_apis-google-24/package.xml Parsing /opt/android-sdk-linux/add-ons/addon-google_gdk-google-19/package.xml Parsing /opt/android-sdk-linux/build-tools/28.0.2/package.xml Parsing /opt/android-sdk-linux/docs/package.xml Parsing /opt/android-sdk-linux/extras/android/m2repository/package.xml Parsing /opt/android-sdk-linux/extras/google/auto/package.xml Parsing /opt/android-sdk-linux/extras/google/google_play_services/package.xml Parsing /opt/android-sdk-linux/extras/google/instantapps/package.xml Parsing /opt/android-sdk-linux/extras/google/m2repository/package.xml Parsing /opt/android-sdk-linux/extras/google/market_apk_expansion/package.xml Parsing /opt/android-sdk-linux/extras/google/market_licensing/package.xml Parsing /opt/android-sdk-linux/extras/google/simulators/package.xml Parsing /opt/android-sdk-linux/extras/google/webdriver/package.xml Parsing /opt/android-sdk-linux/platform-tools/package.xml Parsing /opt/android-sdk-linux/platforms/android-10/package.xml Parsing /opt/android-sdk-linux/platforms/android-11/package.xml Parsing /opt/android-sdk-linux/platforms/android-12/package.xml Parsing /opt/android-sdk-linux/platforms/android-13/package.xml Parsing /opt/android-sdk-linux/platforms/android-14/package.xml Parsing /opt/android-sdk-linux/platforms/android-15/package.xml Parsing /opt/android-sdk-linux/platforms/android-16/package.xml Parsing /opt/android-sdk-linux/platforms/android-17/package.xml Parsing /opt/android-sdk-linux/platforms/android-18/package.xml Parsing /opt/android-sdk-linux/platforms/android-19/package.xml Parsing /opt/android-sdk-linux/platforms/android-20/package.xml Parsing /opt/android-sdk-linux/platforms/android-21/package.xml Parsing /opt/android-sdk-linux/platforms/android-22/package.xml Parsing /opt/android-sdk-linux/platforms/android-23/package.xml Parsing /opt/android-sdk-linux/platforms/android-24/package.xml Parsing /opt/android-sdk-linux/platforms/android-25/package.xml Parsing /opt/android-sdk-linux/platforms/android-26/package.xml Parsing /opt/android-sdk-linux/platforms/android-27/package.xml Parsing /opt/android-sdk-linux/platforms/android-28/package.xml Parsing /opt/android-sdk-linux/platforms/android-7/package.xml Parsing /opt/android-sdk-linux/platforms/android-8/package.xml Parsing /opt/android-sdk-linux/platforms/android-9/package.xml Parsing /opt/android-sdk-linux/tools/package.xml

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 14.957 secs Stopped 0 compiler daemon(s). root@gem-01:~/android#