summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--interface.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/interface.c b/interface.c
index 4cefe64..44f7a87 100644
--- a/interface.c
+++ b/interface.c
@@ -892,7 +892,7 @@ static bool __interface_add(struct interface *iface, struct blob_attr *config, b
{
struct blob_attr *tb[IFACE_ATTR_MAX];
struct blob_attr *cur;
- char *name = iface->dynamic ? strdup(iface->name) : NULL;
+ char *name = NULL;
blobmsg_parse(iface_attrs, IFACE_ATTR_MAX, tb,
blob_data(config), blob_len(config));
@@ -908,6 +908,13 @@ static bool __interface_add(struct interface *iface, struct blob_attr *config, b
iface->ifname = blobmsg_data(cur);
}
+ if (iface->dynamic) {
+ name = strdup(iface->name);
+
+ if (!name)
+ return false;
+ }
+
iface->config = config;
vlist_add(&interfaces, &iface->node, iface->name);