- blobmsg_for_each_attr(rule, dcur, rrem)
- blobmsg_add_blob(b, rule);
+ n = 0;
+
+ blobmsg_for_each_attr(rule, dcur, rrem) {
+ void *k = blobmsg_open_table(b, "");
+
+ snprintf(comment, sizeof(comment), "ubus:%s[%s] rule %d",
+ blobmsg_name(c), blobmsg_name(cur), n++);
+
+ blobmsg_for_each_attr(ropt, rule, orem)
+ if (strcmp(blobmsg_name(ropt), "name"))
+ blobmsg_add_blob(b, ropt);
+
+ blobmsg_add_string(b, "name", comment);
+ blobmsg_close_table(b, k);
+ }