summaryrefslogtreecommitdiffstats
path: root/src/json.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-03-09 00:27:38 +0100
committerPhil Sutter <phil@nwl.cc>2024-03-19 18:24:47 +0100
commitc56d77cc82988391ab8f2514214c0088cbc7d89e (patch)
treeed1aba19a49f251911eae6e954e847d5c9dda0c2 /src/json.c
parent2a0fe52eca32acc8927c97e164b5e79337073ceb (diff)
json: Support maps with concatenated data
Dump such maps with an array of types in "map" property, make the parser aware of this. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/json.c b/src/json.c
index bb515164..29fbd0cf 100644
--- a/src/json.c
+++ b/src/json.c
@@ -130,15 +130,15 @@ static json_t *set_stmt_list_json(const struct list_head *stmt_list,
static json_t *set_print_json(struct output_ctx *octx, const struct set *set)
{
- json_t *root, *tmp;
- const char *type, *datatype_ext = NULL;
+ json_t *root, *tmp, *datatype_ext = NULL;
+ const char *type;
if (set_is_datamap(set->flags)) {
type = "map";
- datatype_ext = set->data->dtype->name;
+ datatype_ext = set_dtype_json(set->data);
} else if (set_is_objmap(set->flags)) {
type = "map";
- datatype_ext = obj_type_name(set->objtype);
+ datatype_ext = json_string(obj_type_name(set->objtype));
} else if (set_is_meter(set->flags)) {
type = "meter";
} else {
@@ -155,7 +155,7 @@ static json_t *set_print_json(struct output_ctx *octx, const struct set *set)
if (set->comment)
json_object_set_new(root, "comment", json_string(set->comment));
if (datatype_ext)
- json_object_set_new(root, "map", json_string(datatype_ext));
+ json_object_set_new(root, "map", datatype_ext);
if (!(set->flags & (NFT_SET_CONSTANT))) {
if (set->policy != NFT_SET_POL_PERFORMANCE) {