nft_table_attr_set_u32(nlt, NFT_TABLE_ATTR_FAMILY, h->family);
if (h->table != NULL)
nft_table_attr_set(nlt, NFT_TABLE_ATTR_NAME, h->table);
+
return nlt;
}
nft_chain_attr_set_u64(nlc, NFT_CHAIN_ATTR_HANDLE, h->handle);
if (h->chain != NULL)
nft_chain_attr_set_str(nlc, NFT_CHAIN_ATTR_NAME, h->chain);
+
return nlc;
}
nft_rule_attr_set_u64(nlr, NFT_RULE_ATTR_HANDLE, h->handle);
if (h->position)
nft_rule_attr_set_u64(nlr, NFT_RULE_ATTR_POSITION, h->position);
- if (h->comment) {
+ if (h->comment)
nft_rule_attr_set_data(nlr, NFT_RULE_ATTR_USERDATA,
h->comment, strlen(h->comment) + 1);
- }
+
return nlr;
}
nle = nft_rule_expr_alloc(name);
if (nle == NULL)
memory_allocation_error();
+
return nle;
}
case EXPR_VERDICT:
nft_set_elem_attr_set_u32(nlse, NFT_SET_ELEM_ATTR_VERDICT,
expr->right->verdict);
- if (expr->chain != NULL) {
+ if (expr->chain != NULL)
nft_set_elem_attr_set(nlse, NFT_SET_ELEM_ATTR_CHAIN,
nld.chain, strlen(nld.chain));
- }
break;
case EXPR_VALUE:
nft_set_elem_attr_set(nlse, NFT_SET_ELEM_ATTR_DATA,
}
}
- if (expr->flags & EXPR_F_INTERVAL_END) {
+ if (expr->flags & EXPR_F_INTERVAL_END)
nft_set_elem_attr_set_u32(nlse, NFT_SET_ELEM_ATTR_FLAGS,
NFT_SET_ELEM_INTERVAL_END);
- }
return nlse;
}
netlink_linearize_rule(ctx, nlr, rule);
err = mnl_nft_rule_batch_add(nlr, flags | NLM_F_EXCL, ctx->seqnum);
nft_rule_free(nlr);
- if (err < 0) {
+ if (err < 0)
netlink_io_error(ctx, &rule->location,
"Could not add rule to batch: %s",
strerror(errno));
- }
return err;
}
if (err < 0)
netlink_io_error(ctx, loc, "Could not delete rule to batch: %s",
strerror(errno));
-
return err;
}
ctx->seqnum);
nft_chain_free(nlc);
- if (err < 0) {
+ if (err < 0)
netlink_io_error(ctx, loc, "Could not add chain: %s",
strerror(errno));
- }
return err;
}
err = mnl_nft_chain_batch_add(nlc, 0, ctx->seqnum);
nft_chain_free(nlc);
- if (err < 0) {
+ if (err < 0)
netlink_io_error(ctx, loc, "Could not rename chain: %s",
strerror(errno));
- }
return err;
}
err = mnl_nft_chain_delete(nf_sock, nlc, 0);
nft_chain_free(nlc);
- if (err < 0) {
+ if (err < 0)
netlink_io_error(ctx, loc, "Could not delete chain: %s",
strerror(errno));
- }
return err;
}
err = mnl_nft_chain_batch_del(nlc, 0, ctx->seqnum);
nft_chain_free(nlc);
- if (err < 0) {
+ if (err < 0)
netlink_io_error(ctx, loc, "Could not delete chain: %s",
strerror(errno));
- }
return err;
}
ctx->seqnum);
nft_table_free(nlt);
- if (err < 0) {
+ if (err < 0)
netlink_io_error(ctx, loc, "Could not add table: %s",
strerror(errno));
- }
return err;
}
err = mnl_nft_table_batch_del(nlt, 0, ctx->seqnum);
nft_table_free(nlt);
- if (err < 0) {
+ if (err < 0)
netlink_io_error(ctx, loc, "Could not delete table: %s",
strerror(errno));
- }
return err;
}
netlink_dump_set(nls);
err = mnl_nft_set_batch_add(nls, NLM_F_EXCL, ctx->seqnum);
- if (err < 0) {
+ if (err < 0)
netlink_io_error(ctx, &set->location, "Could not add set: %s",
strerror(errno));
- }
nft_set_free(nls);
return err;
if (err < 0)
netlink_io_error(ctx, loc, "Could not flush the ruleset: %s",
strerror(errno));
-
return err;
}