X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=tunnel.c;h=3fa3e2152ad1e63ed1e298684467cccc64ac6a69;hp=524fd435e3d1f3178cc34cd1c45b81f62596c5d1;hb=d397e8ca5dd492a1fac2e186e2a8b91ac8e463df;hpb=18aa062d491988d6fa15092b7ed92cc6f9e44b6d diff --git a/tunnel.c b/tunnel.c index 524fd43..3fa3e21 100644 --- a/tunnel.c +++ b/tunnel.c @@ -61,17 +61,21 @@ tunnel_reload(struct device *dev, struct blob_attr *attr) } static struct device * -tunnel_create(const char *name, struct blob_attr *attr) +tunnel_create(const char *name, struct device_type *devtype, + struct blob_attr *attr) { struct tunnel *tun; struct device *dev; tun = calloc(1, sizeof(*tun)); + if (!tun) + return NULL; + dev = &tun->dev; - device_init(dev, &tunnel_device_type, name); + device_init(dev, devtype, name); tun->set_state = dev->set_state; dev->set_state = tunnel_set_state; - device_apply_config(dev, &tunnel_device_type, attr); + device_apply_config(dev, devtype, attr); device_set_present(dev, true); return dev; @@ -85,12 +89,15 @@ tunnel_free(struct device *dev) free(tun); } -const struct device_type tunnel_device_type = { - .name = "IP tunnel", +struct device_type tunnel_device_type = { + .name = "tunnel", .config_params = &tunnel_attr_list, .reload = tunnel_reload, .create = tunnel_create, .free = tunnel_free, }; - +static void __init tunnel_device_type_init(void) +{ + device_type_add(&tunnel_device_type); +}