On Apr 29, 2011, at 9:51 AM, Grant Erickson wrote:
> I am investigating all sort of odd state issues with connman and my user 
> interface / application and the latest oddity is that when I issue:
> 
>       net.connman.Service.Disconnect
> 
> and then:
> 
>       net.connman.Manager.SetProperty OfflineMode 1
> 
> I end up in a state in which no services are connected, yet connman still 
> reports that State=online and ConnectedTechnologies = [ wifi ], despite the 
> fact that there are no connected services or technologies. Is this normal, 
> expected, as-designed behavior?

I've done some additional instrumentation and debugging of this and the 
high-level cause is that on connection to a service, __connman_notifier_connect 
is called twice whereas on the service disconnect path, 
__connman_notifier_disconnect is called only once, leading to the 
__connman_notifier_count_connected inconsistency.

I've not fully narrowed in to the root cause for this; however, 
__connman_service_indicate_state seems to be called twice with new_state 4 
(ready) and type 1 (IPv4), leading to the two calls to 
__connman_notifier_connect. The state transitions, incorrectly (?), seem to be:

        association -> configuration -> ready -> online -> ready

It seems to me that __connman_notifier_connect should only be called for the 
ONLINE state, not the READY state. What's the design philosophy for calling it 
from the READY state or is that a defect?

Trace illustrating this issue:

### Start-up connman...

# ./connmand -W wext -n &
connmand[271]: Connection Manager version 0.71
connmand[271]: Checking loopback interface settings
connmand[271]: System hostname is fish.local
connmand[271]: System domainname is domain.actdsltmp
connmand[271]: Adding NTP server pool.ntp.org
connmand[271]: Adding profile default
connmand[271]: Failed to open RFKILL control device
connmand[271]: lo {newlink} index 1 operstate 0 <UNKNOWN>
connmand[271]: wlan0 {create} index 2 type 1 <ETHER>
connmand[271]: wlan0 {RX} 1044 packets 1435369 bytes
connmand[271]: wlan0 {TX} 267 packets 28056 bytes
connmand[271]: wlan0 {update} flags 4099 <UP>
connmand[271]: wlan0 {newlink} index 2 address 00:0c:29:4c:56:a2 mtu 1500
connmand[271]: wlan0 {newlink} index 2 operstate 2 <DOWN>
connmand[271]: Create interface wlan0 [ wifi ]
connmand[271]: --> (0) __connman_service_create_from_network: network 0x75dc0 
000c294c56a2
connmand[271]:     --> (1) setup_ip4config: service 0x74670 
wifi_000c294c56a2_53706f74_managed_psk index 2
connmand[271]:         --> (2) connman_ipconfig_create: index 2 type 1
connmand[271]:         <-- (2) connman_ipconfig_create: 
connmand[271]:     <-- (1) setup_ip4config: 
connmand[271]:     --> (1) connman_ipconfig_create: index 2 type 2
connmand[271]:     <-- (1) connman_ipconfig_create: 
connmand[271]: <-- (0) __connman_service_create_from_network: 
connmand[271]: mmap error Invalid argument for 
/var/lib/connman/stats/wifi_000c294c56a2_53706f74_managed_psk.data
connmand[271]: 
/var/lib/connman/stats/wifi_000c294c56a2_53706f74_managed_psk.data might be on 
a file system, such as JFFS2, that does not allow shared writable mappings.
connmand[271]: wlan0 up
connmand[271]: wlan0 lower down
connmand[271]: wlan0 up
connmand[271]: wlan0 lower down
connmand[271]: Skipping disconnect of 53706f74_managed_psk, network is 
connecting.
connmand[271]: Requesting connection to network "Spot" identifier 
"53706f74_managed_psk".
connmand[271]: --> (0) __connman_service_indicate_state: service 0x74670 
wifi_000c294c56a2_53706f74_managed_psk new_state 2 (association) type 1 (IPv4)
connmand[271]: service 0x74670 state idle/idle => idle new association/1 => 
association
connmand[271]: <-- (0) __connman_service_indicate_state: OK: 2
connmand[271]: wlan0 {add} route ff00:: gw :: scope 0 <UNIVERSE>
connmand[271]: wlan0 {add} route fe80:: gw :: scope 0 <UNIVERSE>
connmand[271]: wlan0 {update} flags 69635 <UP,LOWER_UP>
connmand[271]: wlan0 {newlink} index 2 address 00:0c:29:4c:56:a2 mtu 1500
connmand[271]: wlan0 {RX} 1044 packets 1435369 bytes
connmand[271]: wlan0 {TX} 267 packets 28056 bytes
connmand[271]: wlan0 {newlink} index 2 address 00:0c:29:4c:56:a2 mtu 1500
connmand[271]: wlan0 {newlink} index 2 operstate 5 <DORMANT>
connmand[271]: wlan0 {RX} 1046 packets 1435647 bytes
connmand[271]: wlan0 {TX} 271 packets 28472 bytes
connmand[271]: wlan0 {update} flags 69699 <UP,RUNNING,LOWER_UP>
connmand[271]: wlan0 lower up
connmand[271]: wlan0 lower up
connmand[271]: wlan0 {newlink} index 2 address 00:0c:29:4c:56:a2 mtu 1500
connmand[271]: wlan0 {newlink} index 2 operstate 6 <UP>
connmand[271]: --> (0) set_connected: service 0x74670
connmand[271]:     network connected 1
connmand[271]:     --> (1) __connman_service_indicate_state: service 0x74670 
wifi_000c294c56a2_53706f74_managed_psk new_state 3 (configuration) type 1 (IPv4)
connmand[271]: service 0x74670 state association/idle => association new 
configuration/1 => configuration
connmand[271]: mmap error Invalid argument for 
/var/lib/connman/stats/wifi_000c294c56a2_53706f74_managed_psk.data
connmand[271]: 
/var/lib/connman/stats/wifi_000c294c56a2_53706f74_managed_psk.data might be on 
a file system, such as JFFS2, that does not allow shared writable mappings.
connmand[271]:     <-- (1) __connman_service_indicate_state: OK: 2
connmand[271]: <-- (0) set_connected: 
connmand[271]: --> (0) lease_available_cb: 
connmand[271]: Lease available
connmand[271]: DHCP lease available for service 
wifi_000c294c56a2_53706f74_managed_psk
connmand[271]: c_address: (null)
connmand[271]: c_gateway: (null)
connmand[271]: c_prefixlen: 0
connmand[271]: new address: 10.2.0.144
connmand[271]: new gateway: 10.2.0.1
connmand[271]: new prefixlen: 16
connmand[271]: ip_change: 1
connmand[271]:     --> (1) __connman_ipconfig_set_gateway: ipconfig 0x6d5e8 
gateway 10.2.0.1
connmand[271]: ipconfig->address 0x74cf8
connmand[271]:     <-- (1) __connman_ipconfig_set_gateway: 
connmand[271]: Setting domainname to domain.actdsltmp
connmand[271]:     --> (1) connman_inet_set_address: index 2 local 10.2.0.144 
prefix_len 16
connmand[271]:         --> (2) __connman_inet_modify_address: cmd 14 flags 104 
index 2 family 2 address 10.2.0.144 peer (null) prefixlen 16 broadcast (null)
connmand[271]:         <-- (2) __connman_inet_modify_address: 
connmand[271]:     <-- (1) connman_inet_set_address: 
connmand[271]: Deleting host route failed (No such process)
connmand[271]:     --> (1) __connman_service_indicate_state: service 0x74670 
wifi_000c294c56a2_53706f74_managed_psk new_state 4 (ready) type 1 (IPv4)
connmand[271]: service 0x74670 state configuration/idle => configuration new 
ready/1 => ready
connmand[271]: Adding DNS server 10.2.0.1
connmand[271]:         --> (2) __connman_notifier_connect: type 3 (wifi)
connmand[271]:             before &connected[wifi] 0
connmand[271]:             --> (3) technology_connected: type 3 (wifi) 
connected 1
connmand[271]:                 --> (4) state_changed: count 1
connmand[271]:                 <-- (4) state_changed: 
connmand[271]:             <-- (3) technology_connected: 
connmand[271]:             after &connected[wifi] 1
connmand[271]:         <-- (2) __connman_notifier_connect: 
connmand[271]: Enabling DNS server 10.2.0.1
connmand[271]:     <-- (1) __connman_service_indicate_state: OK: 2
connmand[271]: Enabling DNS server 10.2.0.1
connmand[271]:     --> (1) __connman_service_indicate_state: service 0x74670 
wifi_000c294c56a2_53706f74_managed_psk new_state 5 (online) type 1 (IPv4)
connmand[271]: service 0x74670 state ready/idle => ready new online/1 => online
connmand[271]: Resolving NTP peer pool.ntp.org
connmand[271]: Enabling DNS server 10.2.0.1
connmand[271]:     <-- (1) __connman_service_indicate_state: OK: 2
connmand[271]:     --> (1) __connman_service_indicate_state: service 0x74670 
wifi_000c294c56a2_53706f74_managed_psk new_state 4 (ready) type 1 (IPv4)
connmand[271]: service 0x74670 state online/idle => online new ready/1 => ready
connmand[271]: Removing DNS server 10.2.0.1
connmand[271]: Adding DNS server 10.2.0.1
connmand[271]:         --> (2) __connman_notifier_connect: type 3 (wifi)
connmand[271]:             before &connected[wifi] 1
connmand[271]:             after &connected[wifi] 2
connmand[271]:         <-- (2) __connman_notifier_connect: 
connmand[271]: Enabling DNS server 10.2.0.1
connmand[271]:     <-- (1) __connman_service_indicate_state: OK: 2
connmand[271]: <-- (0) lease_available_cb: 
connmand[271]: wlan0 {add} address 10.2.0.144/16 label wlan0 family 2
connmand[271]: wlan0 ip bound
connmand[271]: --> (0) __connman_ipconfig_append_ipv4: ipconfig 0x6d5e8
connmand[271]: ipconfig->system 0x76ad8
connmand[271]: ipconfig->system->local 0x70898
connmand[271]: ipconfig->system->gateway (nil)
connmand[271]: <-- (0) __connman_ipconfig_append_ipv4: 
connmand[271]: wlan0 ip bound
connmand[271]: --> (0) __connman_ipconfig_append_ipv4: ipconfig 0x6d5e8
connmand[271]: ipconfig->system 0x76ad8
connmand[271]: ipconfig->system->local 0x70898
connmand[271]: ipconfig->system->gateway (nil)
connmand[271]: <-- (0) __connman_ipconfig_append_ipv4: 
connmand[271]: wlan0 {add} route 10.2.0.0 gw 0.0.0.0 scope 253 <LINK>
connmand[271]: wlan0 {add} route 10.2.0.1 gw 0.0.0.0 scope 253 <LINK>
connmand[271]: wlan0 {del} route fe80:: gw :: scope 0 <UNIVERSE>
connmand[271]: wlan0 {del} route ff00:: gw :: scope 0 <UNIVERSE>
connmand[271]: wlan0 ip bound
connmand[271]: --> (0) __connman_ipconfig_append_ipv4: ipconfig 0x6d5e8
connmand[271]: ipconfig->system 0x76ad8
connmand[271]: ipconfig->system->local 0x70898
connmand[271]: ipconfig->system->gateway 0x6e3e0
connmand[271]: <-- (0) __connman_ipconfig_append_ipv4: 
connmand[271]: wlan0 ip bound
connmand[271]: --> (0) __connman_ipconfig_append_ipv4: ipconfig 0x6d5e8
connmand[271]: ipconfig->system 0x76ad8
connmand[271]: ipconfig->system->local 0x70898
connmand[271]: ipconfig->system->gateway 0x6e3e0
connmand[271]: <-- (0) __connman_ipconfig_append_ipv4: 
connmand[271]: wlan0 {add} route 0.0.0.0 gw 10.2.0.1 scope 0 <UNIVERSE>

### Now disconnect from the service.

# dbus-send --system --dest=net.connman --print-reply 
/profile/default/wifi_000c294c56a2_53706f74_managed_psk net.connman.Servic
e.Disconnect
connmand[271]: --> (0) disconnect_service: service 0x74670 identifier 
wifi_000c294c56a2_53706f74_managed_psk type 3 (wifi)
connmand[271]:     --> (1) __connman_service_disconnect: service 0x74670
connmand[271]:         --> (2) __connman_network_disconnect: network 0x75dc0
connmand[271]: Requesting disconnection from network "Spot" identifier 
"53706f74_managed_psk".
connmand[271]:             --> (3) set_connected: service 0x74670
connmand[271]: network connected 0
connmand[271]: service 0x74670
connmand[271]:                 --> (4) __connman_service_indicate_state: 
service 0x74670 wifi_000c294c56a2_53706f74_managed_psk new_state 6 (disconnect) 
type 1 (IPv4)
connmand[271]: service 0x74670 state ready/idle => ready new disconnect/1 => 
disconnect
connmand[271]: Disabling DNS server 10.2.0.1
connmand[271]: Removing DNS server 10.2.0.1
connmand[271]:                     --> (5) __connman_notifier_disconnect: type 
3 (wifi)
connmand[271]: before &connected[wifi] 2
connmand[271]: after &connected[wifi] 1
connmand[271]:                     <-- (5) __connman_notifier_disconnect: 
connmand[271]:                 <-- (4) __connman_service_indicate_state: OK: 2
connmand[271]:                 --> (4) __connman_service_indicate_state: 
service 0x74670 wifi_000c294c56a2_53706f74_managed_psk new_state 6 (disconnect) 
type 2 (IPv6)
connmand[271]: service 0x74670 state disconnect/idle => disconnect new 
disconnect/2 => disconnect
connmand[271]:                 <-- (4) __connman_service_indicate_state: 
EALREADY: 3
connmand[271]: Deleting host route failed (No such process)
connmand[271]: Deleting host route failed (No such process)
connmand[271]:                 --> (4) __connman_service_indicate_state: 
service 0x74670 wifi_000c294c56a2_53706f74_managed_psk new_state 1 (idle) type 
1 (IPv4)
connmand[271]: service 0x74670 state disconnect/disconnect => disconnect new 
idle/1 => disconnect
connmand[271]:                 <-- (4) __connman_service_indicate_state: 
EALREADY: 3
connmand[271]:                 --> (4) __connman_service_indicate_state: 
service 0x74670 wifi_000c294c56a2_53706f74_managed_psk new_state 1 (idle) type 
2 (IPv6)
connmand[271]: service 0x74670 state idle/disconnect => disconnect new idle/2 
=> idle
connmand[271]:                     --> (5) __connman_element_request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                             --> (7) __connman_device_scan: 
interface wlan0
connmand[271]: Requested scan for device wifi interface wlan0.
connmand[271]:                             <-- (7) __connman_device_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                         --> (6) request_scan: 
connmand[271]:                         <-- (6) request_scan: 
connmand[271]:                     <-- (5) __connman_element_request_scan: 
connmand[271]:                 <-- (4) __connman_service_indicate_state: OK: 2
connmand[271]:             <-- (3) set_connected: 
connmand[271]:             --> (3) set_connected: service 0x74670
connmand[271]:                 network connected 0
connmand[271]:                 service 0x74670
connmand[271]:                 --> (4) __connman_service_indicate_state: 
service 0x74670 wifi_000c294c56a2_53706f74_managed_psk new_state 6 (disconnect) 
type 1 (IPv4)
connmand[271]: service 0x74670 state idle/idle => idle new disconnect/1 => 
disconnect
connmand[271]:                 <-- (4) __connman_service_indicate_state: 
EINVAL: 4
connmand[271]:                 --> (4) __connman_service_indicate_state: 
service 0x74670 wifi_000c294c56a2_53706f74_managed_psk new_state 6 (disconnect) 
type 2 (IPv6)
connmand[271]: service 0x74670 state idle/idle => idle new disconnect/2 => 
disconnect
connmand[271]:                 <-- (4) __connman_service_indicate_state: 
EINVAL: 4
connmand[271]: Deleting host route failed (No such process)
connmand[271]:                 --> (4) __connman_service_indicate_state: 
service 0x74670 wifi_000c294c56a2_53706f74_managed_psk new_state 1 (idle) type 
1 (IPv4)
connmand[271]:                 <-- (4) __connman_service_indicate_state: 
EALREADY: 1
connmand[271]:                 --> (4) __connman_service_indicate_state: 
service 0x74670 wifi_000c294c56a2_53706f74_managed_psk new_state 1 (idle) type 
2 (IPv6)
connmand[271]:                 <-- (4) __connman_service_indicate_state: 
EALREADY: 2
connmand[271]:             <-- (3) set_connected: 
connmand[271]:         <-- (2) __connman_network_disconnect: err 0
connmand[271]:         --> (2) __connman_inet_modify_address: cmd 15 flags 0 
index 2 family 2 address 10.2.0.144 peer (null) prefixlen 16 broadcast (null)
connmand[271]:         <-- (2) __connman_inet_modify_address: 
connmand[271]:     <-- (1) __connman_service_disconnect: 
connmand[271]: __connman_notifier_count_connected() 1
connmand[271]: assertion: service: __connman_notifier_count_connected() == 0,  
file: connman-0.71/src/service.c, line: 2805
connmand[271]: <-- (0) disconnect_service: 
method return sender=:1.5 -> dest=:1.6 reply_serial=2
connmand[271]: wlan0 {RX} 1082 packets 1438704 bytes
connmand[271]: wlan0 {TX} 324 packets 36083 bytes
connmand[271]: wlan0 {update} flags 4099 <UP>
connmand[271]: wlan0 {newlink} index 2 address 00:0c:29:4c:56:a2 mtu 1500
connmand[271]: wlan0 {newlink} index 2 operstate 2 <DOWN>
connmand[271]: wlan0 {update} flags 4163 <UP,RUNNING>
connmand[271]: wlan0 {del} route 10.2.0.1 gw 0.0.0.0 scope 253 <LINK>
connmand[271]: wlan0 {del} route 0.0.0.0 gw 10.2.0.1 scope 0 <UNIVERSE>
connmand[271]: wlan0 {del} address 10.2.0.144/16 label wlan0
connmand[271]: wlan0 {del} route 10.2.0.0 gw 0.0.0.0 scope 253 <LINK>
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to