+ return ipconfig->address->broadcast;
+}
+
+void __connman_ipconfig_set_broadcast(struct connman_ipconfig *ipconfig,
+ const char *broadcast)
+{
+ if (!ipconfig->address)
+ return;
+
+ g_free(ipconfig->address->broadcast);
+ ipconfig->address->broadcast = g_strdup(broadcast);
+}
+
+const char *__connman_ipconfig_get_gateway(struct connman_ipconfig *ipconfig)
+{
+ if (!ipconfig->address)
+ return NULL;
+
+ return ipconfig->address->gateway;
+}
+
+void __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig,
+ const char *gateway)
+{
+ DBG("");
+
+ if (!ipconfig->address)
+ return;
+ g_free(ipconfig->address->gateway);
+ ipconfig->address->gateway = g_strdup(gateway);
+}
+
+int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig)
+{
+ struct connman_service *service;
+
+ DBG("");
+
+ if (!ipconfig->address)
+ return -EINVAL;
+
+ service = __connman_service_lookup_from_index(ipconfig->index);
+ if (!service)
+ return -EINVAL;
+
+ DBG("type %d gw %s peer %s", ipconfig->type,
+ ipconfig->address->gateway, ipconfig->address->peer);
+
+ if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV6 ||
+ ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV4)
+ return __connman_connection_gateway_add(service,
+ ipconfig->address->gateway,
+ ipconfig->type,
+ ipconfig->address->peer);
+
+ return 0;
+}
+
+void __connman_ipconfig_gateway_remove(struct connman_ipconfig *ipconfig)
+{
+ struct connman_service *service;
+
+ DBG("");
+
+ service = __connman_service_lookup_from_index(ipconfig->index);
+ if (service)
+ __connman_connection_gateway_remove(service, ipconfig->type);
+}
+
+unsigned char __connman_ipconfig_get_prefixlen(struct connman_ipconfig *ipconfig)
+{
+ if (!ipconfig->address)
+ return 0;
+
+ return ipconfig->address->prefixlen;
+}
+
+void __connman_ipconfig_set_prefixlen(struct connman_ipconfig *ipconfig,
+ unsigned char prefixlen)
+{
+ if (!ipconfig->address)
+ return;
+
+ ipconfig->address->prefixlen = prefixlen;
+}
+
+static struct connman_ipconfig *create_ipv6config(int index)
+{
+ struct connman_ipconfig *ipv6config;
+ struct connman_ipdevice *ipdevice;
+
+ ipv6config = g_try_new0(struct connman_ipconfig, 1);
+ if (!ipv6config)
+ return NULL;
+
+ ipv6config->refcount = 1;
+
+ ipv6config->index = index;
+ ipv6config->type = CONNMAN_IPCONFIG_TYPE_IPV6;
+
+ if (!is_ipv6_supported)
+ ipv6config->method = CONNMAN_IPCONFIG_METHOD_OFF;
+ else
+ ipv6config->method = CONNMAN_IPCONFIG_METHOD_AUTO;
+
+ ipdevice = g_hash_table_lookup(ipdevice_hash, GINT_TO_POINTER(index));
+ if (ipdevice)
+ ipv6config->ipv6_privacy_config = ipdevice->ipv6_privacy;
+
+ ipv6config->address = connman_ipaddress_alloc(AF_INET6);
+ if (!ipv6config->address) {
+ g_free(ipv6config);
+ return NULL;
+ }
+
+ ipv6config->system = connman_ipaddress_alloc(AF_INET6);
+
+ DBG("ipconfig %p index %d method %s", ipv6config, index,
+ __connman_ipconfig_method2string(ipv6config->method));
+
+ return ipv6config;
+}
+
+/**
+ * connman_ipconfig_create:
+ *
+ * Allocate a new ipconfig structure.
+ *
+ * Returns: a newly-allocated #connman_ipconfig structure
+ */
+struct connman_ipconfig *__connman_ipconfig_create(int index,
+ enum connman_ipconfig_type type)
+{
+ struct connman_ipconfig *ipconfig;
+
+ if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
+ return create_ipv6config(index);