return 1;
}
-static int __add_match(struct nftnl_expr *e, struct xt_entry_match *m)
+void __add_match(struct nftnl_expr *e, const struct xt_entry_match *m)
{
void *info;
info = xtables_calloc(1, m->u.match_size);
memcpy(info, m->data, m->u.match_size - sizeof(*m));
nftnl_expr_set(e, NFTNL_EXPR_MT_INFO, info, m->u.match_size - sizeof(*m));
-
- return 0;
}
static int add_nft_limit(struct nftnl_rule *r, struct xt_entry_match *m)
if (udp->invflags > XT_UDP_INV_MASK ||
udp_all_zero(udp)) {
struct nftnl_expr *expr = nftnl_expr_alloc("match");
- int ret;
- ret = __add_match(expr, m);
+ __add_match(expr, m);
nftnl_rule_add_expr(r, expr);
- return ret;
+ return 0;
}
if (nftnl_rule_get_u32(r, NFTNL_RULE_COMPAT_PROTO) != IPPROTO_UDP)
if (tcp->invflags & ~supported || tcp->option ||
tcp_all_zero(tcp)) {
struct nftnl_expr *expr = nftnl_expr_alloc("match");
- int ret;
- ret = __add_match(expr, m);
+ __add_match(expr, m);
nftnl_rule_add_expr(r, expr);
- return ret;
+ return 0;
}
if (nftnl_rule_get_u32(r, NFTNL_RULE_COMPAT_PROTO) != IPPROTO_TCP)
struct nftnl_rule *r, struct xt_entry_match *m)
{
struct nftnl_expr *expr;
- int ret;
switch (ctx->command) {
case NFT_COMPAT_RULE_APPEND:
if (expr == NULL)
return -ENOMEM;
- ret = __add_match(expr, m);
+ __add_match(expr, m);
nftnl_rule_add_expr(r, expr);
- return ret;
+ return 0;
}
-static int __add_target(struct nftnl_expr *e, struct xt_entry_target *t)
+void __add_target(struct nftnl_expr *e, const struct xt_entry_target *t)
{
void *info;
info = xtables_calloc(1, t->u.target_size);
memcpy(info, t->data, t->u.target_size - sizeof(*t));
nftnl_expr_set(e, NFTNL_EXPR_TG_INFO, info, t->u.target_size - sizeof(*t));
-
- return 0;
}
static int add_meta_nftrace(struct nftnl_rule *r)
int add_target(struct nftnl_rule *r, struct xt_entry_target *t)
{
struct nftnl_expr *expr;
- int ret;
if (strcmp(t->u.user.name, "TRACE") == 0)
return add_meta_nftrace(r);
if (expr == NULL)
return -ENOMEM;
- ret = __add_target(expr, t);
+ __add_target(expr, t);
nftnl_rule_add_expr(r, expr);
- return ret;
+ return 0;
}
int add_jumpto(struct nftnl_rule *r, const char *name, int verdict)
*/
int add_counters(struct nftnl_rule *r, uint64_t packets, uint64_t bytes);
int add_verdict(struct nftnl_rule *r, int verdict);
+void __add_match(struct nftnl_expr *e, const struct xt_entry_match *m);
int add_match(struct nft_handle *h, struct nft_rule_ctx *ctx,
struct nftnl_rule *r, struct xt_entry_match *m);
+void __add_target(struct nftnl_expr *e, const struct xt_entry_target *t);
int add_target(struct nftnl_rule *r, struct xt_entry_target *t);
int add_jumpto(struct nftnl_rule *r, const char *name, int verdict);
int add_action(struct nftnl_rule *r, struct iptables_command_state *cs, bool goto_set);