guardianproject / lildebi

UNMAINTAINED please adopt! we can no longer maintain this
https://guardianproject.info/code
GNU General Public License v3.0
229 stars 55 forks source link

use DNS settings from Android #89

Open peat-psuwit opened 10 years ago

peat-psuwit commented 10 years ago

In many network (including mine), the network administrators prohibit connecting public DNS server, making default setting in /etc/resolv.conf not works.

As we can read DNS settings by "getprop" command anyway, why don't we read it out and set it properly each time we boot up debian. I suggest following code:

echo "" > $mnt/etc/resolv.conf
i=1
dns=$(getprop net.dns$i)
while [[ $dns ]]; do
    echo "nameserver $dns" >> $mnt/etc/resolv.conf
    i=$(( $i + 1 ))
    dns=$(getprop net.dns$i)
done

We can also listen to network changes broadcast and run this snippet of code when the network situation is changed. See http://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html

eighthave commented 10 years ago

This definitely sounds useful. Do you have this working on your device? I think the way to do it would be to figure out how the /etc/network scripts get called on a pure Debian system, then reproduce that in Lil' Debi. Then people can customize their network setups in the normal Debian way.

jfmcbrayer commented 9 years ago

The android-androresolvd package ought to solve this, if I understand correctly. However, I can't run it, as I get "Cannot access system properties via ANDROID_PROPERTY_WORKSPACE environment setting". That env. variable exists in my android environment (e.g, by adb shell), but looks like it is getting cleaned up by time I get a shell on debian.

eighthave commented 9 years ago

There are probably a couple of other important env vars that don't make it though, like LD_LIBRARY_PATH. I wonder where they are being stripped.

forresthopkinsa commented 9 years ago

Has anyone figured out how to get androresolvd working yet?

gskillas commented 8 years ago

I have a Fairphone, first edition, which comes rooted by default. I get the same error "Cannot access system properties via ANDROID_PROPERTY_WORKSPACE environment setting". probing the environment variables yields:

root@phone:/# export declare -x ANDROID_ASSETS="/system/app" declare -x ANDROID_BOOTLOGO="1" declare -x ANDROID_DATA="/data" declare -x ANDROID_PROPERTY_WORKSPACE="8,49664" declare -x ANDROID_ROOT="/system" declare -x ANDROID_SOCKET_zygote="9" declare -x ANDROID_STORAGE="/storage" . . . root@phone:/#

Can I set the ANDROID_PROPERTY_WORKSPACE to something sensible (assuming the variable is wrongly set)? What is a sensible value?

Best regards,

George