summaryrefslogtreecommitdiffstats
path: root/src/ct.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-03-31 04:14:26 +0200
committerPatrick McHardy <kaber@trash.net>2009-03-31 04:14:26 +0200
commit4fee12b4b0a837b4d34d21be99cda8185563f784 (patch)
tree129d65c66938c3851be3a3a35eb6523e5fef8791 /src/ct.c
parent53fc2c7a799877c5859298bd16b578711af9cca2 (diff)
datatype: maintain table of all datatypes and add registration/lookup function
Add a table containing all available datatypes and registration/lookup functions. This will be used to associate a stand-alone set in the kernel with the correct type without parsing the entire ruleset. Additionally it would now be possible to remove the global declarations for the core types. Not done yet though. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/ct.c')
-rw-r--r--src/ct.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ct.c b/src/ct.c
index ea97d6ad..b077a5f9 100644
--- a/src/ct.c
+++ b/src/ct.c
@@ -40,7 +40,8 @@ static const struct symbol_table ct_state_tbl = {
static const struct datatype ct_state_type = {
.type = TYPE_CT_STATE,
- .name = "conntrack state",
+ .name = "ct_state",
+ .desc = "conntrack state",
.basetype = &bitmask_type,
.sym_tbl = &ct_state_tbl,
};
@@ -57,7 +58,8 @@ static const struct symbol_table ct_dir_tbl = {
static const struct datatype ct_dir_type = {
.type = TYPE_CT_DIR,
- .name = "conntrack direction",
+ .name = "ct_dir",
+ .desc = "conntrack direction",
.basetype = &bitmask_type,
.sym_tbl = &ct_dir_tbl,
};
@@ -82,7 +84,8 @@ static const struct symbol_table ct_status_tbl = {
static const struct datatype ct_status_type = {
.type = TYPE_CT_STATUS,
- .name = "conntrack status",
+ .name = "ct_status",
+ .desc = "conntrack status",
.basetype = &bitmask_type,
.sym_tbl = &ct_status_tbl,
};
@@ -153,3 +156,10 @@ struct expr *ct_expr_alloc(const struct location *loc, enum nft_ct_keys key)
expr->ct.key = key;
return expr;
}
+
+static void __init ct_init(void)
+{
+ datatype_register(&ct_state_type);
+ datatype_register(&ct_dir_type);
+ datatype_register(&ct_status_type);
+}