int nft_gmp_print(struct output_ctx *octx, const char *fmt, ...)
__attribute__((format(printf, 2, 0)));
+#define __NFT_OUTPUT_NOTSUPP UINT_MAX
+
#endif /* NFTABLES_NFTABLES_H */
static int cmd_evaluate_export(struct eval_ctx *ctx, struct cmd *cmd)
{
+ if (cmd->markup->format == __NFT_OUTPUT_NOTSUPP)
+ return cmd_error(ctx, "this output type is not supported");
+
return cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
ctx->debug_mask & NFT_DEBUG_NETLINK, ctx->octx);
}
+static int cmd_evaluate_import(struct eval_ctx *ctx, struct cmd *cmd)
+{
+ if (cmd->markup->format == __NFT_OUTPUT_NOTSUPP)
+ return cmd_error(ctx, "this output type not supported");
+
+ return 0;
+}
+
static const char * const cmd_op_name[] = {
[CMD_INVALID] = "invalid",
[CMD_ADD] = "add",
case CMD_MONITOR:
return cmd_evaluate_monitor(ctx, cmd);
case CMD_IMPORT:
- return 0;
+ return cmd_evaluate_import(ctx, cmd);
default:
BUG("invalid command operation %u\n", cmd->op);
};
struct markup *markup = markup_alloc($1);
$$ = cmd_alloc(CMD_IMPORT, CMD_OBJ_MARKUP, &h, &@$, markup);
}
- | JSON { $$ = NULL; }
;
export_cmd : RULESET markup_format
struct markup *markup = markup_alloc($1);
$$ = cmd_alloc(CMD_EXPORT, CMD_OBJ_MARKUP, &h, &@$, markup);
}
- | JSON { $$ = NULL; }
;
monitor_cmd : monitor_event monitor_object monitor_format
monitor_format : /* empty */ { $$ = NFTNL_OUTPUT_DEFAULT; }
| markup_format
- | JSON { $$ = NFTNL_OUTPUT_JSON; }
;
-markup_format : XML { $$ = NFTNL_OUTPUT_XML; }
+markup_format : XML { $$ = __NFT_OUTPUT_NOTSUPP; }
+ | JSON { $$ = __NFT_OUTPUT_NOTSUPP; }
| VM JSON { $$ = NFTNL_OUTPUT_JSON; }
;