Fixup build so that the update from nefilter.org to 1.4.20 works


* Keep the generated files needed for building.
Used
  ./configure --enable-static --disable-shared
  make
* Update the various Android *.mk files.


Change-Id: If0e45cf6289f0e3dcf3adf73e6ccff86d640f1c0
Signed-off-by: JP Abgrall <jpa@google.com>
diff --git a/.gitignore b/.gitignore
index b734ea9..80eeb98 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,9 +15,6 @@
 /extensions/matches?.man
 /extensions/targets?.man
 
-/include/xtables-version.h
-/include/iptables/internal.h
-
 /aclocal.m4
 /autom4te.cache/
 /build-aux/
diff --git a/config.h b/config.h
new file mode 100644
index 0000000..1b4079d
--- /dev/null
+++ b/config.h
@@ -0,0 +1,84 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `pcap' library (-lpcap). */
+/* #undef HAVE_LIBPCAP */
+
+/* Define to 1 if you have the <linux/dccp.h> header file. */
+#define HAVE_LINUX_DCCP_H 1
+
+/* Define to 1 if you have the <linux/ip_vs.h> header file. */
+#define HAVE_LINUX_IP_VS_H 1
+
+/* Define to 1 if you have the <linux/magic.h> header file. */
+#define HAVE_LINUX_MAGIC_H 1
+
+/* Define to 1 if you have the <linux/proc_fs.h> header file. */
+/* #undef HAVE_LINUX_PROC_FS_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "iptables"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "iptables"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "iptables 1.4.20"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "iptables"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.4.20"
+
+/* The size of `struct ip6_hdr', as computed by sizeof. */
+#define SIZEOF_STRUCT_IP6_HDR 40
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.4.20"
diff --git a/extensions/Android.mk b/extensions/Android.mk
index 3db8008..e60a482 100644
--- a/extensions/Android.mk
+++ b/extensions/Android.mk
@@ -4,7 +4,7 @@
 
 MY_srcdir:=$(LOCAL_PATH)
 # Exclude some modules that are problematic to compile (types/header).
-MY_excluded_modules:=TCPOPTSTRIP
+MY_excluded_modules:=TCPOPTSTRIP connlabel
 
 MY_pfx_build_mod := $(patsubst ${MY_srcdir}/libxt_%.c,%,$(wildcard ${MY_srcdir}/libxt_*.c))
 MY_pf4_build_mod := $(patsubst ${MY_srcdir}/libipt_%.c,%,$(wildcard ${MY_srcdir}/libipt_*.c))
diff --git a/extensions/libext.mk b/extensions/libext.mk
index 1255ed0..7aba36a 100644
--- a/extensions/libext.mk
+++ b/extensions/libext.mk
@@ -11,6 +11,7 @@
 # LOCAL_PATH needed because of dirty #include "blabla.c"
 LOCAL_C_INCLUDES:= \
 	$(LOCAL_PATH)/../include/ \
+	$(LOCAL_PATH)/.. \
 	$(MY_gen) \
 	$(LOCAL_PATH)
 
@@ -18,6 +19,7 @@
 # The $* does not work as expected. It ends up empty. Even with SECONDEXPANSION.
 # LOCAL_CFLAGS+=-D_INIT=lib$*_init
 LOCAL_CFLAGS+=-DXTABLES_INTERNAL
+LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
 # Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
 LOCAL_CFLAGS+=-D__ANDROID__
 LOCAL_CFLAGS += $(MY_warnings)
diff --git a/include/iptables/internal.h b/include/iptables/internal.h
index 8d8f023..82b4c36 100644
--- a/include/iptables/internal.h
+++ b/include/iptables/internal.h
@@ -1,7 +1,7 @@
 #ifndef IPTABLES_INTERNAL_H
 #define IPTABLES_INTERNAL_H 1
 
-#define IPTABLES_VERSION "1.4.11.1"
+#define IPTABLES_VERSION "1.4.20"
 
 /**
  * Program's own name and version.
diff --git a/include/xtables-version.h b/include/xtables-version.h
new file mode 100644
index 0000000..6532765
--- /dev/null
+++ b/include/xtables-version.h
@@ -0,0 +1,2 @@
+#define XTABLES_VERSION "libxtables.so.10"
+#define XTABLES_VERSION_CODE 10
diff --git a/iptables/Android.mk b/iptables/Android.mk
index 736c59a..7fb2e3b 100644
--- a/iptables/Android.mk
+++ b/iptables/Android.mk
@@ -1,29 +1,6 @@
 LOCAL_PATH:= $(call my-dir)
 My_intermediaries := $(call local-intermediates-dir)
 #----------------------------------------------------------------
-# libxtables
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES:= \
-	$(LOCAL_PATH)/../include/ \
-
-LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1
-LOCAL_CFLAGS+=-DXTABLES_INTERNAL
-LOCAL_CFLAGS+=-DXTABLES_LIBDIR=\"xtables_libdir_not_used\"
-# Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
-LOCAL_CFLAGS+=-D__ANDROID__
-LOCAL_CFLAGS += -Wno-sign-compare -Wno-pointer-arith -Wno-type-limits -Wno-missing-field-initializers -Wno-unused-parameter -Wno-clobbered
-
-LOCAL_LDFLAGS:=-version-info 6:0:0
-LOCAL_SRC_FILES:= \
-	xtables.c xtoptions.c
-
-LOCAL_MODULE:=libxtables
-
-include $(BUILD_STATIC_LIBRARY)
-
-#----------------------------------------------------------------
 # iptables
 
 
@@ -35,12 +12,15 @@
 LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1
 LOCAL_CFLAGS+=-DALL_INCLUSIVE
 LOCAL_CFLAGS+=-DXTABLES_INTERNAL
+LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4
 # Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
 LOCAL_CFLAGS+=-D__ANDROID__
 LOCAL_CFLAGS += -Wno-sign-compare -Wno-pointer-arith
 
 LOCAL_SRC_FILES:= \
-	iptables-standalone.c iptables.c xshared.c
+	xtables-multi.c iptables-xml.c xshared.c \
+	iptables-save.c iptables-restore.c \
+	iptables-standalone.c iptables.c
 
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE:=iptables
@@ -63,12 +43,15 @@
 LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1
 LOCAL_CFLAGS+=-DALL_INCLUSIVE
 LOCAL_CFLAGS+=-DXTABLES_INTERNAL
+LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV6
 # Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
 LOCAL_CFLAGS+=-D__ANDROID__
-LOCAL_CFLAGS += -Wno-pointer-arith -Wno-sign-compare
+LOCAL_CFLAGS += -Wno-sign-compare -Wno-pointer-arith
 
 LOCAL_SRC_FILES:= \
-	ip6tables-standalone.c ip6tables.c xshared.c
+	xtables-multi.c iptables-xml.c xshared.c \
+	ip6tables-save.c ip6tables-restore.c \
+	ip6tables-standalone.c ip6tables.c
 
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE:=ip6tables
diff --git a/libiptc/Android.mk b/libiptc/Android.mk
index e46ecba..2041a99 100644
--- a/libiptc/Android.mk
+++ b/libiptc/Android.mk
@@ -10,12 +10,14 @@
 
 # Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
 LOCAL_CFLAGS:=-D__ANDROID__
+LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
 LOCAL_CFLAGS += -Wno-pointer-arith -Wno-unused-parameter -Wno-sign-compare -Wno-pointer-sign
 
 LOCAL_SRC_FILES:= \
 	libip4tc.c \
 
 
+LOCAL_LDFLAGS:=-version-info 1:0:1
 LOCAL_MODULE_TAGS:=
 LOCAL_MODULE:=libip4tc
 
@@ -32,12 +34,14 @@
 
 # Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
 LOCAL_CFLAGS:=-D__ANDROID__
+LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
 LOCAL_CFLAGS += -Wno-pointer-arith -Wno-unused-parameter -Wno-sign-compare -Wno-pointer-sign
 
 LOCAL_SRC_FILES:= \
 	libip6tc.c \
 
 
+LOCAL_LDFLAGS:=-version-info 1:0:1
 LOCAL_MODULE_TAGS:=
 LOCAL_MODULE:=libip6tc
 
diff --git a/libxtables/Android.mk b/libxtables/Android.mk
new file mode 100644
index 0000000..f592f65
--- /dev/null
+++ b/libxtables/Android.mk
@@ -0,0 +1,28 @@
+LOCAL_PATH:= $(call my-dir)
+My_intermediaries := $(call local-intermediates-dir)
+#----------------------------------------------------------------
+# libxtables
+
+include $(CLEAR_VARS)
+
+LOCAL_C_INCLUDES:= \
+	$(LOCAL_PATH)/../include/ \
+	$(LOCAL_PATH)/../iptables/ \
+	$(LOCAL_PATH)/.. \
+
+LOCAL_CFLAGS:=-DNO_SHARED_LIBS=1
+LOCAL_CFLAGS+=-DXTABLES_INTERNAL
+LOCAL_CFLAGS+=-DXTABLES_LIBDIR=\"xtables_libdir_not_used\"
+LOCAL_CFLAGS+=-D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DENABLE_IPV4 -DENABLE_IPV6
+# Accommodate arm-eabi-4.4.3 tools that don't set __ANDROID__
+LOCAL_CFLAGS+=-D__ANDROID__
+LOCAL_CFLAGS += -Wno-sign-compare -Wno-pointer-arith -Wno-type-limits -Wno-missing-field-initializers -Wno-unused-parameter -Wno-clobbered
+
+LOCAL_LDFLAGS:=-version-info 10:0:0
+LOCAL_SRC_FILES:= \
+	xtables.c xtoptions.c
+
+LOCAL_MODULE:=libxtables
+
+include $(BUILD_STATIC_LIBRARY)
+