diff options
author | Nishant Chaprana <n.chaprana@samsung.com> | 2019-09-17 19:00:55 +0530 |
---|---|---|
committer | Nishant Chaprana <n.chaprana@samsung.com> | 2019-09-18 19:23:41 +0530 |
commit | 26cc90dfaf2ad149b702626f9552c81abbb26862 (patch) | |
tree | 2524c8994cf58358350fde67dfba5c3b8cb58f7d /src/config.c | |
parent | 9e3beb21876b6e63bd8acf53e751480d7a1cc16f (diff) | |
parent | 6b2381a2adabea7d8309ff158ef675ff88184305 (diff) | |
download | connman-26cc90dfaf2ad149b702626f9552c81abbb26862.tar.gz connman-26cc90dfaf2ad149b702626f9552c81abbb26862.tar.bz2 connman-26cc90dfaf2ad149b702626f9552c81abbb26862.zip |
Imported Upstream version 1.37submit/tizen/20190920.082459
Change-Id: Idb47c1ddbedc9f97181b8e9a5eeac04ddd832a2c
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/src/config.c b/src/config.c index d4ba0b37..ca5957d6 100644 --- a/src/config.c +++ b/src/config.c @@ -72,6 +72,7 @@ struct connman_config_service { char *ipv6_gateway; char *ipv6_privacy; char *mac; + bool mdns; char **nameservers; char **search_domains; char **timeservers; @@ -112,6 +113,7 @@ static bool cleanup = false; #define SERVICE_KEY_PASSPHRASE "Passphrase" #define SERVICE_KEY_SECURITY "Security" #define SERVICE_KEY_HIDDEN "Hidden" +#define SERVICE_KEY_MDNS "mDNS" #define SERVICE_KEY_IPv4 "IPv4" #define SERVICE_KEY_IPv6 "IPv6" @@ -152,6 +154,7 @@ static const char *service_possible_keys[] = { SERVICE_KEY_IPv6, SERVICE_KEY_IPv6_PRIVACY, SERVICE_KEY_MAC, + SERVICE_KEY_MDNS, SERVICE_KEY_NAMESERVERS, SERVICE_KEY_SEARCH_DOMAINS, SERVICE_KEY_TIMESERVERS, @@ -193,7 +196,7 @@ static void unregister_service(gpointer data) list = list->next) { service_id = list->data; - service = __connman_service_lookup_from_ident(service_id); + service = connman_service_lookup_from_identifier(service_id); if (service) { __connman_service_set_immutable(service, false); __connman_service_set_config(service, NULL, NULL); @@ -514,6 +517,9 @@ static bool load_service_generic(GKeyFile *keyfile, g_strfreev(strlist); } + service->mdns = __connman_config_get_bool(keyfile, group, + SERVICE_KEY_MDNS, NULL); + return true; err: @@ -564,8 +570,8 @@ static bool load_service(GKeyFile *keyfile, const char *group, g_free(service->type); service->type = str; } else { - DBG("Type of the configured service is missing for group %s", - group); + connman_warn("Type of the configured service is missing " + "for group %s", group); goto err; } @@ -759,14 +765,14 @@ static bool load_service(GKeyFile *keyfile, const char *group, service->security = CONNMAN_SERVICE_SECURITY_PSK; } else if (str) { - if (security != CONNMAN_SERVICE_SECURITY_NONE) { + if (security != CONNMAN_SERVICE_SECURITY_NONE) connman_info("Mismatch no security and " "setting %s = %s", SERVICE_KEY_SECURITY, str); - } - service->security = CONNMAN_SERVICE_SECURITY_NONE; + + service->security = CONNMAN_SERVICE_SECURITY_NONE; } else - service->security = CONNMAN_SERVICE_SECURITY_NONE; + service->security = CONNMAN_SERVICE_SECURITY_NONE; g_free(str); @@ -806,8 +812,11 @@ static bool load_service_from_keyfile(GKeyFile *keyfile, groups = g_key_file_get_groups(keyfile, NULL); for (i = 0; groups[i]; i++) { - if (!g_str_has_prefix(groups[i], "service_")) + if (!g_str_has_prefix(groups[i], "service_")) { + connman_warn("Ignore group named '%s' because prefix " + "is not 'service_'", groups[i]); continue; + } if (load_service(keyfile, groups[i], config)) found = true; } @@ -1211,6 +1220,7 @@ static int try_provision_service(struct connman_config_service *config, enum connman_service_type type; const void *ssid; unsigned int ssid_len; + const char *str; network = __connman_service_get_network(service); if (!network) { @@ -1230,10 +1240,8 @@ 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; - } + if (!ssid) + return -ENOENT; if (!config->ssid || ssid_len != config->ssid_len) return -ENOENT; @@ -1241,6 +1249,10 @@ static int try_provision_service(struct connman_config_service *config, if (memcmp(config->ssid, ssid, ssid_len)) return -ENOENT; + str = connman_network_get_string(network, "WiFi.Security"); + if (config->security != __connman_service_string2security(str)) + return -ENOENT; + break; case CONNMAN_SERVICE_TYPE_ETHERNET: @@ -1266,7 +1278,7 @@ static int try_provision_service(struct connman_config_service *config, } DBG("service %p ident %s", service, - __connman_service_get_ident(service)); + connman_service_get_identifier(service)); if (config->mac) { struct connman_device *device; @@ -1387,7 +1399,7 @@ ipv4_out: #endif __connman_service_disconnect(service); - service_id = __connman_service_get_ident(service); + service_id = connman_service_get_identifier(service); config->service_identifiers = g_slist_prepend(config->service_identifiers, g_strdup(service_id)); @@ -1426,6 +1438,8 @@ ipv4_out: __connman_service_set_search_domains(service, config->search_domains); + __connman_service_set_mdns(service, config->mdns); + if (config->timeservers) __connman_service_set_timeservers(service, config->timeservers); @@ -1752,7 +1766,6 @@ void connman_config_free_entries(struct connman_config_entry **entries) } g_free(entries); - return; } bool __connman_config_address_provisioned(const char *address, |