diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/mnl.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index b38295f2..b91bbac1 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ(2.61) AC_COPYRIGHT([Copyright (c) 2008 Patrick McHardy <kaber@trash.net>]) -AC_INIT([nftables], [0.099], [netfilter-devel@vger.kernel.org]) +AC_INIT([nftables], [0.100], [netfilter-devel@vger.kernel.org]) AC_DEFINE([RELEASE_NAME], ["keith-alexander-filter"], [Release name]) AC_CONFIG_SRCDIR([src/rule.c]) @@ -53,7 +53,7 @@ fi AC_CHECK_LIB([mnl], [mnl_socket_open], , AC_MSG_ERROR([No suitable version of libmnl found])) -AC_CHECK_LIB([nftables], [nft_rule_alloc], , +AC_CHECK_LIB([nftnl], [nft_rule_alloc], , AC_MSG_ERROR([No suitable version of libnftnl found])) AC_CHECK_LIB([gmp], [__gmpz_init], , @@ -21,6 +21,7 @@ #include <linux/netfilter/nf_tables.h> #include <mnl.h> +#include <string.h> #include <errno.h> #include <utils.h> #include <nftables.h> @@ -100,12 +101,21 @@ struct batch_page { static void mnl_batch_page_add(void) { struct batch_page *batch_page; + struct nlmsghdr *last_nlh; + + /* Get the last message not fitting in the batch */ + last_nlh = mnl_nlmsg_batch_current(batch); batch_page = xmalloc(sizeof(struct batch_page)); batch_page->batch = batch; list_add_tail(&batch_page->head, &batch_page_list); batch_num_pages++; batch = mnl_batch_alloc(); + + /* Copy the last message not fitting to the new batch page */ + memcpy(mnl_nlmsg_batch_current(batch), last_nlh, last_nlh->nlmsg_len); + /* No overflow may happen as this is a new empty batch page */ + mnl_nlmsg_batch_next(batch); } static uint32_t mnl_batch_put(int type) |