summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mnl.h25
-rw-r--r--include/netlink.h14
-rw-r--r--include/rule.h2
3 files changed, 41 insertions, 0 deletions
diff --git a/include/mnl.h b/include/mnl.h
index bd244898..fe2fb400 100644
--- a/include/mnl.h
+++ b/include/mnl.h
@@ -1,6 +1,31 @@
#ifndef _NFTABLES_MNL_H_
#define _NFTABLES_MNL_H_
+#include <list.h>
+
+struct mnl_socket;
+
+uint32_t mnl_seqnum_alloc(void);
+
+struct mnl_err {
+ struct list_head head;
+ int err;
+ uint32_t seqnum;
+};
+
+void mnl_err_list_free(struct mnl_err *err);
+
+void mnl_batch_init(void);
+bool mnl_batch_ready(void);
+void mnl_batch_reset(void);
+void mnl_batch_begin(void);
+void mnl_batch_end(void);
+int mnl_batch_talk(struct mnl_socket *nl, struct list_head *err_list);
+int mnl_nft_rule_batch_add(struct nft_rule *nlr, unsigned int flags,
+ uint32_t seqnum);
+int mnl_nft_rule_batch_del(struct nft_rule *nlr, unsigned int flags,
+ uint32_t seqnum);
+
int mnl_nft_rule_add(struct mnl_socket *nf_sock, struct nft_rule *r,
unsigned int flags);
int mnl_nft_rule_delete(struct mnl_socket *nf_sock, struct nft_rule *r,
diff --git a/include/netlink.h b/include/netlink.h
index bdff7f44..85e84343 100644
--- a/include/netlink.h
+++ b/include/netlink.h
@@ -19,12 +19,14 @@
* @list: list of parsed rules/chains/tables
* @set: current set
* @data: pointer to pass data to callback
+ * @seqnum: sequence number
*/
struct netlink_ctx {
struct list_head *msgs;
struct list_head list;
struct set *set;
const void *data;
+ uint32_t seqnum;
};
extern struct nft_table *alloc_nft_table(const struct handle *h);
@@ -69,6 +71,14 @@ extern int netlink_add_rule(struct netlink_ctx *ctx, const struct handle *h,
const struct rule *rule, uint32_t flags);
extern int netlink_delete_rule(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
+extern int netlink_add_rule_list(struct netlink_ctx *ctx, const struct handle *h,
+ struct list_head *rule_list);
+extern int netlink_add_rule_batch(struct netlink_ctx *ctx,
+ const struct handle *h,
+ const struct rule *rule, uint32_t flags);
+extern int netlink_del_rule_batch(struct netlink_ctx *ctx,
+ const struct handle *h,
+ const struct location *loc);
extern int netlink_add_chain(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc,
@@ -122,4 +132,8 @@ extern void netlink_dump_rule(struct nft_rule *nlr);
extern void netlink_dump_expr(struct nft_rule_expr *nle);
extern void netlink_dump_set(struct nft_set *nls);
+extern int netlink_batch_send(struct list_head *err_list);
+extern int netlink_io_error(struct netlink_ctx *ctx,
+ const struct location *loc, const char *fmt, ...);
+
#endif /* NFTABLES_NETLINK_H */
diff --git a/include/rule.h b/include/rule.h
index 10cfebde..6ad8af3b 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -244,6 +244,7 @@ enum cmd_obj {
* @op: operation
* @obj: object type to perform operation on
* @handle: handle for operations working without full objects
+ * @seqnum: sequence number to match netlink errors
* @union: object
* @arg: argument data
*/
@@ -253,6 +254,7 @@ struct cmd {
enum cmd_ops op;
enum cmd_obj obj;
struct handle handle;
+ uint32_t seqnum;
union {
void *data;
struct expr *expr;