json_t *osf_expr_json(const struct expr *expr, struct output_ctx *octx)
{
- json_t *root = json_pack("{s:s}", "key", "name");
+ json_t *root;
+
+ if (expr->osf.flags & NFT_OSF_F_VERSION)
+ root = json_pack("{s:s}", "key", "version");
+ else
+ root = json_pack("{s:s}", "key", "name");
switch (expr->osf.ttl) {
case 1:
const char *type, json_t *root)
{
const char *key, *ttl;
+ uint32_t flagval = 0;
uint8_t ttlval = 0;
if (json_unpack_err(ctx, root, "{s:s}", "key", &key))
}
}
- if (!strcmp(key, "name"))
- return osf_expr_alloc(int_loc, ttlval);
+ if (!strcmp(key, "name")) {
+ return osf_expr_alloc(int_loc, ttlval, flagval);
+ } else if (!strcmp(key, "version")) {
+ flagval |= NFT_OSF_F_VERSION;
+ return osf_expr_alloc(int_loc, ttlval, flagval);
+ }
json_error(ctx, "Invalid osf key value.");
return NULL;