projects
/
project
/
netifd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add a __init define for constructors
[project/netifd.git]
/
ubus.c
diff --git
a/ubus.c
b/ubus.c
index
159d5f5
..
72cf0e5
100644
(file)
--- a/
ubus.c
+++ b/
ubus.c
@@
-1,6
+1,7
@@
#include <string.h>
#include "netifd.h"
#include <string.h>
#include "netifd.h"
+#include "interface.h"
#include "ubus.h"
static struct ubus_context *ctx = NULL;
#include "ubus.h"
static struct ubus_context *ctx = NULL;
@@
-138,12
+139,18
@@
static int netifd_handle_status(struct ubus_context *ctx, struct ubus_object *ob
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
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);
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) {
blobmsg_add_u8(&b, "active", iface->active);
blobmsg_add_u8(&b, "autostart", iface->autostart);
if (iface->main_dev.dev) {