nftables: bump to latest, fix minigmp

Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 43013
This commit is contained in:
Steven Barth 2014-10-21 20:00:56 +00:00
parent 0b3fec7e80
commit 71d05d211d
4 changed files with 9 additions and 82 deletions

View file

@ -7,15 +7,16 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=nftables PKG_NAME:=nftables
PKG_VERSION:=0.3+2014-09-30 PKG_VERSION:=0.3+2014-10-21
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=git://git.netfilter.org/nftables PKG_SOURCE_URL:=git://git.netfilter.org/nftables
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=36c8a131af6217579da582bc320e16171df0f3af PKG_SOURCE_VERSION:=17b495957b29e699f59874d1ceca9535921b1a79
PKG_MAINTAINER:=Steven Barth <steven@midlink.org> PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
PKG_LICENSE:=GPL-2.0
PKG_FIXUP:=autoreconf PKG_FIXUP:=autoreconf
@ -24,7 +25,7 @@ include $(INCLUDE_DIR)/package.mk
CONFIGURE_ARGS += \ CONFIGURE_ARGS += \
--disable-debug \ --disable-debug \
--without-libgmp \ --without-libgmp \
--without-libreadline \ --without-cli \
define Package/nftables define Package/nftables
SECTION:=net SECTION:=net

View file

@ -1,63 +0,0 @@
From ace4c5eb69ee7dace955acdb23e30e8229b18619 Mon Sep 17 00:00:00 2001
From: Steven Barth <cyrus@openwrt.org>
Date: Wed, 1 Oct 2014 22:40:31 +0200
Subject: [PATCH 1/2] build: allow disabling libreadline-support
This makes nftables a bit more embedded-friendly.
Signed-off-by: Steven Barth <cyrus@openwrt.org>
---
configure.ac | 11 +++++++++--
src/Makefile.in | 2 ++
src/main.c | 6 ++++++
3 files changed, 17 insertions(+), 2 deletions(-)
--- a/configure.ac
+++ b/configure.ac
@@ -71,8 +71,15 @@ AC_CHECK_LIB([nftnl], [nft_rule_alloc],
AC_CHECK_LIB([gmp], [__gmpz_init], ,
AC_MSG_ERROR([No suitable version of libgmp found]))
-AC_CHECK_LIB([readline], [readline], ,
- AC_MSG_ERROR([No suitable version of libreadline found]))
+
+AC_ARG_WITH([libreadline], [AS_HELP_STRING([--without-libreadline],
+ [Disable libreadline support (no interactive CLI)])], [],
+ [with_libreadline=yes])
+AS_IF([test "x$with_libreadline" != xno], [
+AC_CHECK_LIB([readline],[readline], , AC_MSG_ERROR([No suitable version of libreadline found]))
+])
+AC_SUBST(with_libreadline)
+
# Checks for header files.
AC_HEADER_STDC
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -3,7 +3,9 @@ PROGRAMS += nft
nft-destdir := @sbindir@
nft-obj += main.o
+ifeq (@with_libreadline@,yes)
nft-obj += cli.o
+endif
nft-obj += rule.o
nft-obj += statement.o
nft-obj += datatype.o
--- a/src/main.c
+++ b/src/main.c
@@ -335,8 +335,14 @@ int main(int argc, char * const *argv)
if (scanner_read_file(scanner, filename, &internal_location) < 0)
goto out;
} else if (interactive) {
+#ifdef HAVE_LIBREADLINE
cli_init(&state);
return 0;
+#else
+ fprintf(stderr, "%s: interactive CLI not supported in this build\n",
+ argv[0]);
+ exit(NFT_EXIT_FAILURE);
+#endif
} else {
fprintf(stderr, "%s: no command specified\n", argv[0]);
exit(NFT_EXIT_FAILURE);

View file

@ -52,8 +52,8 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
+AC_MSG_ERROR([--without-libgmp MUST be used with --disable-debug]) +AC_MSG_ERROR([--without-libgmp MUST be used with --disable-debug])
+]) +])
AC_ARG_WITH([cli], [AS_HELP_STRING([--without-cli],
AC_ARG_WITH([libreadline], [AS_HELP_STRING([--without-libreadline], [disable interactive CLI (libreadline support)])],
--- /dev/null --- /dev/null
+++ b/include/bignum.h +++ b/include/bignum.h
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
@ -425,7 +425,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
+endif +endif
--- a/src/datatype.c --- a/src/datatype.c
+++ b/src/datatype.c +++ b/src/datatype.c
@@ -252,11 +252,9 @@ static struct error_record *integer_type @@ -267,11 +267,9 @@ static struct error_record *integer_type
struct expr **res) struct expr **res)
{ {
mpz_t v; mpz_t v;
@ -463,7 +463,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
const char *fmt, ...) const char *fmt, ...)
--- a/src/evaluate.c --- a/src/evaluate.c
+++ b/src/evaluate.c +++ b/src/evaluate.c
@@ -228,9 +228,13 @@ static int expr_evaluate_value(struct ev @@ -232,9 +232,13 @@ static int expr_evaluate_value(struct ev
case TYPE_INTEGER: case TYPE_INTEGER:
mpz_init_bitmask(mask, ctx->ectx.len); mpz_init_bitmask(mask, ctx->ectx.len);
if (mpz_cmp((*expr)->value, mask) > 0) { if (mpz_cmp((*expr)->value, mask) > 0) {
@ -535,7 +535,7 @@ Signed-off-by: Steven Barth <cyrus@openwrt.org>
+ return -1; + return -1;
+ +
+ len = mpz_sizeinbase(value, base); + len = mpz_sizeinbase(value, base);
+ while (--prec >= len) { + while (prec-- > len) {
+ if (fputc('0', stdout) != '0') + if (fputc('0', stdout) != '0')
+ return -1; + return -1;
+ +

View file

@ -1,11 +0,0 @@
--- a/configure.ac
+++ b/configure.ac
@@ -94,7 +94,7 @@ AC_SUBST(with_libreadline)
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_ASSERT
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h malloc.h \
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h malloc.h \
netdb.h netinet/in.h netinet/ip.h netinet/ip6.h \
netinet/tcp.h netinet/udp.h netinet/ip_icmp.h \
stddef.h stdint.h stdlib.h string.h unistd.h], ,