const char *str, int8_t *dir);
extern struct error_record *ct_key_parse(const struct location *loc, const char *str,
unsigned int *key);
+
+extern struct stmt *notrack_stmt_alloc(const struct location *loc);
+
#endif /* NFTABLES_CT_H */
* @STMT_FWD: forward statement
* @STMT_XT: XT statement
* @STMT_QUOTA: quota statement
+ * @STMT_NOTRACK: notrack statement
*/
enum stmt_types {
STMT_INVALID,
STMT_FWD,
STMT_XT,
STMT_QUOTA,
+ STMT_NOTRACK,
};
/**
return stmt;
}
+static void notrack_stmt_print(const struct stmt *stmt)
+{
+ printf("notrack");
+}
+
+static const struct stmt_ops notrack_stmt_ops = {
+ .type = STMT_NOTRACK,
+ .name = "notrack",
+ .print = notrack_stmt_print,
+};
+
+struct stmt *notrack_stmt_alloc(const struct location *loc)
+{
+ return stmt_alloc(loc, ¬rack_stmt_ops);
+}
+
static void __init ct_init(void)
{
datatype_register(&ct_state_type);
case STMT_COUNTER:
case STMT_LIMIT:
case STMT_QUOTA:
+ case STMT_NOTRACK:
return 0;
case STMT_EXPRESSION:
return stmt_evaluate_expr(ctx, stmt);
netlink_set_register(ctx, dreg, expr);
}
+static void netlink_parse_notrack(struct netlink_parse_ctx *ctx,
+ const struct location *loc,
+ const struct nftnl_expr *nle)
+{
+ ctx->stmt = notrack_stmt_alloc(loc);
+}
+
static void netlink_parse_ct_stmt(struct netlink_parse_ctx *ctx,
const struct location *loc,
const struct nftnl_expr *nle)
{ .name = "range", .parse = netlink_parse_range },
{ .name = "reject", .parse = netlink_parse_reject },
{ .name = "nat", .parse = netlink_parse_nat },
+ { .name = "notrack", .parse = netlink_parse_notrack },
{ .name = "masq", .parse = netlink_parse_masq },
{ .name = "redir", .parse = netlink_parse_redir },
{ .name = "dup", .parse = netlink_parse_dup },
nftnl_rule_add_expr(ctx->nlr, nle);
}
+static void netlink_gen_notrack_stmt(struct netlink_linearize_ctx *ctx,
+ const struct stmt *stmt)
+{
+ struct nftnl_expr *nle;
+
+ nle = alloc_nft_expr("notrack");
+ nftnl_rule_add_expr(ctx->nlr, nle);
+}
+
static void netlink_gen_set_stmt(struct netlink_linearize_ctx *ctx,
const struct stmt *stmt)
{
nle = netlink_gen_stmt_stateful(ctx, stmt);
nftnl_rule_add_expr(ctx->nlr, nle);
break;
+ case STMT_NOTRACK:
+ return netlink_gen_notrack_stmt(ctx, stmt);
default:
BUG("unknown statement type %s\n", stmt->ops->name);
}
%token XML "xml"
%token JSON "json"
+%token NOTRACK "notrack"
+
%type <string> identifier type_identifier string comment_spec
%destructor { xfree($$); } identifier type_identifier string comment_spec
$$ = meta_stmt_alloc(&@$, key, $4);
}
+ | NOTRACK
+ {
+ $$ = notrack_stmt_alloc(&@$);
+ }
;
offset_opt : /* empty */ { $$ = 0; }
"fib" { return FIB; }
+"notrack" { return NOTRACK; }
+
"xml" { return XML; }
"json" { return JSON; }
ct invalid original;fail
ct set invalid original 42;fail
ct set invalid 42;fail
+
+notrack;ok
[ immediate reg 1 0x00000000 0x00000000 0x00000000 0x80000000 ]
[ ct set label with reg 1 ]
+# notrack
+ip test-ip4 output
+ [ notrack ]
+