X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubus.git;a=blobdiff_plain;f=libubus-obj.c;h=47bdb0a4e758683a4c044b4e56dfa1968b8d4acc;hp=ed18ca99f4ecff13bd0f16e82c859d870d580e66;hb=6280cbaf0966928c4f83b925fb5b94c3ecb1936e;hpb=ee9e399096941e1c745f34f118a2cf8d1862243e diff --git a/libubus-obj.c b/libubus-obj.c index ed18ca9..47bdb0a 100644 --- a/libubus-obj.c +++ b/libubus-obj.c @@ -27,7 +27,8 @@ ubus_process_unsubscribe(struct ubus_context *ctx, struct ubus_msghdr *hdr, return; s = container_of(obj, struct ubus_subscriber, obj); - s->remove_cb(ctx, s, blob_get_u32(attrbuf[UBUS_ATTR_TARGET])); + if (s->remove_cb) + s->remove_cb(ctx, s, blob_get_u32(attrbuf[UBUS_ATTR_TARGET])); } static void @@ -45,7 +46,9 @@ static void ubus_process_invoke(struct ubus_context *ctx, struct ubus_msghdr *hdr, struct ubus_object *obj, struct blob_attr **attrbuf) { - struct ubus_request_data req = {}; + struct ubus_request_data req = { + .fd = -1, + }; int method; int ret; bool no_reply = false; @@ -96,7 +99,7 @@ void __hidden ubus_process_obj_msg(struct ubus_context *ctx, struct ubus_msghdr struct ubus_object *obj; uint32_t objid; - attrbuf = ubus_parse_msg(hdr->data); + attrbuf = ubus_parse_msg(ubus_msghdr_data(hdr)); if (!attrbuf[UBUS_ATTR_OBJID]) return; @@ -143,8 +146,12 @@ static void ubus_push_method_data(const struct ubus_method *m) mtbl = blobmsg_open_table(&b, m->name); - for (i = 0; i < m->n_policy; i++) + for (i = 0; i < m->n_policy; i++) { + if (m->mask && !(m->mask & (1 << i))) + continue; + blobmsg_add_u32(&b, m->policy[i].name, m->policy[i].type); + } blobmsg_close_table(&b, mtbl); }