+ config->ip_info->ip_type = g_key_file_get_string(keyfile, group_name,
+ WIFI_CONFIG_IPV4_METHOD, NULL);
+ if (config->ip_info->ip_type)
+ DBG("IPv4.Method:%s", config->ip_info->ip_type);
+
+ config->ip_info->ip_address = g_key_file_get_string(keyfile, group_name,
+ WIFI_CONFIG_IPV4_ADDRESS, NULL);
+ if (config->ip_info->ip_address)
+ DBG("IPv4.Address:%s", config->ip_info->ip_address);
+
+ int prefix_len;
+ in_addr_t addr;
+ struct in_addr netmask;
+ char *mask;
+ prefix_len = g_key_file_get_integer(keyfile, group_name,
+ WIFI_CONFIG_IPV4_SUBNET_MASK, NULL);
+ addr = 0xffffffff << (32 - prefix_len);
+ netmask.s_addr = htonl(addr);
+ mask = inet_ntoa(netmask);
+ config->ip_info->subnet_mask = g_strdup(mask);
+ if (config->ip_info->subnet_mask)
+ DBG("IPv4.SubnetMask:%s", config->ip_info->subnet_mask);
+
+ config->ip_info->gateway_address = g_key_file_get_string(keyfile,
+ group_name, WIFI_CONFIG_IPV4_GATEWAY_ADDRESS,
+ NULL);
+ if (config->ip_info->gateway_address)
+ DBG("IPv4.gateway:%s", config->ip_info->gateway_address);
+
+ config->ip_info->dns_type = g_key_file_get_string(keyfile, group_name,
+ WIFI_CONFIG_IPV4_DNS_METHOD, NULL);
+ if (config->ip_info->dns_type)
+ DBG("DNS.IPv4Method:%s", config->ip_info->dns_type);
+
+ char **nameservers;
+ gsize length;
+ nameservers = g_key_file_get_string_list(keyfile, group_name,
+ WIFI_CONFIG_DNS_ADDRESS, &length, NULL);
+ if (nameservers) {
+ if (length > 0) {
+ config->ip_info->dns_count = length;
+ int i = 0;
+ while (i < NET_DNS_ADDR_MAX && nameservers[i]) {
+ config->ip_info->dns_address[i] = g_strdup(nameservers[i]);
+ DBG("DNSAddress[%d]:%s", i+1, config->ip_info->dns_address[i]);
+ i += 1;
+ }
+ }
+ g_strfreev(nameservers);
+ }
+
+