- for (n = 0, p = strtok(NULL, " \t\n");
- n < ARRAY_SIZE(entry->flags) && p != NULL;
- n++, p = strtok(NULL, " \t\n"))
- {
- entry->flags[n] = strtoul(p, NULL, 10);
- }
+ sprintf(buf, "0x%x", z->flags[0]);
+ ptr.o = NULL;
+ ptr.option = "__flags_v4";
+ ptr.value = buf;
+ uci_set(ctx, &ptr);
+
+ sprintf(buf, "0x%x", z->flags[1]);
+ ptr.o = NULL;
+ ptr.option = "__flags_v6";
+ ptr.value = buf;
+ uci_set(ctx, &ptr);
+}
+
+static void
+write_ipset_uci(struct uci_context *ctx, struct fw3_ipset *s,
+ struct uci_package *dest)
+{
+ struct fw3_ipset_datatype *type;
+
+ char buf[sizeof("65535-65535\0")];
+
+ struct uci_ptr ptr = { .p = dest };
+
+ if (!s->enabled || s->external)
+ return;
+
+ uci_add_section(ctx, dest, "ipset", &ptr.s);
+
+ ptr.o = NULL;
+ ptr.option = "name";
+ ptr.value = s->name;
+ uci_set(ctx, &ptr);
+
+ ptr.o = NULL;
+ ptr.option = "storage";
+ ptr.value = fw3_ipset_method_names[s->method];
+ uci_set(ctx, &ptr);