From 4a0c312dc38f420c0470bdc94f8c2d654cfc2542 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Wed, 10 Jul 2013 14:51:13 +0000
Subject: [PATCH] xtables-addons: update to version 2.3, adds linux 3.10
 compatibility

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37226
---
 package/network/utils/xtables-addons/Makefile |  4 +-
 .../patches/001-no_depmod.patch               |  4 +-
 .../002-fix-kernel-version-detection.patch    |  2 +-
 .../patches/003-fix-kernel-3.9.patch          |  6 +-
 .../patches/102-rtsp-linux-3.7-compat.patch   |  6 +-
 .../patches/201-fix-lua-packetscript.patch    |  2 +-
 .../400-uid-gid-linux-3.7-compat.patch        | 83 -------------------
 7 files changed, 12 insertions(+), 95 deletions(-)
 delete mode 100644 package/network/utils/xtables-addons/patches/400-uid-gid-linux-3.7-compat.patch

diff --git a/package/network/utils/xtables-addons/Makefile b/package/network/utils/xtables-addons/Makefile
index 10bafd14e7..44cd272ea4 100644
--- a/package/network/utils/xtables-addons/Makefile
+++ b/package/network/utils/xtables-addons/Makefile
@@ -10,9 +10,9 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=xtables-addons
 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,3.7.0)),1)
-PKG_VERSION:=2.1
+PKG_VERSION:=2.3
 PKG_RELEASE:=1
-PKG_MD5SUM:=b624fc57bbda9e15c33a6471e4ec75e1
+PKG_MD5SUM:=7d942729c365a549513511061f74c3e3
 else
 PKG_VERSION:=1.45
 PKG_RELEASE:=3
diff --git a/package/network/utils/xtables-addons/patches/001-no_depmod.patch b/package/network/utils/xtables-addons/patches/001-no_depmod.patch
index 9905af172b..54d624ccd7 100644
--- a/package/network/utils/xtables-addons/patches/001-no_depmod.patch
+++ b/package/network/utils/xtables-addons/patches/001-no_depmod.patch
@@ -11,6 +11,6 @@
 -install-exec-hook:
 -	depmod -a || :;
 -
- config.status: Makefile.iptrules.in
+ clean-local-mans:
+ 	${MAKE} -f Makefile.mans clean;
  
- tmpdir := $(shell mktemp -dtu)
diff --git a/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch b/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch
index 8dc6384478..f7c877b44b 100644
--- a/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch
+++ b/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -11892,7 +11892,7 @@ regular_CFLAGS="-Wall -Waggregate-return
+@@ -11895,7 +11895,7 @@ regular_CFLAGS="-Wall -Waggregate-return
  if test -n "$kbuilddir"; then
  	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking kernel version that we will build against" >&5
  $as_echo_n "checking kernel version that we will build against... " >&6; }
diff --git a/package/network/utils/xtables-addons/patches/003-fix-kernel-3.9.patch b/package/network/utils/xtables-addons/patches/003-fix-kernel-3.9.patch
index e77e14d2e8..8eac698bfa 100644
--- a/package/network/utils/xtables-addons/patches/003-fix-kernel-3.9.patch
+++ b/package/network/utils/xtables-addons/patches/003-fix-kernel-3.9.patch
@@ -1,8 +1,8 @@
 --- a/extensions/compat_xtables.h
 +++ b/extensions/compat_xtables.h
-@@ -57,4 +57,11 @@
- 
- #define xt_request_find_match xtnu_request_find_match
+@@ -82,4 +82,11 @@ static inline void proc_remove(struct pr
+ }
+ #endif
  
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
 +static inline void proc_net_remove(struct net *net, const char *name)
diff --git a/package/network/utils/xtables-addons/patches/102-rtsp-linux-3.7-compat.patch b/package/network/utils/xtables-addons/patches/102-rtsp-linux-3.7-compat.patch
index 216d7cb784..0fe7917cff 100644
--- a/package/network/utils/xtables-addons/patches/102-rtsp-linux-3.7-compat.patch
+++ b/package/network/utils/xtables-addons/patches/102-rtsp-linux-3.7-compat.patch
@@ -72,7 +72,7 @@
  {
      char*       ptcp;
      uint        tcplen;
-@@ -256,7 +256,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
+@@ -256,7 +256,7 @@ rtsp_mangle_tran(enum ip_conntrack_info 
                  if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun))
                  {
                      diff = nextfieldoff-off;
@@ -81,7 +81,7 @@
                                                           off, diff, NULL, 0))
                      {
                          /* mangle failed, all we can do is bail */
-@@ -326,7 +326,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
+@@ -326,7 +326,7 @@ rtsp_mangle_tran(enum ip_conntrack_info 
                       * parameter 4 below is offset from start of tcp data.
                       */
                      diff = origlen-rbuflen;
@@ -90,7 +90,7 @@
                                                origoff, origlen, rbuf, rbuflen))
                      {
                          /* mangle failed, all we can do is bail */
-@@ -351,7 +351,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
+@@ -351,7 +351,7 @@ rtsp_mangle_tran(enum ip_conntrack_info 
  }
  
  static uint
diff --git a/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch b/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
index 06a4a1739a..966d29dfab 100644
--- a/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
+++ b/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
@@ -78,7 +78,7 @@
  #define UCHAR_MAX	255
  #define SHRT_MAX        32767
  #define BUFSIZ 		8192
-@@ -637,6 +641,8 @@ union luai_Cast { double l_d; long l_l;
+@@ -637,6 +641,8 @@ union luai_Cast { double l_d; long l_l; 
  */
  #if defined(__KERNEL__)
  #undef LUA_USE_ULONGJMP
diff --git a/package/network/utils/xtables-addons/patches/400-uid-gid-linux-3.7-compat.patch b/package/network/utils/xtables-addons/patches/400-uid-gid-linux-3.7-compat.patch
deleted file mode 100644
index 8a5be0d276..0000000000
--- a/package/network/utils/xtables-addons/patches/400-uid-gid-linux-3.7-compat.patch
+++ /dev/null
@@ -1,83 +0,0 @@
---- a/extensions/xt_DNETMAP.c
-+++ b/extensions/xt_DNETMAP.c
-@@ -21,6 +21,7 @@
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
- #include <linux/inet.h>
- #include <linux/ip.h>
-+#include <linux/version.h>
- #include <linux/module.h>
- #include <linux/netdevice.h>
- #include <linux/netfilter.h>
-@@ -328,8 +329,8 @@ static int dnetmap_tg_check(const struct
- 		ret = -ENOMEM;
- 		goto out;
- 	}
--	pde_data->uid = proc_uid;
--	pde_data->gid = proc_gid;
-+	pde_data->uid = XT_UID(proc_uid);
-+	pde_data->gid = XT_GID(proc_gid);
- 
- 	/* statistics */
- 	pde_stat = create_proc_entry(p->proc_str_stat, proc_perms,
-@@ -341,8 +342,8 @@ static int dnetmap_tg_check(const struct
- 	}
- 	pde_stat->data = p;
- 	pde_stat->read_proc = dnetmap_stat_proc_read;
--	pde_stat->uid = proc_uid;
--	pde_stat->gid = proc_gid;
-+	pde_stat->uid = XT_UID(proc_uid);
-+	pde_stat->gid = XT_GID(proc_gid);
- #endif
- 
- 	spin_lock_bh(&dnetmap_lock);
---- a/extensions/xt_condition.c
-+++ b/extensions/xt_condition.c
-@@ -14,6 +14,7 @@
-  */
- #include <linux/kernel.h>
- #include <linux/list.h>
-+#include <linux/version.h>
- #include <linux/module.h>
- #include <linux/proc_fs.h>
- #include <linux/spinlock.h>
-@@ -155,8 +156,8 @@ static int condition_mt_check(const stru
- 	var->status_proc->read_proc  = condition_proc_read;
- 	var->status_proc->write_proc = condition_proc_write;
- 	list_add(&var->list, &conditions_list);
--	var->status_proc->uid = condition_uid_perms;
--	var->status_proc->gid = condition_gid_perms;
-+	var->status_proc->uid = XT_UID(condition_uid_perms);
-+	var->status_proc->gid = XT_GID(condition_gid_perms);
- 	mutex_unlock(&proc_lock);
- 	info->condvar = var;
- 	return 0;
---- a/extensions/compat_xtables.h
-+++ b/extensions/compat_xtables.h
-@@ -12,6 +12,14 @@
- #	warning Kernels below 3.7 not supported.
- #endif
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
-+#  define XT_UID(x) KUIDT_INIT(x)
-+#  define XT_GID(x) KGIDT_INIT(x)
-+#else
-+#  define XT_UID(x) (x)
-+#  define XT_GID(x) (x)
-+#endif
-+
- #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
- #	if !defined(CONFIG_NF_CONNTRACK_MARK)
- #		warning You have CONFIG_NF_CONNTRACK enabled, but CONFIG_NF_CONNTRACK_MARK is not (please enable).
---- a/extensions/xt_quota2.c
-+++ b/extensions/xt_quota2.c
-@@ -131,8 +131,8 @@ q2_get_counter(const struct xt_quota_mti
- 	p->data         = e;
- 	p->read_proc    = quota_proc_read;
- 	p->write_proc   = quota_proc_write;
--	p->uid          = quota_list_uid;
--	p->gid          = quota_list_gid;
-+	p->uid          = XT_UID(quota_list_uid);
-+	p->gid          = XT_GID(quota_list_gid);
- 	list_add_tail(&e->list, &counter_list);
- 	spin_unlock_bh(&counter_list_lock);
- 	return e;
-- 
2.30.2