projects
/
project
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3297b82
)
ubus: split address from mask in interface status
author
Felix Fietkau
<nbd@openwrt.org>
Thu, 12 Apr 2012 14:18:04 +0000
(16:18 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Thu, 12 Apr 2012 14:18:04 +0000
(16:18 +0200)
ubus.c
patch
|
blob
|
history
diff --git
a/ubus.c
b/ubus.c
index
b01d6ad
..
4746c4f
100644
(file)
--- a/
ubus.c
+++ b/
ubus.c
@@
-235,7
+235,8
@@
static void
interface_ip_dump_address_list(struct interface_ip_settings *ip)
{
struct device_addr *addr;
interface_ip_dump_address_list(struct interface_ip_settings *ip)
{
struct device_addr *addr;
- static char *buf;
+ char *buf;
+ void *a;
int buflen = 128;
int af;
int buflen = 128;
int af;
@@
-245,11
+246,15
@@
interface_ip_dump_address_list(struct interface_ip_settings *ip)
else
af = AF_INET6;
else
af = AF_INET6;
-
buf = blobmsg_alloc_string_buffer(&b, NULL, buflen
);
- inet_ntop(af, &addr->addr, buf, buflen - 5);
- buf
+= strlen(buf
);
-
sprintf(buf, "/%d", addr->mask
);
+
a = blobmsg_open_table(&b, NULL
);
+
+ buf
= blobmsg_alloc_string_buffer(&b, "address", buflen
);
+
inet_ntop(af, &addr->addr, buf, buflen
);
blobmsg_add_string_buffer(&b);
blobmsg_add_string_buffer(&b);
+
+ blobmsg_add_u32(&b, "mask", addr->mask);
+
+ blobmsg_close_table(&b, a);
}
}
}
}
@@
-269,12
+274,13
@@
interface_ip_dump_route_list(struct interface_ip_settings *ip)
af = AF_INET6;
r = blobmsg_open_table(&b, NULL);
af = AF_INET6;
r = blobmsg_open_table(&b, NULL);
+
buf = blobmsg_alloc_string_buffer(&b, "target", buflen);
buf = blobmsg_alloc_string_buffer(&b, "target", buflen);
- inet_ntop(af, &route->addr, buf, buflen - 5);
- buf += strlen(buf);
- sprintf(buf, "/%d", route->mask);
+ inet_ntop(af, &route->addr, buf, buflen);
blobmsg_add_string_buffer(&b);
blobmsg_add_string_buffer(&b);
+ blobmsg_add_u32(&b, "mask", route->mask);
+
buf = blobmsg_alloc_string_buffer(&b, "nexthop", buflen);
inet_ntop(af, &route->nexthop, buf, buflen);
blobmsg_add_string_buffer(&b);
buf = blobmsg_alloc_string_buffer(&b, "nexthop", buflen);
inet_ntop(af, &route->nexthop, buf, buflen);
blobmsg_add_string_buffer(&b);