summaryrefslogtreecommitdiffstats
path: root/src/object.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2016-11-27 23:27:00 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2016-12-09 14:50:53 +0100
commitb4edb4fc558ac177b66a867fa058c7624840d895 (patch)
treea912112dafddf33c1771499bc819ee9aefebbccb /src/object.c
parent5573d0146c1ae71ac5b3e4ba6a12c00585646a1a (diff)
expr: add stateful object reference expression
This patch adds a new "objref" expression that you can use to refer to stateful objects from rules. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/object.c b/src/object.c
index 0190e94..0d3dc2b 100644
--- a/src/object.c
+++ b/src/object.c
@@ -276,6 +276,7 @@ static int nftnl_jansson_parse_obj(struct nftnl_obj *t, json_t *tree,
struct nftnl_parse_err *err)
{
const char *str;
+ uint32_t type;
json_t *root;
root = nftnl_jansson_get_node(tree, "obj", err);
@@ -290,6 +291,10 @@ static int nftnl_jansson_parse_obj(struct nftnl_obj *t, json_t *tree,
if (str != NULL)
nftnl_obj_set_str(t, NFTNL_OBJ_NAME, str);
+ if (nftnl_jansson_parse_val(root, "type", NFTNL_TYPE_U32, &type,
+ err) < 0)
+ nftnl_obj_set_u32(t, NFTNL_OBJ_TYPE, type);
+
return 0;
}
#endif