Hi Vasyl,
On 28.02.2018 23:40, Vasyl Vavrychuk wrote:
Hi, Daniel,
I appears that my change is breaking one. I have two hidden networks
in range and one (WEP one) survives this change but other (PSK)
disappear after my change from `>services` in commanctl.
I will investigate why...
Yeah, this hidden networks stuff is terrible nasty and needs to die.
Until then we have to cope with it.
On Wed, Feb 28, 2018 at 9:37 AM, Daniel Wagner <wagi(a)monom.org>
wrote:
> What about introducing a helper function which says, the SSID we have is a
> valig, something like this
>
> bool ssid_is_valid(const unsigned char *ssid, unsigned int ssid_len)
> {
> /* empty ssid, that is "" */
> if (ssid_len == 0 && !ssid && ssid[0] == '\0')
> return true;
>
> if (ssid_len > 0)
> return true;
>
> return false;
> }
>
> and use it everyhwere we need. Open coding seems like a bad idea.
From one side I like this function but from other side it bothers me
if we can do ssid[0] when ssid_len==0. And also I am not sure how this
function can help us. And also it needs many changes in existing code.
The idea is to annotate the places which try to figure out if the SSID
is valid or not. So this is in the first step only a refactoring step.
I suggest go one of two ways. I prefer first if you are okay.
1. Simply remove noisy warning
--- a/src/config.c
+++ b/src/config.c
@@ -1219,8 +1219,7 @@ static int try_provision_service(struct
connman_config_service *config,
ssid = connman_network_get_blob(network, "WiFi.SSID",
&ssid_len);
if (!ssid) {
- connman_error("Network SSID not set");
- return -EINVAL;> + return -ENOENT;
There is only one user of this function and it just checks if the return
value is != 0:
static int
find_and_provision_service_from_config(struct connman_service *service,
struct connman_config *config)
{
GHashTableIter iter;
gpointer value, key;
g_hash_table_iter_init(&iter, config->service_table);
while (g_hash_table_iter_next(&iter, &key,
&value)) {
if (!try_provision_service(value, service))
return 0;
}
return -ENOENT;
}
What's the point to change this line then?
}
if (!config->ssid || ssid_len != config->ssid_len)
2. Keep track of ssid_valid field over the code
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -225,6 +225,7 @@ struct _GSupplicantNetwork {
char *name;
unsigned char ssid[32];
unsigned int ssid_len;
+ bool ssid_valid;
Yes, that makes sense and is a variation of the ssid_is_valid(). Don't
worry, I don't fear some code changes :)
Thanks,
Daniel