#include <string.h>
#include "netifd.h"
+#include "interface.h"
#include "ubus.h"
static struct ubus_context *ctx = NULL;
if (!tb[DEV_NAME])
return UBUS_STATUS_INVALID_ARGUMENT;
- dev = get_device(blobmsg_data(tb[DEV_NAME]), false);
+ dev = device_get(blobmsg_data(tb[DEV_NAME]), false);
if (!dev)
return UBUS_STATUS_NOT_FOUND;
if (!add || (tb[DEV_FORCE] && blobmsg_get_u8(tb[DEV_FORCE])))
- set_device_present(dev, add);
+ device_set_present(dev, add);
else
check_device_state(dev);
struct interface *iface;
iface = container_of(obj, struct interface, ubus);
- set_interface_up(iface);
+ interface_set_up(iface);
return 0;
}
struct interface *iface;
iface = container_of(obj, struct interface, ubus);
- set_interface_down(iface);
+ interface_set_down(iface);
return 0;
}
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
+ static const char *iface_state[] = {
+ [IFS_SETUP] = "setup",
+ [IFS_UP] = "up",
+ [IFS_TEARDOWN] = "teardown",
+ [IFS_DOWN] = "down",
+ };
struct interface *iface;
iface = container_of(obj, struct interface, ubus);
blob_buf_init(&b, 0);
- blobmsg_add_u8(&b, "up", iface->up);
+ blobmsg_add_string(&b, "state", iface_state[iface->state]);
blobmsg_add_u8(&b, "active", iface->active);
blobmsg_add_u8(&b, "autostart", iface->autostart);
if (iface->main_dev.dev) {