Hi Slava,

It appears that the client is responsible for removing network
configurations it has created, which makes sense to me. In an
environment with unstable wifi reception, connman may end up creating
hundreds of those in just one day of normal usage.
Well this is true if it always fail connecting to hundreds different
networks yes (and only at SelectNetwork).
That's the only possibility. So indeed there is a bug, but unlikely
to happen.

Try this: connect to wifi, walk out of the wifi range, wait for connman
to realize that, return back into the range, wait for connman to
re-connect and compare 'wpa_cli list_net' before and after the exercise.
What do you get?

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.

Your patch is fine but it is not removing the network at the right
place then.
You should do it in interface_select_network_result() if that one
returns an error.
So the network is removed as soon as possible.

"As soon as possible" is where I put it. By the time it gets to
interface_select_network_result() the previous path is lost.

In the context I was thinking, the SelectNetwork that fails, this is the place to go. If you handle this non-user disconnection properly, there will be no need to run
anything in interface_add_network_result().

Actually, gsupplicant should not run AddNetwork if interface->network_path is a valid pointer. If this pointer is already set, it means we are doing something wrong
elsewhere, which we are obviously.



I don't think there is any other case matching this situation: when we
disconnect,
we remove the network. If AddNetwork fails, no need to remove anything.
I think it should be fine then.

Also, try reusing existing code: network_remove() does what you want
already.
network_remove() requires allocation of another interface_data which in
this case was unnecessary and would require writing more code than I
wanted to.

That's true. Now that might be an occasion to factorize the code: make network_remove() generic so it would allocate or not some data (for instance if there is a callback/user data, then allocate. If not: NULL). As you want, but that could avoid duplicate routines.

Just looked at the code, network_remove(GSupplicantInterface *interface, struct interface_data *data); could be the solution. Use the interface pointer (not the one that might be in data). If data is valid, use that one to add the path parameter, if not use your function objpath_params() which you could
rename as network_remove_append_objpath() for instance.

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

Reply via email to