#
-# Copyright (C) 2009-2012 OpenWrt.org
+# Copyright (C) 2009-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=xtables-addons
ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,3.7.0)),1)
-PKG_VERSION:=2.0
+PKG_VERSION:=2.1
PKG_RELEASE:=1
-PKG_MD5SUM:=26b1b1dbb4a8faff24597723ebde04c9
+PKG_MD5SUM:=b624fc57bbda9e15c33a6471e4ec75e1
else
PKG_VERSION:=1.45
PKG_RELEASE:=3
--- a/configure
+++ b/configure
-@@ -11780,7 +11780,7 @@ regular_CFLAGS="-Wall -Waggregate-return
+@@ -11892,7 +11892,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; }
+module_exit(fini);
--- a/extensions/Kbuild
+++ b/extensions/Kbuild
-@@ -35,6 +35,7 @@ obj-${build_lscan} += xt_lscan.o
+@@ -33,6 +33,7 @@ obj-${build_lscan} += xt_lscan.o
obj-${build_pknock} += pknock/
obj-${build_psd} += xt_psd.o
obj-${build_quota2} += xt_quota2.o
-include ${M}/Kbuild.*
--- a/mconfig
+++ b/mconfig
-@@ -26,3 +26,4 @@ build_lscan=m
+@@ -24,3 +24,4 @@ build_lscan=m
build_pknock=m
build_psd=m
build_quota2=m
---- xtables-addons-2.0/extensions/rtsp/nf_conntrack_rtsp.c~ 2012-12-20 00:08:48.000000000 +0000
-+++ xtables-addons-2.0/extensions/rtsp/nf_conntrack_rtsp.c 2012-12-20 00:19:14.065730169 +0000
+--- a/extensions/rtsp/nf_conntrack_rtsp.c
++++ b/extensions/rtsp/nf_conntrack_rtsp.c
@@ -73,7 +73,7 @@ static DEFINE_SPINLOCK(rtsp_buffer_lock)
static struct nf_conntrack_expect_policy rtsp_exp_policy;
break;
case IP_CT_DIR_REPLY:
pr_debug("IP_CT_DIR_REPLY\n");
---- xtables-addons-2.0/extensions/rtsp/nf_conntrack_rtsp.h~ 2012-12-20 00:08:48.000000000 +0000
-+++ xtables-addons-2.0/extensions/rtsp/nf_conntrack_rtsp.h 2012-12-20 00:16:50.868733345 +0000
+--- a/extensions/rtsp/nf_conntrack_rtsp.h
++++ b/extensions/rtsp/nf_conntrack_rtsp.h
@@ -50,6 +50,7 @@ struct ip_ct_rtsp_expect
extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
unsigned int matchoff, unsigned int matchlen,
struct ip_ct_rtsp_expect *prtspexp,
struct nf_conntrack_expect *exp);
---- xtables-addons-2.0/extensions/rtsp/nf_nat_rtsp.c~ 2012-12-20 00:08:48.000000000 +0000
-+++ xtables-addons-2.0/extensions/rtsp/nf_nat_rtsp.c 2012-12-20 00:29:32.311738640 +0000
-@@ -33,10 +33,10 @@
+--- a/extensions/rtsp/nf_nat_rtsp.c
++++ b/extensions/rtsp/nf_nat_rtsp.c
+@@ -32,10 +32,10 @@
#include <linux/module.h>
#include <net/tcp.h>
#include <linux/inet.h>
#include <linux/ctype.h>
-@@ -105,8 +103,8 @@ get_skb_tcpdata(struct sk_buff* skb, cha
+@@ -102,8 +102,8 @@ get_skb_tcpdata(struct sk_buff* skb, cha
static int
rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
struct nf_conntrack_expect* exp,
{
char* ptcp;
uint tcplen;
-@@ -259,7 +257,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;
off, diff, NULL, 0))
{
/* mangle failed, all we can do is bail */
-@@ -329,7 +327,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;
origoff, origlen, rbuf, rbuflen))
{
/* mangle failed, all we can do is bail */
-@@ -354,7 +352,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
+@@ -351,7 +351,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
}
static uint
unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp,
struct nf_conntrack_expect* exp)
{
-@@ -392,7 +390,7 @@ help_out(struct sk_buff *skb, enum ip_co
+@@ -389,7 +389,7 @@ help_out(struct sk_buff *skb, enum ip_co
{
uint oldtcplen = tcplen;
pr_debug("hdr: Transport\n");
{
pr_debug("hdr: Transport mangle failed");
break;
-@@ -410,7 +408,7 @@ help_out(struct sk_buff *skb, enum ip_co
+@@ -407,7 +407,7 @@ help_out(struct sk_buff *skb, enum ip_co
}
static unsigned int
unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp,
struct nf_conntrack_expect* exp)
{
-@@ -420,7 +418,7 @@ help(struct sk_buff *skb, enum ip_conntr
+@@ -417,7 +417,7 @@ help(struct sk_buff *skb, enum ip_conntr
switch (dir)
{
case IP_CT_DIR_ORIGINAL:
break;
case IP_CT_DIR_REPLY:
pr_debug("unmangle ! %u\n", ctinfo);
-@@ -435,7 +433,7 @@ help(struct sk_buff *skb, enum ip_conntr
+@@ -432,7 +432,7 @@ help(struct sk_buff *skb, enum ip_conntr
static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp)
{
u_int32_t newdstip, newsrcip, newip;
struct nf_conn *master = ct->master;
-@@ -449,12 +447,13 @@ static void expected(struct nf_conn* ct,
+@@ -446,12 +446,13 @@ static void expected(struct nf_conn* ct,
pr_debug("newsrcip=%pI4, newdstip=%pI4, newip=%pI4\n",
&newsrcip, &newdstip, &newip);
+++ /dev/null
---- xtables-addons-2.0/extensions/xt_DNETMAP.c~ 2012-11-12 18:03:51.000000000 +0000
-+++ xtables-addons-2.0/extensions/xt_DNETMAP.c 2012-12-20 00:06:10.656675731 +0000
-@@ -27,7 +27,7 @@
- #include <linux/netfilter_ipv4.h>
- #include <linux/netfilter/x_tables.h>
- #include <linux/version.h>
--#include <net/netfilter/nf_nat_rule.h>
-+#include <net/netfilter/nf_nat.h>
- #include <net/net_namespace.h>
- #include <net/netns/generic.h>
- #include <linux/netfilter/nf_nat.h>
---- xtables-addons-2.0/mconfig 2012-12-20 00:55:11.445085492 +0000
-+++ xtables-addons-2.0/mconfig~ 2012-12-20 00:54:29.000000000 +0000
-@@ -4,7 +4,7 @@ build_ACCOUNT=m
- build_CHAOS=m
- build_DELUDE=m
- build_DHCPMAC=m
--build_DNETMAP=
-+build_DNETMAP=m
- build_ECHO=m
- build_IPMARK=m
- build_LOGMARK=m
+
--- a/extensions/Kbuild
+++ b/extensions/Kbuild
-@@ -36,6 +36,7 @@ obj-${build_pknock} += pknock/
+@@ -34,6 +34,7 @@ obj-${build_pknock} += pknock/
obj-${build_psd} += xt_psd.o
obj-${build_quota2} += xt_quota2.o
obj-${build_rtsp} += rtsp/
-include ${M}/Kbuild.*
--- a/extensions/Mbuild
+++ b/extensions/Mbuild
-@@ -26,3 +26,4 @@ obj-${build_pknock} += pknock/
+@@ -24,3 +24,4 @@ obj-${build_pknock} += pknock/
obj-${build_psd} += libxt_psd.so
obj-${build_quota2} += libxt_quota2.so
obj-${build_gradm} += libxt_gradm.so
+obj-${build_LUA} += LUA/
--- a/mconfig
+++ b/mconfig
-@@ -27,3 +27,4 @@ build_pknock=m
+@@ -25,3 +25,4 @@ build_pknock=m
build_psd=m
build_quota2=m
build_rtsp=m
--- /dev/null
+--- 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) make_kuid(current_user_ns(), x)
++# define XT_GID(x) make_kgid(current_user_ns(), 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;