libubus: fix writev_retry() function when writing large packets
[project/ubus.git] / libubus-obj.c
index 212c13c..47bdb0a 100644 (file)
@@ -46,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;
@@ -144,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);
 }