+ option = g_dhcp_client_get_option(dhcp_client, G_DHCP_DOMAIN_NAME);
+ if (option != NULL)
+ domainname = g_strdup(option->data);
+
+ option = g_dhcp_client_get_option(dhcp_client, G_DHCP_HOST_NAME);
+ if (option != NULL)
+ hostname = g_strdup(option->data);
+
+ option = g_dhcp_client_get_option(dhcp_client, G_DHCP_NTP_SERVER);
+ ns_entries = g_list_length(option);
+ timeservers = g_try_new0(char *, ns_entries + 1);
+ if (timeservers != NULL) {
+ for (i = 0, list = option; list; list = list->next, i++)
+ timeservers[i] = g_strdup(list->data);
+ timeservers[ns_entries] = NULL;
+ }
+
+ option = g_dhcp_client_get_option(dhcp_client, 252);
+ if (option != NULL)
+ pac = g_strdup(option->data);
+
+ __connman_ipconfig_set_method(ipconfig, CONNMAN_IPCONFIG_METHOD_DHCP);
+
+ if (ip_change == TRUE) {
+ __connman_ipconfig_set_local(ipconfig, address);
+ __connman_ipconfig_set_prefixlen(ipconfig, prefixlen);
+ __connman_ipconfig_set_gateway(ipconfig, gateway);
+ }
+
+ if (compare_string_arrays(nameservers, dhcp->nameservers) == FALSE) {
+ if (dhcp->nameservers != NULL) {
+ for (i = 0; dhcp->nameservers[i] != NULL; i++) {
+ __connman_service_nameserver_remove(service,
+ dhcp->nameservers[i], FALSE);
+ }
+ g_strfreev(dhcp->nameservers);
+ }
+
+ dhcp->nameservers = nameservers;
+
+ for (i = 0; dhcp->nameservers != NULL &&
+ dhcp->nameservers[i] != NULL; i++) {
+ __connman_service_nameserver_append(service,
+ dhcp->nameservers[i], FALSE);
+ }
+ } else {
+ g_strfreev(nameservers);
+ }
+
+ if (compare_string_arrays(timeservers, dhcp->timeservers) == FALSE) {
+ if (dhcp->timeservers != NULL) {
+ for (i = 0; dhcp->timeservers[i] != NULL; i++) {
+ __connman_service_timeserver_remove(service,
+ dhcp->timeservers[i]);
+ }
+ g_strfreev(dhcp->timeservers);
+ }
+
+ dhcp->timeservers = timeservers;
+
+ for (i = 0; dhcp->timeservers != NULL &&
+ dhcp->timeservers[i] != NULL; i++) {
+ __connman_service_timeserver_append(service,
+ dhcp->timeservers[i]);
+ }
+ } else {
+ g_strfreev(timeservers);
+ }
+
+ if (g_strcmp0(pac, dhcp->pac) != 0) {
+ g_free(dhcp->pac);
+ dhcp->pac = pac;
+
+ __connman_service_set_pac(service, dhcp->pac);
+ }