projects
/
project
/
netifd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
interface-ip: DNS name server sorting support in resolv.conf.auto
[project/netifd.git]
/
macvlan.c
diff --git
a/macvlan.c
b/macvlan.c
index
9c03cd8
..
ffadfd4
100644
(file)
--- a/
macvlan.c
+++ b/
macvlan.c
@@
-44,6
+44,9
@@
static const struct blobmsg_policy macvlan_attrs[__MACVLAN_ATTR_MAX] = {
static const struct uci_blob_param_list macvlan_attr_list = {
.n_params = __MACVLAN_ATTR_MAX,
.params = macvlan_attrs,
static const struct uci_blob_param_list macvlan_attr_list = {
.n_params = __MACVLAN_ATTR_MAX,
.params = macvlan_attrs,
+
+ .n_next = 1,
+ .next = { &device_attr_list },
};
struct macvlan_device {
};
struct macvlan_device {
@@
-69,12
+72,6
@@
macvlan_base_cb(struct device_user *dev, enum device_event ev)
case DEV_EVENT_REMOVE:
device_set_present(&mvdev->dev, false);
break;
case DEV_EVENT_REMOVE:
device_set_present(&mvdev->dev, false);
break;
- case DEV_EVENT_LINK_UP:
- device_set_link(&mvdev->dev, true);
- break;
- case DEV_EVENT_LINK_DOWN:
- device_set_link(&mvdev->dev, false);
- break;
default:
return;
}
default:
return;
}
@@
-137,6
+134,7
@@
macvlan_free(struct device *dev)
mvdev = container_of(dev, struct macvlan_device, dev);
device_remove_user(&mvdev->parent);
mvdev = container_of(dev, struct macvlan_device, dev);
device_remove_user(&mvdev->parent);
+ free(mvdev->config_data);
free(mvdev);
}
free(mvdev);
}
@@
-194,6
+192,7
@@
macvlan_reload(struct device *dev, struct blob_attr *attr)
struct macvlan_device *mvdev;
mvdev = container_of(dev, struct macvlan_device, dev);
struct macvlan_device *mvdev;
mvdev = container_of(dev, struct macvlan_device, dev);
+ attr = blob_memdup(attr);
blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, tb_dev,
blob_data(attr), blob_len(attr));
blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, tb_dev,
blob_data(attr), blob_len(attr));
@@
-223,12
+222,14
@@
macvlan_reload(struct device *dev, struct blob_attr *attr)
macvlan_config_init(dev);
}
macvlan_config_init(dev);
}
+ free(mvdev->config_data);
mvdev->config_data = attr;
return ret;
}
static struct device *
mvdev->config_data = attr;
return ret;
}
static struct device *
-macvlan_create(const char *name, struct blob_attr *attr)
+macvlan_create(const char *name, struct device_type *devtype,
+ struct blob_attr *attr)
{
struct macvlan_device *mvdev;
struct device *dev = NULL;
{
struct macvlan_device *mvdev;
struct device *dev = NULL;
@@
-238,7
+239,7
@@
macvlan_create(const char *name, struct blob_attr *attr)
return NULL;
dev = &mvdev->dev;
return NULL;
dev = &mvdev->dev;
- device_init(dev,
&macvlan_device_
type, name);
+ device_init(dev,
dev
type, name);
dev->config_pending = true;
mvdev->set_state = dev->set_state;
dev->config_pending = true;
mvdev->set_state = dev->set_state;
@@
-252,10
+253,9
@@
macvlan_create(const char *name, struct blob_attr *attr)
return dev;
}
return dev;
}
-
const
struct device_type macvlan_device_type = {
+struct device_type macvlan_device_type = {
.name = "MAC VLAN",
.config_params = &macvlan_attr_list,
.name = "MAC VLAN",
.config_params = &macvlan_attr_list,
-
.create = macvlan_create,
.config_init = macvlan_config_init,
.reload = macvlan_reload,
.create = macvlan_create,
.config_init = macvlan_config_init,
.reload = macvlan_reload,