FWIW and FYI, I am currently debugging an issue in which connman gets into an
inconsistent state with respect to technologies and devices. When there are
local connectivity problems, my application--for good or bad--periodically
attempts to bring down and back up the network interface by executing the
following connman .Manager methods:
# Local network trouble...
# Wait...
net.connman.Manager.DisableTechnology string:"<technology>"
# Wait...
net.connman.manager.EnableTechnology string:"<technology>"
net.connman.manager.ConnectService
# Local network connection recovered...
However, at times this results in a state in which the device and interface are
DOWN yet connman believes the technology to be active and enabled:
# dbus-send --system --dest=net.connman --print-reply /
net.connman.Manager.EnableTechnology string:"wifi"
Error net.connman.Error.AlreadyEnabled: Already enabled
# grep -r 'Powered' /var/lib/connman
/var/lib/connman/default.profile:Powered=false
While I haven't yet caught why connman gets into this state, with the debugger,
I can make a single variable change in which connman gets its state normalized
again, the device and interface come up and all is good again:
(gdb) where
#0 __connman_notifier_is_enabled (type=<value optimized out>)
at connman-0.71/src/notifier.c:464
#1 0x00023f00 in enable_technology (conn=<value optimized
out>, msg=0x6ac30,
data=<value optimized out>)
at connman-0.71/src/manager.c:325
#2 0x00013014 in process_message (connection=0x5c5c0,
message=0x4b858,
method=0x5b084, iface_user_data=<value optimized out>)
at connman-0.71/gdbus/object.c:224
The CONNMAN_SERVICE_TYPE_WIFI type is registered:
454 if (g_atomic_int_get(®istered[type]) > 0)
(gdb) print registered
$13 = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0}
The CONNMAN_SERVICE_TYPE_WIFI type is truly enabled as far as
__connman_notifier_is_enabled is concerned:
467 if (g_atomic_int_get(&enabled[type]) > 0)
(gdb) print enabled
$14 = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0}
If I force, in GDB, enabled[CONNMAN_SERVICE_TYPE_WIFI] to '0', then the
next EnableTechnology request
succeeds, the link comes up, the device and interface state are good
and an association ensues:
(gdb) set enabled[CONNMAN_SERVICE_TYPE_WIFI]=0
(gdb) print enabled
$15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
(gdb) cont
Continuing.
ADDRCONF(NETDEV_UP): wlan0: link is not ready
...
ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
# grep -r 'Powered' /var/lib/connman
/var/lib/connman/default.profile:Powered=true
Interactive debugging aside, the only other way to get out of this state is to
restart the system or connman, in particular.
Has anyone else run into this state yet?
>From what I can see of the overall function trace flow for
>net.connman.Manager.{Disable,Enable}Technology, writing "Powered=<state>"
>early in the method handling could lead to a state in which the persistent and
>internal states disagree:
enable_technology
src/manager.c:294
|- __connman_notifier_is_registered
src/notifier.c:447
| |- technology_supported
src/notifier.c:427
| '- g_atomic_int_get(®istered[type])
|
|- __connman_notifier_is_enabled
src/notifier.c:460
| |- technology_supported
src/notifier.c:427
| '- g_atomic_int_get(&enabled[type]) # Prematurely bail out
here even though
| # Powered=false and the
device and
| # interface are down.
|
'- __connman_element_enable_technology
src/element.c:356
'- enable_technology
src/element.c:316
'- __connman_device_enable_persistent
src/element.c:349
|- __connman_storage_save_device
src/storage.c:291
| '- device_save
src/device.c:1326
| |- __connman_storage_open_profile("default")
src/storage.c:151
| |- g_strdup_printf
| |- g_key_file_set_boolean("Powered", <state>)
| |- g_key_file_set_integer("ScanInterval")
| '- __connman_storage_close_profile("default",
TRUE) src/storage.c:156
|
|- __connman_device_enable
| |- connman_device_set_disconnected(FALSE)
| |- wifi_enable
plugins/wifi.c:214
| | '- g_supplicant_interface_create
gsupplicant/supplicant.c:2243
| | '- supplicant_dbus_method_call
gsupplicant/dbus.c:393
| |
| |- __connman_profile_get_offlinemode
| |- __connman_profile_set_offlinemode(FALSE, FALSE)
| | |- offlinemode_changed
| | '- __connman_device_set_offlinemode
| | '- set_offlinemode
| | '- set_powered
| | '- __connman_device_enable
| | |- ...
| | .
| | .
| | .
| |
| '- __connman_technology_enable
| |- technology_find
| |- g_atomic_int_get(&technology->blocked)
| |- __connman_notifier_enable
src/notifier.c:263
| | |-
g_atomic_int_exchange_and_add(&enabled[type], 1)
| | '- technology_enabled(TRUE)
| | |- __connman_notifier_list_enabled
| | '- technology_notify
src/manager.c:279
| | '- technology_reply(0)
| |
| '-
g_atomic_int_exchange_and_add(&technology->enabled, 1)
|
|- __connman_profile_get_offlinemode
|- __connman_profile_set_offlinemode
'- __connman_profile_save_default
src/profile.c:119
'- __connman_storage_save_profile(default_profile)
src/storage.c:219
'- profile_save
src/profile.c:541
|-
__connman_storage_open_profile("default") src/storage.c:151
|- g_key_file_set_string("global",
"Name")
|- g_key_file_set_boolean("global",
"OfflineMode")
'-
__connman_storage_close_profile("default", TRUE) src/storage.c:156
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman