}
lxc_list_init(list);
- list->elem = netdev;
+ lxc_list_add_elem(list, netdev);
/* We maintain a negative count for legacy networks. */
netdev->idx = -1;
}
lxc_list_init(list);
- list->elem = inetdev;
+ lxc_list_add_elem(list, inetdev);
addr = strdup(value);
if (!addr) {
prefix = slash + 1;
}
- if (!inet_pton(AF_INET, addr, &inetdev->addr)) {
+ if (inet_pton(AF_INET, addr, &inetdev->addr) != 1) {
SYSERROR("invalid ipv4 address: %s", value);
free(inetdev);
free(addr);
return -1;
}
- if (bcast && !inet_pton(AF_INET, bcast, &inetdev->bcast)) {
+ if (bcast && inet_pton(AF_INET, bcast, &inetdev->bcast) != 1) {
SYSERROR("invalid ipv4 broadcast address: %s", value);
free(inetdev);
free(list);
return -1;
}
- if (!inet_pton(AF_INET, value, gw)) {
+ if (inet_pton(AF_INET, value, gw) != 1) {
SYSERROR("invalid ipv4 gateway address: %s", value);
free(gw);
return -1;
}
}
- if (!inet_pton(AF_INET6, valdup, &inet6dev->addr)) {
+ if (inet_pton(AF_INET6, valdup, &inet6dev->addr) != 1) {
SYSERROR("invalid ipv6 address: %s", valdup);
free(list);
free(inet6dev);
return -1;
}
- if (!inet_pton(AF_INET6, value, gw)) {
+ if (inet_pton(AF_INET6, value, gw) != 1) {
SYSERROR("invalid ipv6 gateway address: %s", value);
free(gw);
return -1;
else
memset(retv, 0, inlen);
- if (!strncmp(key, "lxc.network.", 12))
- key += 12;
- else
+ if (strncmp(key, "lxc.network.", 12) != 0)
return -1;
- p1 = strchr(key, '.');
+ p1 = strchr(key + 12, '.');
if (!p1 || *(p1 + 1) == '\0')
return -1;
p1++;
- netdev = get_netdev_from_key(key, &c->network);
+ netdev = network_netdev(key, "", &c->network);
if (!netdev)
return -1;
+
if (strcmp(p1, "name") == 0) {
if (netdev->name[0] != '\0')
strprint(retv, inlen, "%s", netdev->name);
return -1;
p1 = strchr(key, '.');
- if (!p1 || *(p1+1) == '\0')
- return -1;
-
- if (it) {
+ if (!p1 && it) {
lxc_remove_nic(it);
} else if (strcmp(p1, ".ipv4") == 0) {
struct lxc_list *it2,*next;