projects
/
project
/
netifd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bridge: enable multicast_to_unicast on all wireless bridge ports
[project/netifd.git]
/
ubus.c
diff --git
a/ubus.c
b/ubus.c
index
5cb54b1
..
9a573c6
100644
(file)
--- a/
ubus.c
+++ b/
ubus.c
@@
-147,13
+147,16
@@
netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj,
goto error;
interface_add(iface, config);
goto error;
interface_add(iface, config);
- interface_set_dynamic(iface);
- // need to look up the interface name again, in case of config update,
+ // need to look up the interface name again, in case of config update
+ // the pointer will have changed
iface = vlist_find(&interfaces, name, iface, node);
if (!iface)
return UBUS_STATUS_UNKNOWN_ERROR;
iface = vlist_find(&interfaces, name, iface, node);
if (!iface)
return UBUS_STATUS_UNKNOWN_ERROR;
+ // Set interface as dynamic
+ interface_set_dynamic(iface);
+
dev = iface->main_dev.dev;
if (!dev || !dev->default_config)
return UBUS_STATUS_UNKNOWN_ERROR;
dev = iface->main_dev.dev;
if (!dev || !dev->default_config)
return UBUS_STATUS_UNKNOWN_ERROR;
@@
-483,6
+486,9
@@
interface_ip_dump_route_list(struct interface_ip_settings *ip, bool enabled)
inet_ntop(af, &route->nexthop, buf, buflen);
blobmsg_add_string_buffer(&b);
inet_ntop(af, &route->nexthop, buf, buflen);
blobmsg_add_string_buffer(&b);
+ if (route->flags & DEVROUTE_TYPE)
+ blobmsg_add_u32(&b, "type", route->type);
+
if (route->flags & DEVROUTE_MTU)
blobmsg_add_u32(&b, "mtu", route->mtu);
if (route->flags & DEVROUTE_MTU)
blobmsg_add_u32(&b, "mtu", route->mtu);
@@
-650,7
+656,8
@@
netifd_dump_status(struct interface *iface)
if (iface->state == IFS_UP) {
time_t cur = system_get_rtime();
blobmsg_add_u32(&b, "uptime", cur - iface->start_time);
if (iface->state == IFS_UP) {
time_t cur = system_get_rtime();
blobmsg_add_u32(&b, "uptime", cur - iface->start_time);
- blobmsg_add_string(&b, "l3_device", iface->l3_dev.dev->ifname);
+ if (iface->l3_dev.dev)
+ blobmsg_add_string(&b, "l3_device", iface->l3_dev.dev->ifname);
}
if (iface->proto_handler)
}
if (iface->proto_handler)
@@
-1160,7
+1167,7
@@
netifd_ubus_interface_event(struct interface *iface, bool up)
void
netifd_ubus_interface_notify(struct interface *iface, bool up)
{
void
netifd_ubus_interface_notify(struct interface *iface, bool up)
{
- const char *event = (up) ? "
update" : "
down";
+ const char *event = (up) ? "
interface.update" : "interface.
down";
blob_buf_init(&b, 0);
blobmsg_add_string(&b, "interface", iface->name);
netifd_dump_status(iface);
blob_buf_init(&b, 0);
blobmsg_add_string(&b, "interface", iface->name);
netifd_dump_status(iface);