update to the latest imq patch for 2.6.23 from http://www.actusa.net/~linuximq/

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10145 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Tim Yardley 2008-01-08 18:21:22 +00:00
parent 08ac621e6f
commit f64edbd3eb
1 changed files with 79 additions and 108 deletions

View File

@ -1,8 +1,7 @@
Index: linux-2.6.23/drivers/net/imq.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23/drivers/net/imq.c 2007-10-10 13:52:54.000000000 +0800
@@ -0,0 +1,402 @@
diff -Naurw linux-2.6.23/drivers/net/imq.c linux-2.6.23.imq/drivers/net/imq.c
--- linux-2.6.23/drivers/net/imq.c 1969-12-31 21:00:00.000000000 -0300
+++ linux-2.6.23.imq/drivers/net/imq.c 2007-10-01 09:59:23.000000000 -0300
@@ -0,0 +1,400 @@
+/*
+ * Pseudo-driver for the intermediate queue device.
+ *
@ -126,7 +125,7 @@ Index: linux-2.6.23/drivers/net/imq.c
+#if defined(CONFIG_IMQ_NUM_DEVS)
+static unsigned int numdevs = CONFIG_IMQ_NUM_DEVS;
+#else
+static unsigned int numdevs = 2;
+static unsigned int numdevs = 16;
+#endif
+
+static struct net_device *imq_devs;
@ -278,27 +277,26 @@ Index: linux-2.6.23/drivers/net/imq.c
+
+static void __exit imq_unhook(void)
+{
+ nf_unregister_hook(&imq_ingress_ipv4);
+ nf_unregister_hook(&imq_egress_ipv4);
+ nf_unregister_queue_handler(PF_INET, &nfqh);
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+ nf_unregister_hook(&imq_ingress_ipv6);
+ nf_unregister_hook(&imq_egress_ipv6);
+ nf_unregister_queue_handler(PF_INET6, &nfqh);
+#endif
+ nf_unregister_hook(&imq_ingress_ipv4);
+ nf_unregister_hook(&imq_egress_ipv4);
+ nf_unregister_queue_handler(PF_INET, &nfqh);
+}
+
+static int __init imq_dev_init(struct net_device *dev)
+{
+ dev->hard_start_xmit = imq_dev_xmit;
+ dev->type = ARPHRD_VOID;
+ dev->mtu = 1500;
+ dev->tx_queue_len = 30;
+ dev->mtu = 16000;
+ dev->tx_queue_len = 11000;
+ dev->flags = IFF_NOARP;
+ dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
+ dev->priv = kzalloc(sizeof(struct net_device_stats), GFP_KERNEL);
+ if (dev->priv == NULL)
+ return -ENOMEM;
+ memset(dev->priv, 0, sizeof(struct net_device_stats));
+ dev->get_stats = imq_get_stats;
+
+ return 0;
@ -321,10 +319,9 @@ Index: linux-2.6.23/drivers/net/imq.c
+ return -EINVAL;
+ }
+
+ imq_devs = kmalloc(sizeof(struct net_device) * numdevs, GFP_KERNEL);
+ imq_devs = kzalloc(sizeof(struct net_device) * numdevs, GFP_KERNEL);
+ if (!imq_devs)
+ return -ENOMEM;
+ memset(imq_devs, 0, sizeof(struct net_device) * numdevs);
+
+ /* we start counting at zero */
+ numdevs--;
@ -400,15 +397,14 @@ Index: linux-2.6.23/drivers/net/imq.c
+module_init(imq_init_module);
+module_exit(imq_cleanup_module);
+
+module_param(numdevs, int, 0);
+module_param(numdevs, int, 16);
+MODULE_PARM_DESC(numdevs, "number of IMQ devices (how many imq* devices will be created)");
+MODULE_AUTHOR("http://www.linuximq.net");
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
+MODULE_LICENSE("GPL");
Index: linux-2.6.23/drivers/net/Kconfig
===================================================================
--- linux-2.6.23.orig/drivers/net/Kconfig 2007-10-10 04:31:38.000000000 +0800
+++ linux-2.6.23/drivers/net/Kconfig 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/drivers/net/Kconfig linux-2.6.23.imq/drivers/net/Kconfig
--- linux-2.6.23/drivers/net/Kconfig 2007-10-01 09:04:50.000000000 -0300
+++ linux-2.6.23.imq/drivers/net/Kconfig 2007-10-01 09:55:14.000000000 -0300
@@ -112,6 +112,129 @@
To compile this driver as a module, choose M here: the module
will be called eql. If unsure, say N.
@ -432,7 +428,7 @@ Index: linux-2.6.23/drivers/net/Kconfig
+choice
+ prompt "IMQ behavior (PRE/POSTROUTING)"
+ depends on IMQ
+ default IMQ_BEHAVIOR_BA
+ default IMQ_BEHAVIOR_AB
+ help
+
+ This settings defines how IMQ behaves in respect to its
@ -522,15 +518,15 @@ Index: linux-2.6.23/drivers/net/Kconfig
+config IMQ_NUM_DEVS
+
+ int "Number of IMQ devices"
+ range 2 8
+ range 2 16
+ depends on IMQ
+ default "2"
+ default "16"
+ help
+
+ This settings defines how many IMQ devices will be
+ created.
+
+ The default value is 2.
+ The default value is 16.
+
+ More information can be found at: www.linuximq.net
+
@ -539,10 +535,9 @@ Index: linux-2.6.23/drivers/net/Kconfig
config TUN
tristate "Universal TUN/TAP device driver support"
select CRC32
Index: linux-2.6.23/drivers/net/Makefile
===================================================================
--- linux-2.6.23.orig/drivers/net/Makefile 2007-10-10 04:31:38.000000000 +0800
+++ linux-2.6.23/drivers/net/Makefile 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/drivers/net/Makefile linux-2.6.23.imq/drivers/net/Makefile
--- linux-2.6.23/drivers/net/Makefile 2007-10-01 09:04:50.000000000 -0300
+++ linux-2.6.23.imq/drivers/net/Makefile 2007-10-01 09:55:14.000000000 -0300
@@ -131,6 +131,7 @@
obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o
@ -551,10 +546,9 @@ Index: linux-2.6.23/drivers/net/Makefile
obj-$(CONFIG_IFB) += ifb.o
obj-$(CONFIG_MACVLAN) += macvlan.o
obj-$(CONFIG_DE600) += de600.o
Index: linux-2.6.23/include/linux/imq.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23/include/linux/imq.h 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/include/linux/imq.h linux-2.6.23.imq/include/linux/imq.h
--- linux-2.6.23/include/linux/imq.h 1969-12-31 21:00:00.000000000 -0300
+++ linux-2.6.23.imq/include/linux/imq.h 2007-10-01 09:55:14.000000000 -0300
@@ -0,0 +1,9 @@
+#ifndef _IMQ_H
+#define _IMQ_H
@ -565,10 +559,9 @@ Index: linux-2.6.23/include/linux/imq.h
+#define IMQ_F_ENQUEUE 0x80
+
+#endif /* _IMQ_H */
Index: linux-2.6.23/include/linux/netfilter_ipv4/ipt_IMQ.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23/include/linux/netfilter_ipv4/ipt_IMQ.h 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.6.23.imq/include/linux/netfilter_ipv4/ipt_IMQ.h
--- linux-2.6.23/include/linux/netfilter_ipv4/ipt_IMQ.h 1969-12-31 21:00:00.000000000 -0300
+++ linux-2.6.23.imq/include/linux/netfilter_ipv4/ipt_IMQ.h 2007-10-01 09:55:14.000000000 -0300
@@ -0,0 +1,8 @@
+#ifndef _IPT_IMQ_H
+#define _IPT_IMQ_H
@ -578,10 +571,9 @@ Index: linux-2.6.23/include/linux/netfilter_ipv4/ipt_IMQ.h
+};
+
+#endif /* _IPT_IMQ_H */
Index: linux-2.6.23/include/linux/netfilter_ipv6/ip6t_IMQ.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23/include/linux/netfilter_ipv6/ip6t_IMQ.h 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.6.23.imq/include/linux/netfilter_ipv6/ip6t_IMQ.h
--- linux-2.6.23/include/linux/netfilter_ipv6/ip6t_IMQ.h 1969-12-31 21:00:00.000000000 -0300
+++ linux-2.6.23.imq/include/linux/netfilter_ipv6/ip6t_IMQ.h 2007-10-01 09:55:14.000000000 -0300
@@ -0,0 +1,8 @@
+#ifndef _IP6T_IMQ_H
+#define _IP6T_IMQ_H
@ -591,10 +583,9 @@ Index: linux-2.6.23/include/linux/netfilter_ipv6/ip6t_IMQ.h
+};
+
+#endif /* _IP6T_IMQ_H */
Index: linux-2.6.23/include/linux/skbuff.h
===================================================================
--- linux-2.6.23.orig/include/linux/skbuff.h 2007-10-10 04:31:38.000000000 +0800
+++ linux-2.6.23/include/linux/skbuff.h 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/include/linux/skbuff.h linux-2.6.23.imq/include/linux/skbuff.h
--- linux-2.6.23/include/linux/skbuff.h 2007-10-01 09:05:08.000000000 -0300
+++ linux-2.6.23.imq/include/linux/skbuff.h 2007-10-01 09:55:14.000000000 -0300
@@ -296,6 +296,10 @@
struct nf_conntrack *nfct;
struct sk_buff *nfct_reasm;
@ -606,10 +597,20 @@ Index: linux-2.6.23/include/linux/skbuff.h
#ifdef CONFIG_BRIDGE_NETFILTER
struct nf_bridge_info *nf_bridge;
#endif
Index: linux-2.6.23/net/core/dev.c
===================================================================
--- linux-2.6.23.orig/net/core/dev.c 2007-10-10 04:31:38.000000000 +0800
+++ linux-2.6.23/net/core/dev.c 2007-10-10 13:52:54.000000000 +0800
@@ -1726,6 +1730,10 @@
dst->nfct_reasm = src->nfct_reasm;
nf_conntrack_get_reasm(src->nfct_reasm);
#endif
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ dst->imq_flags = src->imq_flags;
+ dst->nf_info = src->nf_info;
+#endif
#ifdef CONFIG_BRIDGE_NETFILTER
dst->nf_bridge = src->nf_bridge;
nf_bridge_get(src->nf_bridge);
diff -Naurw linux-2.6.23/net/core/dev.c linux-2.6.23.imq/net/core/dev.c
--- linux-2.6.23/net/core/dev.c 2007-10-01 09:05:10.000000000 -0300
+++ linux-2.6.23.imq/net/core/dev.c 2007-10-01 09:55:14.000000000 -0300
@@ -94,6 +94,9 @@
#include <linux/skbuff.h>
#include <net/sock.h>
@ -620,46 +621,22 @@ Index: linux-2.6.23/net/core/dev.c
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/stat.h>
@@ -1463,6 +1466,9 @@
@@ -1462,7 +1465,11 @@
int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
if (likely(!skb->next)) {
if (!list_empty(&ptype_all))
- if (!list_empty(&ptype_all))
+ if (!list_empty(&ptype_all)
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ if (!(skb->imq_flags & IMQ_F_ENQUEUE))
+ && !(skb->imq_flags & IMQ_F_ENQUEUE)
+#endif
+ )
dev_queue_xmit_nit(skb, dev);
if (netif_needs_gso(dev, skb)) {
Index: linux-2.6.23/net/core/skbuff.c
===================================================================
--- linux-2.6.23.orig/net/core/skbuff.c 2007-10-10 04:31:38.000000000 +0800
+++ linux-2.6.23/net/core/skbuff.c 2007-10-10 13:52:54.000000000 +0800
@@ -421,6 +421,10 @@
C(ip_summed);
skb_copy_queue_mapping(n, skb);
C(priority);
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ C(imq_flags);
+ C(nf_info);
+#endif /*CONFIG_IMQ*/
#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
C(ipvs_property);
#endif
@@ -496,6 +500,10 @@
#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
new->ipvs_property = old->ipvs_property;
#endif
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ new->imq_flags = old->imq_flags;
+ new->nf_info = old->nf_info;
+#endif /*CONFIG_IMQ*/
#ifdef CONFIG_NET_SCHED
#ifdef CONFIG_NET_CLS_ACT
new->tc_verd = old->tc_verd;
Index: linux-2.6.23/net/ipv4/netfilter/ipt_IMQ.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23/net/ipv4/netfilter/ipt_IMQ.c 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/net/ipv4/netfilter/ipt_IMQ.c linux-2.6.23.imq/net/ipv4/netfilter/ipt_IMQ.c
--- linux-2.6.23/net/ipv4/netfilter/ipt_IMQ.c 1969-12-31 21:00:00.000000000 -0300
+++ linux-2.6.23.imq/net/ipv4/netfilter/ipt_IMQ.c 2007-10-01 09:55:14.000000000 -0300
@@ -0,0 +1,69 @@
+/*
+ * This target marks packets to be enqueued to an imq device
@ -730,11 +707,10 @@ Index: linux-2.6.23/net/ipv4/netfilter/ipt_IMQ.c
+MODULE_AUTHOR("http://www.linuximq.net");
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
+MODULE_LICENSE("GPL");
Index: linux-2.6.23/net/ipv4/netfilter/Kconfig
===================================================================
--- linux-2.6.23.orig/net/ipv4/netfilter/Kconfig 2007-10-10 13:52:53.000000000 +0800
+++ linux-2.6.23/net/ipv4/netfilter/Kconfig 2007-10-10 13:52:54.000000000 +0800
@@ -351,6 +351,17 @@
diff -Naurw linux-2.6.23/net/ipv4/netfilter/Kconfig linux-2.6.23.imq/net/ipv4/netfilter/Kconfig
--- linux-2.6.23/net/ipv4/netfilter/Kconfig 2007-10-01 09:05:12.000000000 -0300
+++ linux-2.6.23.imq/net/ipv4/netfilter/Kconfig 2007-10-01 09:55:14.000000000 -0300
@@ -311,6 +311,17 @@
To compile it as a module, choose M here. If unsure, say N.
@ -752,11 +728,10 @@ Index: linux-2.6.23/net/ipv4/netfilter/Kconfig
config IP_NF_TARGET_TOS
tristate "TOS target support"
depends on IP_NF_MANGLE
Index: linux-2.6.23/net/ipv4/netfilter/Makefile
===================================================================
--- linux-2.6.23.orig/net/ipv4/netfilter/Makefile 2007-10-10 13:52:53.000000000 +0800
+++ linux-2.6.23/net/ipv4/netfilter/Makefile 2007-10-10 13:52:54.000000000 +0800
@@ -58,6 +58,7 @@
diff -Naurw linux-2.6.23/net/ipv4/netfilter/Makefile linux-2.6.23.imq/net/ipv4/netfilter/Makefile
--- linux-2.6.23/net/ipv4/netfilter/Makefile 2007-10-01 09:03:13.000000000 -0300
+++ linux-2.6.23.imq/net/ipv4/netfilter/Makefile 2007-10-01 09:55:14.000000000 -0300
@@ -54,6 +54,7 @@
obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o
obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o
obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
@ -764,10 +739,9 @@ Index: linux-2.6.23/net/ipv4/netfilter/Makefile
obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
Index: linux-2.6.23/net/ipv6/netfilter/ip6t_IMQ.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23/net/ipv6/netfilter/ip6t_IMQ.c 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/net/ipv6/netfilter/ip6t_IMQ.c linux-2.6.23.imq/net/ipv6/netfilter/ip6t_IMQ.c
--- linux-2.6.23/net/ipv6/netfilter/ip6t_IMQ.c 1969-12-31 21:00:00.000000000 -0300
+++ linux-2.6.23.imq/net/ipv6/netfilter/ip6t_IMQ.c 2007-10-01 09:55:14.000000000 -0300
@@ -0,0 +1,69 @@
+/*
+ * This target marks packets to be enqueued to an imq device
@ -792,7 +766,7 @@ Index: linux-2.6.23/net/ipv6/netfilter/ip6t_IMQ.c
+ return XT_CONTINUE;
+}
+
+static int imq_checkentry(const char *tablename,
+static bool imq_checkentry(const char *tablename,
+ const void *entry,
+ const struct xt_target *target,
+ void *targinfo,
@ -838,10 +812,9 @@ Index: linux-2.6.23/net/ipv6/netfilter/ip6t_IMQ.c
+MODULE_AUTHOR("http://www.linuximq.net");
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
+MODULE_LICENSE("GPL");
Index: linux-2.6.23/net/ipv6/netfilter/Kconfig
===================================================================
--- linux-2.6.23.orig/net/ipv6/netfilter/Kconfig 2007-10-10 04:31:38.000000000 +0800
+++ linux-2.6.23/net/ipv6/netfilter/Kconfig 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/net/ipv6/netfilter/Kconfig linux-2.6.23.imq/net/ipv6/netfilter/Kconfig
--- linux-2.6.23/net/ipv6/netfilter/Kconfig 2007-10-01 09:03:12.000000000 -0300
+++ linux-2.6.23.imq/net/ipv6/netfilter/Kconfig 2007-10-01 09:55:14.000000000 -0300
@@ -173,6 +173,15 @@
To compile it as a module, choose M here. If unsure, say N.
@ -858,10 +831,9 @@ Index: linux-2.6.23/net/ipv6/netfilter/Kconfig
config IP6_NF_TARGET_HL
tristate 'HL (hoplimit) target support'
depends on IP6_NF_MANGLE
Index: linux-2.6.23/net/ipv6/netfilter/Makefile
===================================================================
--- linux-2.6.23.orig/net/ipv6/netfilter/Makefile 2007-10-10 04:31:38.000000000 +0800
+++ linux-2.6.23/net/ipv6/netfilter/Makefile 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/net/ipv6/netfilter/Makefile linux-2.6.23.imq/net/ipv6/netfilter/Makefile
--- linux-2.6.23/net/ipv6/netfilter/Makefile 2007-10-01 09:03:12.000000000 -0300
+++ linux-2.6.23.imq/net/ipv6/netfilter/Makefile 2007-10-01 09:55:14.000000000 -0300
@@ -13,6 +13,7 @@
obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o
obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
@ -870,10 +842,9 @@ Index: linux-2.6.23/net/ipv6/netfilter/Makefile
obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o
obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
Index: linux-2.6.23/net/sched/sch_generic.c
===================================================================
--- linux-2.6.23.orig/net/sched/sch_generic.c 2007-10-10 04:31:38.000000000 +0800
+++ linux-2.6.23/net/sched/sch_generic.c 2007-10-10 13:52:54.000000000 +0800
diff -Naurw linux-2.6.23/net/sched/sch_generic.c linux-2.6.23.imq/net/sched/sch_generic.c
--- linux-2.6.23/net/sched/sch_generic.c 2007-10-01 09:05:14.000000000 -0300
+++ linux-2.6.23.imq/net/sched/sch_generic.c 2007-10-01 09:55:14.000000000 -0300
@@ -190,6 +190,11 @@
return ret;
}