*/
struct connman_ipaddress {
+ int family;
unsigned char prefixlen;
char *local;
char *peer;
char *gateway;
};
-struct connman_ipaddress *connman_ipaddress_alloc(void);
+struct connman_ipaddress *connman_ipaddress_alloc(int family);
void connman_ipaddress_free(struct connman_ipaddress *ipaddress);
void connman_ipaddress_set(struct connman_ipaddress *ipaddress,
const char *address, const char *netmask, const char *gateway);
static GHashTable *ipdevice_hash = NULL;
static GList *ipconfig_list = NULL;
-struct connman_ipaddress *connman_ipaddress_alloc(void)
+struct connman_ipaddress *connman_ipaddress_alloc(int family)
{
struct connman_ipaddress *ipaddress;
if (ipaddress == NULL)
return NULL;
+ ipaddress->family = family;
ipaddress->prefixlen = 0;
ipaddress->local = NULL;
ipaddress->peer = NULL;
if (ipaddress == NULL || source == NULL)
return;
+ ipaddress->family = source->family;
ipaddress->prefixlen = source->prefixlen;
g_free(ipaddress->local);
if (ipdevice == NULL)
return;
- ipaddress = connman_ipaddress_alloc();
+ ipaddress = connman_ipaddress_alloc(family);
if (ipaddress == NULL)
return;
ipv6config->index = index;
ipv6config->type = CONNMAN_IPCONFIG_TYPE_IPV6;
- ipv6config->address = connman_ipaddress_alloc();
+ ipv6config->address = connman_ipaddress_alloc(AF_INET6);
if (ipv6config->address == NULL) {
g_free(ipv6config);
return NULL;
}
- ipv6config->system = connman_ipaddress_alloc();
+ ipv6config->system = connman_ipaddress_alloc(AF_INET6);
ipv6config->ipv6 = NULL;
ipconfig->index = index;
ipconfig->type = CONNMAN_IPCONFIG_TYPE_IPV4;
- ipconfig->address = connman_ipaddress_alloc();
+ ipconfig->address = connman_ipaddress_alloc(AF_INET);
if (ipconfig->address == NULL) {
g_free(ipconfig);
return NULL;
}
- ipconfig->system = connman_ipaddress_alloc();
+ ipconfig->system = connman_ipaddress_alloc(AF_INET);
ipconfig->ipv6 = create_ipv6config(index);