#define _NFTABLES_MNL_H_
#include <list.h>
+#include <netlink.h>
struct mnl_socket;
void mnl_batch_reset(struct nftnl_batch *batch);
uint32_t mnl_batch_begin(struct nftnl_batch *batch);
void mnl_batch_end(struct nftnl_batch *batch);
-int mnl_batch_talk(struct mnl_socket *nl, struct nftnl_batch *batch,
- struct list_head *err_list);
+int mnl_batch_talk(struct netlink_ctx *ctx, struct list_head *err_list);
int mnl_nft_rule_batch_add(struct nftnl_rule *nlr, struct nftnl_batch *batch,
unsigned int flags, uint32_t seqnum);
int mnl_nft_rule_batch_del(struct nftnl_rule *nlr, struct nftnl_batch *batch,
return sendmsg(mnl_socket_get_fd(nl), &msg, 0);
}
-int mnl_batch_talk(struct mnl_socket *nl, struct nftnl_batch *batch,
- struct list_head *err_list)
+int mnl_batch_talk(struct netlink_ctx *ctx, struct list_head *err_list)
{
+ struct mnl_socket *nl = ctx->nf_sock;
int ret, fd = mnl_socket_get_fd(nl), portid = mnl_socket_get_portid(nl);
char rcv_buf[MNL_SOCKET_BUFFER_SIZE];
fd_set readfds;
.tv_usec = 0
};
- ret = mnl_nft_socket_sendmsg(nl, batch);
+ ret = mnl_nft_socket_sendmsg(nl, ctx->batch);
if (ret == -1)
return -1;
int netlink_batch_send(struct netlink_ctx *ctx, struct list_head *err_list)
{
- return mnl_batch_talk(ctx->nf_sock, ctx->batch, err_list);
+ return mnl_batch_talk(ctx, err_list);
}
int netlink_flush_ruleset(struct netlink_ctx *ctx, const struct handle *h,