summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2016-12-01 20:12:22 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2017-01-03 14:21:53 +0100
commit85d2072eccdfcb7e8045a60d8bb939de61d1c04b (patch)
treea279ec7ba1b8b6cdec507f3171c80e41f47695a1 /src/rule.c
parentdeaf962ebd7c6b9d8a161d9378a710031e4f1dd6 (diff)
src: support for stateful object monitoring
This patch extends the event monitoring infrastructure to catch events of addition and removal of stateful objects. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/rule.c b/src/rule.c
index b97213e9..b6dc755e 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -1158,6 +1158,19 @@ void obj_add_hash(struct obj *obj, struct table *table)
list_add_tail(&obj->list, &table->objs);
}
+struct obj *obj_lookup(const struct table *table, const char *name,
+ uint32_t type)
+{
+ struct obj *obj;
+
+ list_for_each_entry(obj, &table->objs, list) {
+ if (!strcmp(obj->handle.obj, name) &&
+ obj->type == type)
+ return obj;
+ }
+ return NULL;
+}
+
static void obj_print_data(const struct obj *obj,
struct print_fmt_options *opts)
{
@@ -1229,6 +1242,18 @@ void obj_print(const struct obj *obj)
obj_print_declaration(obj, &opts);
}
+void obj_print_plain(const struct obj *obj)
+{
+ struct print_fmt_options opts = {
+ .tab = "",
+ .nl = " ",
+ .table = obj->handle.table,
+ .family = family2str(obj->handle.family),
+ };
+
+ obj_print_declaration(obj, &opts);
+}
+
static int do_list_obj(struct netlink_ctx *ctx, struct cmd *cmd, uint32_t type)
{
struct print_fmt_options opts = {