On 10.03, Alvaro Neira Ayuso wrote: > @@ -275,6 +279,13 @@ struct export { > struct export *export_alloc(uint32_t format); > void export_free(struct export *e); > > +struct import { > + uint32_t format; > +}; > + > +struct import *import_alloc(uint32_t format); > +void import_free(struct import *i); How about a common struct for both commands? "format", "import_export", ... > +import_cmd : import_format Same here, please change export_format to something common. > +static int ruleset_parse_setelems(const struct nft_parse_ctx *ctx) > +{ > + const struct ruleset_parse *rp; > + struct nft_set *set; > + uint32_t cmd; > + int ret = -1; > + > + set = nft_ruleset_ctx_get(ctx, NFT_RULESET_CTX_SET); > + rp = nft_ruleset_ctx_get(ctx, NFT_RULESET_CTX_DATA); > + > + cmd = nft_ruleset_ctx_get_u32(ctx, NFT_RULESET_CTX_CMD); > + switch (cmd) { > + case NFT_CMD_ADD: > + ret = mnl_nft_setelem_batch_add(set, 0, rp->nl_ctx->seqnum); > + break; > + case NFT_CMD_DELETE: > + ret = mnl_nft_setelem_batch_del(set, 0, rp->nl_ctx->seqnum); > + break; > + default: > + errno = EOPNOTSUPP; > + break; This would be a BUG, no? Same question for all similar cases. > +static int do_command_import(struct netlink_ctx *ctx, struct cmd *cmd) > +{ > + int ret; > + struct nft_parse_err *err; > + struct ruleset_parse rp = { > + .nl_ctx = ctx, > + .cmd = cmd Please align, makes it easier to read. > + ret = nft_ruleset_parse_file_cb(cmd->import->format, stdin, err, &rp, > + ruleset_parse_cb); > + if (ret < 0) > + nft_parse_perror("unable to import. Parsing failed", err); I'd suggest a ": parsing failed", makes it clear that its only a single error, not two. > + > + nft_parse_err_free(err); > + return ret; > +} > + -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html