[android-porting] Android eclair 2.1 - problem to get dns through dhcpcd in wifi network

471 peržiūra
Praleisti ir pereiti prie pirmo neskaityto pranešimo

Максим Андрущенко

neskaityta,
2010-05-17 09:05:062010-05-17
kam: android...@googlegroups.com
Hi.
There is a problem on my platform during starting wifi. DNS is always 0.0.0.0.
I use dhcpcd for getting ip address, gateway, dns.
DHCPCD gets correct IP address and gateway, but dns is zero.
So i can type in browser ip address of a site and open it. But not name, such www.google.com.

Here is log messages on my platform:

V/WifiMonitor(init: starting 'dhcpcd'
1732): Event [Associated with 00:27:19:18:36:a2]
V/WifiMonitor( 1732): Event [CTRL-EVENT-STATE-CHANGE id=0 state=7]
V/WifiStateTracker( 1732): Changing supplicant state: ASSOCIATING ==> ASSOCIATED
D/NetworkStateTracker( 1732): setDetailed state, old =CONNECTING and new state=CONNECTING
V/WifiStateTracker( 1732): Changing supplicant state: ASSOCIATED ==> COMPLETED
V/WifiMonitor( 1732): Event [CTRL-EVENT-CONNECTED - Connection to 00:27:19:18:36:a2 completed (auth) [id=0 id_str=]]
V/WifiStateTracker( 1732): New network state is CONNECTED
D/WifiStateTracker( 1732): DhcpHandler: DHCP request started
D/NetworkStateTracker( 1732): setDetailed state, old =CONNECTING and new state=OBTAINING_IPADDR
D/ConnectivityService( 1732): ConnectivityChange for WIFI: CONNECTING/OBTAINING_IPADDR
D/SettingsWifiEnabler( 1915): Received network state changed to NetworkInfo: type: WIFI[], state: CONNECTING/OBTAINING_IPADDR, reason: (unspecified), extra: (none), roaming: falsee
wlan0: dhcpcd 4.0.1 starting
wlan0: host does not support a monotonic clock - timing can skew
wlan0: broadcasting for a lease
wlan0: offered 192.168.1.101 from 192.168.1.1 `ÿ'
wlan0: checking 192.168.1.101 is available on attached networks
wlan0: acknowledged 192.168.1.101 from 192.168.1.1 `ÿ'
wlan0: leased 192.168.1.101 for 7200 seconds
init: waitpid returned pid 2417, status = 00000000
init: process 'dhcpcd', pid 2417 exited
V/WifiStateTracker( 1732): DhcpHandler: DHCP request succeeded
D/NetworkStateTracker( 1732): setDetailed state, old =OBTAINING_IPADDR and new state=CONNECTED
V/WifiStateTracker( 1732): IP configuration: ipaddr 192.168.1.101 gateway 192.168.1.1 netmask 255.255.255.0 dns1 0.0.0.0 dns2 0.0.0.0 DHCP server 192.168.1.1 lease 7200 seconds
D/ConnectivityService( 1732): ConnectivityChange for WIFI: CONNECTED/CONNECTED

The same situation was with my ethernet card, i couldn't obtain DNS. only ip and gateway, using dhcpcd.
My access point is right, because i successfully gets ip, gw, dns from netbook.

So my question is, what could be wrong in Android.
I use Eclair version 2.1 which i downloaded on the 23 of february from master branch?
I there a solution how to fix problems with getting dns?

Regards,
Max



--
unsubscribe: android-porti...@googlegroups.com
website: http://groups.google.com/group/android-porting

supermaximus79

neskaityta,
2010-05-17 13:19:422010-05-17
kam: android-porting
I have found what the problem with!

DHCPCD calls script dhcp-run-hooks, which also calls 20-dns.conf
script.
20-dns.conf script set DNS property this way:

setprop dhcp.${interface}.dns${count} ${dnsaddr}

in my case it will be:
setprop dhcp.wlan0.dns1 77.120.130.20 - but this doesn't work in
Android 2.1 Eclair my version.

I don't know why, but works only setprop net.dns1 77.120.130.20.

Could you tell, is this happens only in my version of Android, or all
Eclair and later versions have the same bug?
Is it possible to fix it, to make command: setprop dhcp.wlan0.dns1
dnsaddr working?

Thanks

Robert Greenwalt

neskaityta,
2010-05-17 13:28:172010-05-17
kam: andrusc...@mail.ru, android-porting
the net.dns1 property is set by the ConnectivityService when it switches networks.  The WifiStateTracker is supposed to give the ConnectivityService a list of properties it uses to store dns values and then the CS will copy them when appropriate.

You should verify that your WifiStateTracker is telling connectivityservice your dhcp.wlan0.dns1, dns2, etc properties (see the WifiStateTracker constructor - it uses the system property "wifi.interface" to specify the interface name and constructs "dhcp.<iface>.dns1" for you).

Next you have to make sure that the ConnectivityService thinks wifi is the active network and is trying to copy your dns entries.  This should be obvious from the logs.

R

supermaximus79

neskaityta,
2010-05-17 15:56:452010-05-17
kam: android-porting
Thanks!

I verified in WifiStateTracker constructor interfaces names, here they
are:
DNS1 = dhcp.wlan0.dns1
DNS2 = dhcp.wlan0.dns2
Looks like everything is ok

But still there is empty DNS.
My logs:

init: starting
'wpa_supplicant'
D/WifiService( 1731): ACTION_BATTERY_CHANGED pluggedType:
1
E/WifiHW ( 1731): Unable to open connection to supplicant on "wlan0":
No such file or
directory
D/SettingsWifiEnabler( 1967): Received wifi state changed from
Enabling to
Enabled
I/wpa_supplicant( 2386): CTRL-EVENT-STATE-CHANGE id=-1
state=2
I/wpa_supplicant( 2386): CTRL-EVENT-SCAN-RESULTS
Ready
I/wpa_supplicant( 2386): CTRL-EVENT-SCAN-RESULTS
Ready
E/SettingsWifiLayer( 1967): Unable to scan for
networks
I/NotificationService( 1731): enqueueToast pkg=com.android.settings
callback=android.app.ITransientNotification$Stub$Proxy@438e6b28
duration=1
ioctl[SIOCSIWPRIV]: Operation not
permitted
E/wpa_supplicant( 2386): wpa_driver_priv_driver_cmd
failed
V/WifiStateTracker( 1731): Connection to supplicant established,
state=SCANNING
D/NetworkStateTracker( 1731): setDetailed state, old =DISCONNECTED and
new
state=SCANNING
D/ConnectivityService( 1731): ConnectivityChange for WIFI:
DISCONNECTED/
SCANNING
D/DataConnectionTracker( 1841): enableApnType(default),
isApnTypeActive = false and state =
IDLE
ioctl[SIOCSIWPRIV]: Operation not
permitted
E/wpa_supplicant( 2386): wpa_driver_priv_driver_cmd
failed
I/ActivityManager( 1731): Start proc android.process.media for
broadcast com.android.providers.downloads/.DownloadReceiver: pid=2389
uid=10010 gids={1006, 1015, 2001, 3003}
I/dalvikvm( 2389): Debugger thread not active, ignoring DDM send
(t=0x41504e4d
l=38)
I/dalvikvm( 2389): Debugger thread not active, ignoring DDM send
(t=0x41504e4d
l=46)
I/ActivityThread( 2389): Publishing provider drm:
com.android.providers.drm.DrmProvider
I/ActivityThread( 2389): Publishing provider media:
com.android.providers.media.MediaProvider
V/MediaProvider( 2389): Attached volume:
internal
I/ActivityThread( 2389): Publishing provider downloads:
com.android.providers.downloads.DownloadProvider
I/ActivityManager( 1731): Exiting empty application process
android.process.media
(android.os.BinderProxy@437fed50)
I/Process ( 1731): Sending signal. PID: 2389 SIG:
9
D/ActivityManager( 1731): Received spurious death notification for
thread
android.os.BinderProxy@437fed50
I/wpa_supplicant( 2386): CTRL-EVENT-SCAN-RESULTS
Ready
I/wpa_supplicant( 2386): CTRL-EVENT-SCAN-RESULTS
Ready
E/SettingsWifiLayer( 1967): Could not set highest priority on state
because saving config
failed.
I/wpa_supplicant( 2386): CTRL-EVENT-SCAN-RESULTS
Ready
I/wpa_supplicant( 2386): Trying to associate with 00:27:19:18:36:a2
(SSID='11g' freq=2437
MHz)
I/wpa_supplicant( 2386): CTRL-EVENT-STATE-CHANGE id=-1
state=3
I/wpa_supplicant( 2386): Association request to the driver
failed
V/WifiMonitor( 1731): Event [Trying to associate with
00:27:19:18:36:a2 (SSID='11g' freq=2437
MHz)]
V/WifiMonitor( 1731): Event [CTRL-EVENT-STATE-CHANGE id=-1
state=3]
V/WifiStateTracker( 1731): Changing supplicant state: SCANNING ==>
ASSOCIATING
D/NetworkStateTracker( 1731): setDetailed state, old =SCANNING and new
state=CONNECTING
D/ConnectivityService( 1731): ConnectivityChange for WIFI: CONNECTING/
CONNECTING
V/WifiMonitor( 1731): Event [Association request to the driver
failed]
D/dalvikvm( 1731): GC freed 13858 objects / 699376 bytes in
234ms
I/wpa_supplicant( 2386): CTRL-EVENT-STATE-CHANGE id=0
state=4
I/wpa_supplicant( 2386): Associated with
00:27:19:18:36:a2
I/wpa_supplicant( 2386): CTRL-EVENT-STATE-CHANGE id=0
state=7
I/wpa_supplicant( 2386): CTRL-EVENT-CONNECTED - Connection to
00:27:19:18:36:a2 completed (auth) [id=0
id_str=]
V/WifiMonitor( 1731): Event [CTRL-EVENT-STATE-CHANGE id=0
state=4]
V/WifiStateTracker( 1731): Changing supplicant state: ASSOCIATING ==>
ASSOCIATED
D/NetworkStateTracker( 1731): setDetailed state, old =CONNECTING and
new
state=CONNECTING
V/WifiMonitor( 1731): Event [Associated with
00:27:19:18:36:a2]
V/WifiMonitor( 1731): Event [CTRL-EVENT-STATE-CHANGE id=0
state=7]
V/WifiStateTracker( 1731): Changing supplicant state: ASSOCIATED ==>
COMPLETED
V/WifiMonitor( 1731): Event [CTRL-EVENT-CONNECTED - Connection to
00:27:19:18:36:a2 completed (auth) [id=0
id_str=]]
V/WifiStateTracker( 17init: starting
'dhcpcd'
31): New network state is
CONNECTED
D/NetworkStateTracker( 1731): setDetailed state, old =CONNECTING and
new
state=OBTAINING_IPADDR
D/WifiStateTracker( 1731): DhcpHandler: DHCP request
started
D/ConnectivityService( 1731): ConnectivityChange for WIFI: CONNECTING/
OBTAINING_IPADDR
D/SettingsWifiEnabler( 1967): Received network state changed to
NetworkInfo: type: WIFI[], state: CONNECTING/OBTAINING_IPADDR, reason:
(unspecified), extra: (none), roaming: falsee
wlan0: dhcpcd 4.0.1
starting
wlan0: hardware address =
00:21:e8:89:39:28
wlan0: executing `/system/etc/dhcpcd/dhcpcd-run-hooks', reason
PREINIT
wlan0: host does not support a monotonic clock - timing can
skew
wlan0: broadcasting for a
lease
wlan0: sending DHCP_DISCOVER with xid 0x8ad51535, next in 4.61
seconds
wlan0: offered 192.168.1.101 from 192.168.1.1
`ÿ'
wlan0: checking 192.168.1.101 is available on attached
networks
wlan0: sending ARP probe (1 of 3), next in 1.29
seconds
wlan0: sending ARP probe (2 of 3), next in 1.85
seconds
wlan0: sending ARP probe (3 of 3), next in 2.00
seconds
wlan0: sending DHCP_REQUEST with xid 0x8ad51535, next in 4.69
seconds
wlan0: acknowledged 192.168.1.101 from 192.168.1.1
`ÿ'
wlan0: leased 192.168.1.101 for 7200
seconds
wlan0: adding IP address
192.168.1.101/24
wlan0: adding route to 0.0.0.0/0 via
192.168.1.1
wlan0: executing `/system/etc/dhcpcd/dhcpcd-run-hooks', reason
BOUND
wlan0: forking to
background
init: waitpid returned pid 2395, status =
00000000
init: process 'dhcpcd', pid 2395
exited
V/WifiStateTracker( 1731): DhcpHandler: DHCP request succeeded
D/NetworkStateTracker( 1731): setDetailed state, old =OBTAINING_IPADDR
and new state=CONNECTED
V/WifiStateTracker( 1731): IP configuration: ipaddr 192.168.1.101
gateway 192.168.1.1 netmask 255.255.255.0 dns1 0.0.0.0 dns2 0.0.0.0
DHCP server 192.168.1.1 lease 7200 seconds
D/ConnectivityService( 1731): ConnectivityChange for WIFI: CONNECTED/
CONNECTED
V/NetworkStateTracker( 1731): Setting TCP values:
[4095,87380,110208,4096,16384,110208] which comes from
[net.tcp.buffersize.wifi]
E/NetworkStateTracker( 1731): Can't set tcp buffer
sizes:java.io.FileNotFoundException: /sys/kernel/ipv4/tcp_rmem_min



On May 17, 8:28 pm, Robert Greenwalt <rgreenw...@google.com> wrote:
> the net.dns1 property is set by the ConnectivityService when it switches
> networks.  The WifiStateTracker is supposed to give the ConnectivityService
> a list of properties it uses to store dns values and then the CS will copy
> them when appropriate.
>
> You should verify that your WifiStateTracker is telling connectivityservice
> your dhcp.wlan0.dns1, dns2, etc properties (see the WifiStateTracker
> constructor - it uses the system property "wifi.interface" to specify the
> interface name and constructs "dhcp.<iface>.dns1" for you).
>
> Next you have to make sure that the ConnectivityService thinks wifi is the
> active network and is trying to copy your dns entries.  This should be
> obvious from the logs.
>
> R
>
> > > unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsu...@googlegroups.com>
> > > website:http://groups.google.com/group/android-porting
>
> > --
> > unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsu...@googlegroups.com>

Robert Greenwalt

neskaityta,
2010-05-17 16:27:102010-05-17
kam: andrusc...@mail.ru, android-porting

Your WifiStateTracker reports:

V/WifiStateTracker( 1731): IP configuration: ipaddr 192.168.1.101
gateway 192.168.1.1 netmask 255.255.255.0 dns1 0.0.0.0 dns2 0.0.0.0
DHCP server 192.168.1.1 lease 7200 seconds

so the mDhcpInfo object seems to not know what's up regarding dns.  Can you include the system properties to your log (or use "adb bugreport > foo")?

R

supermaximus79

neskaityta,
2010-05-18 06:12:462010-05-18
kam: android-porting
Hello Robert!
Today i debugged 20-dns.conf script and found the problem.
It's a content of 20-dns.conf script, i included some debug messages:

set_dns_props()
{
echo "executing SET_DNS_PROPS"
case "${new_domain_name_servers}" in
"") return 0;;
esac

echo "AFTER 1"

count=1
for i in 1 2 3 4; do
setprop dhcp.${interface}.dns${i} ""
done

echo "AFTER 2"

count=1
for dnsaddr in ${new_domain_name_servers}; do
setprop dhcp.${interface}.dns${count} ${dnsaddr}
echo "MAXXXXXXX"
echo ${dnsaddr}
count=$(($count + 1))
done
}

I don't see message "AFTER 1", which means that variable
new_domain_name_servers = "" (Empty).
But i don't know why. Is dhcpcd fill this variable
new_domain_name_servers?

my system properties:
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=MASTER
ro.build.display.id=MASTER.eng.root.20100517.205514
ro.build.version.incremental=eng.root.20100517.205514
ro.build.version.sdk=5
ro.build.version.codename=AOSP
ro.build.version.release=AOSP
ro.build.date=Mon May 17 20:56:02 EEST 2010
ro.build.date.utc=1274118962
ro.build.type=user
ro.build.user=root
ro.build.host=haha
ro.build.tags=test-keys
ro.product.model=AOSP on Pegasus (US, RU)
ro.product.brand=pegasus
ro.product.name=pegasus
ro.product.device=pegasus
ro.product.board=
ro.product.cpu.abi=armeabi
ro.product.manufacturer=mgr
ro.product.locale.language=en
ro.product.locale.region=US
ro.wifi.channels=
ro.board.platform=pegasus
# ro.build.product is obsolete; use ro.product.device
ro.build.product=pegasus
# Do not try to parse ro.build.description or .fingerprint
ro.build.description=pegasus-user AOSP MASTER eng.root.20100517.205514
test-keys
ro.build.fingerprint=pegasus/pegasus/pegasus/:AOSP/MASTER/eng.root.
20100517.205514:user/test-keys
# end build properties
#
# system.prop for Pegasus
#

#rild.libpath=/system/lib/libhtc_ril.so
wifi.interface=wlan0
# Time between scans in seconds. Keep it high to minimize battery
drain.
# This only affects the case in which there are remembered access
points,
# but none are in range.
wifi.supplicant_scan_interval = 45

# density in DPI of the LCD of this board. This is used to scale the
UI
# appropriately. If this property is not defined, the default value is
160 dpi..
ro.sf.lcd_density = 128

# Default network type
# 0 => WCDMA Preferred.
#ro.telephony.default_network = 0

#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.config.notification_sound=OnTheHunt.ogg
ro.config.alarm_alert=Alarm_Classic.ogg
net.bt.name=Android
ro.config.sync=yes
dalvik.vm.stack-trace-file=/data/anr/traces.txt

On May 17, 11:27 pm, Robert Greenwalt <rgreenw...@google.com> wrote:
> Your WifiStateTracker reports:
>
> V/WifiStateTracker( 1731): IP configuration: ipaddr 192.168.1.101
> gateway 192.168.1.1 netmask 255.255.255.0 dns1 0.0.0.0 dns2 0.0.0.0
> DHCP server 192.168.1.1 lease 7200 seconds
>
> so the mDhcpInfo object seems to not know what's up regarding dns.  Can you
> include the system properties to your log (or use "adb bugreport > foo")?
>
> R
>
> ...
>
> read more »

supermaximus79

neskaityta,
2010-05-19 14:17:532010-05-19
kam: android-porting
Solved. The problem was because there wasn't dhcpcd.conf file on my
file system. i don't know why, but by default it is commented in
Android.mk

Robert Greenwalt

neskaityta,
2010-05-19 14:39:002010-05-19
kam: andrusc...@mail.ru, android-porting
weird - I checked my devices and it is of course present..  If you know the default build comments it out you could file a bug against it.

Sry about the hassle and congratulations on your progress!

R

supermaximus79

neskaityta,
2010-05-19 16:16:422010-05-19
kam: android-porting
Solution.

1) Open external/dhcpcd/Android.mk and uncomment next lines:

include $(CLEAR_VARS)
LOCAL_MODULE := dhcpcd.conf
LOCAL_MODULE_TAGS := user
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(etc_dir)
LOCAL_SRC_FILES := android.conf
include $(BUILD_PREBUILT)

by default they are commented.

2) frameworks/base/wifi/java/android/net/wifi/WifiStateTracker.java
and change:

mInterfaceName = SystemProperties.get("wifi.interface", "tiwlan0");

on your wifi interface. In my case it's wlan0:

mInterfaceName = SystemProperties.get("wifi.interface", "wlan0");

3) verify in init.rc or init.platform.rc dhcpcd service configuration.
In my case it is:

service dhcpcd /system/bin/dhcpcd -d wlan0
group system dhcp
disabled
oneshot

Verify that -d option is set before wifi interface name, otherwise
dhcpcd will not call dhcpcd-run-hooks script.

4) verify system.prop file, should me a line:
wifi.interface=your_wifi_interface

in my case it is:

wifi.interface=wlan0


That's it.

Good luck!

On May 19, 9:39 pm, Robert Greenwalt <rgreenw...@google.com> wrote:
> weird - I checked my devices and it is of course present..  If you know the
> default build comments it out you could file a bug against it.
>
> Sry about the hassle and congratulations on your progress!
>
> R
>

Robert Greenwalt

neskaityta,
2010-05-19 17:03:312010-05-19
kam: andrusc...@mail.ru, android-porting
On Wed, May 19, 2010 at 1:16 PM, supermaximus79 <andrusc...@mail.ru> wrote:
Solution.

1) Open external/dhcpcd/Android.mk and uncomment next lines:

include $(CLEAR_VARS)
LOCAL_MODULE := dhcpcd.conf
LOCAL_MODULE_TAGS := user
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(etc_dir)
LOCAL_SRC_FILES := android.conf
include $(BUILD_PREBUILT)

by default they are commented.

2) frameworks/base/wifi/java/android/net/wifi/WifiStateTracker.java
and change:

mInterfaceName = SystemProperties.get("wifi.interface", "tiwlan0");

on your wifi interface. In my case it's wlan0:

mInterfaceName = SystemProperties.get("wifi.interface", "wlan0");


You should instead set the system property "wifi.interface" to "wlan0.  The wlan0 in code is just a default in case you forget to set the sys property.  See #4 below.
Atsakyti visiems
Atsakyti autoriui
Persiųsti
0 naujų pranešimų