Hi Slava,

Ah, That's another bug then!
If we detect that we got disconnected, the wifi plugins will need to
cleanup.
Actually, it cleanups if the user disconnects, but not this way round.
Check interface_state() in wifi_plugins. This will need a separate patch.
Well, it actually kind of works. When wifi signal is lost, wifi plugin
does some sort of cleanup like this:

#1  0x0003d8cc in free_network () at src/device.c:378
#2  0x4031b1e8 in g_hash_table_remove_node () at ghash.c:448
#3  0x4031b9d4 in g_hash_table_remove_internal () at ghash.c:1276
#4  0x0003ea20 in connman_device_remove_network () at src/device.c:905
#5  0x000201c4 in network_removed () at plugins/wifi.c:2064
#6  0x0002388c in callback_network_removed () at
gsupplicant/supplicant.c:445
#7  remove_network () at gsupplicant/supplicant.c:523

Ok, yes is removes the gsupplicant's network entity, but does not remove the
wpa_supplicant's side of it, if it has been added there. And that happens only
when the ssid cannot be found from scan result. I'll check, but I am sure we
are missing a cleanup at the point where we get disconnected in interface_state().

(actually, and that's a kind of design mistake, gsupplicant's network entity does
not know anything about itself being added or not in wpa_supplicant... only
interface knows)

There are some corner cases that I have been unable to catch so far,
which result in connman_service holding a reference to connman_network
in connecting/associating state (albeit with driver pointer being NULL)
but those are quite rare. That sort of things happens once in a new
weeks of normal usage (which involves periodic switching between mobile
data and various wifi networks) but once it does happen, connman is
unable to recover and needs to be restarted. That's quite annoying for
the end-users of the device.

Yup, looks like a critical bug. If by chance you get the connman logs of such
issue, it will be welcomed.

But normally things get cleaned up all right, except that wpa_supplicant
configuration doesn't get removed, which is the problem that I addressed
in this patch.

Since I'm not the one who designed this thing, I prefer small fixes that
don't affect the overall architecture which at times is pretty hard to
grasp. If you are not happy with this approach, you are quite welcome to
fix it "the right way".

gsupplicant/wifi plugins is indeed probably the most complicated part, and for a "good"
reason: have a look at wpa_supplicant DBus API ;(  plus some design issues
(maybe the gsupplicant's network part could have been avoided at least.

The thing is: you patch at this stage is not going to make it upstream. Up to you.

Tomasz
_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to