SOURCES: kernel-desktop-imq.patch - up to 2.6.21
czarny
czarny at pld-linux.org
Fri Aug 3 02:26:53 CEST 2007
Author: czarny Date: Fri Aug 3 00:26:53 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- up to 2.6.21
---- Files affected:
SOURCES:
kernel-desktop-imq.patch (1.3 -> 1.4)
---- Diffs:
================================================================
Index: SOURCES/kernel-desktop-imq.patch
diff -u SOURCES/kernel-desktop-imq.patch:1.3 SOURCES/kernel-desktop-imq.patch:1.4
--- SOURCES/kernel-desktop-imq.patch:1.3 Sun Nov 19 04:09:00 2006
+++ SOURCES/kernel-desktop-imq.patch Fri Aug 3 02:26:47 2007
@@ -1,151 +1,151 @@
-diff -Nru linux-2.6.17.orig/drivers/net/Kconfig linux-2.6.17/drivers/net/Kconfig
---- linux-2.6.17.orig/drivers/net/Kconfig 2006-06-18 01:49:35.000000000 +0000
-+++ linux-2.6.17/drivers/net/Kconfig 2006-09-06 20:58:51.000000000 +0000
-@@ -93,6 +93,129 @@
+diff -Nru linux-2.6.21.1-orig/drivers/net/Kconfig linux-2.6.21.1/drivers/net/Kconfig
+--- linux-2.6.21.1-orig/drivers/net/Kconfig 2007-04-27 21:49:26.000000000 +0000
++++ linux-2.6.21.1/drivers/net/Kconfig 2007-06-02 21:43:55.000000000 +0000
+@@ -96,6 +96,129 @@
To compile this driver as a module, choose M here: the module
will be called eql. If unsure, say N.
+config IMQ
-+ tristate "IMQ (intermediate queueing device) support"
-+ depends on NETDEVICES && NETFILTER
-+ ---help---
-+ The IMQ device(s) is used as placeholder for QoS queueing disciplines.
-+ Every packet entering/leaving the IP stack can be directed through
-+ the IMQ device where it's enqueued/dequeued to the attached qdisc.
-+ This allows you to treat network devices as classes and distribute
-+ bandwidth among them. Iptables is used to specify through which IMQ
-+ device, if any, packets travel.
++ tristate "IMQ (intermediate queueing device) support"
++ depends on NETDEVICES && NETFILTER
++ ---help---
++ The IMQ device(s) is used as placeholder for QoS queueing
++ disciplines. Every packet entering/leaving the IP stack can be
++ directed through the IMQ device where it's enqueued/dequeued to the
++ attached qdisc. This allows you to treat network devices as classes
++ and distribute bandwidth among them. Iptables is used to specify
++ through which IMQ device, if any, packets travel.
+
-+ More information at: http://www.linuximq.net/
++ More information at: http://www.linuximq.net/
+
-+ To compile this driver as a module, choose M here: the module
-+ will be called imq. If unsure, say N.
++ To compile this driver as a module, choose M here: the module
++ will be called imq. If unsure, say N.
+
+choice
-+ prompt "IMQ behavior (PRE/POSTROUTING)"
++ prompt "IMQ behavior (PRE/POSTROUTING)"
+ depends on IMQ
-+ default IMQ_BEHAVIOR_BA
-+ help
++ default IMQ_BEHAVIOR_BA
++ help
+
-+ This settings defines how IMQ behaves in respect to its
-+ hooking in PREROUTING and POSTROUTING.
++ This settings defines how IMQ behaves in respect to its
++ hooking in PREROUTING and POSTROUTING.
+
-+ IMQ can work in any of the following ways:
++ IMQ can work in any of the following ways:
+
-+ PREROUTING | POSTROUTING
-+ -----------------|-------------------
-+ #1 After NAT | After NAT
-+ #2 After NAT | Before NAT
-+ #3 Before NAT | After NAT
-+ #4 Before NAT | Before NAT
++ PREROUTING | POSTROUTING
++ -----------------|-------------------
++ #1 After NAT | After NAT
++ #2 After NAT | Before NAT
++ #3 Before NAT | After NAT
++ #4 Before NAT | Before NAT
+
-+ The default behavior is to hook before NAT on PREROUTING
-+ and after NAT on POSTROUTING (#3).
++ The default behavior is to hook before NAT on PREROUTING
++ and after NAT on POSTROUTING (#3).
+
-+ This settings are specially usefull when trying to use IMQ
-+ to shape NATed clients.
++ This settings are specially usefull when trying to use IMQ
++ to shape NATed clients.
+
-+ More information can be found at: www.linuximq.net
++ More information can be found at: www.linuximq.net
+
-+ If not sure leave the default settings alone.
++ If not sure leave the default settings alone.
+
+config IMQ_BEHAVIOR_AA
-+ bool "IMQ AA"
-+ help
-+ This settings defines how IMQ behaves in respect to its
-+ hooking in PREROUTING and POSTROUTING.
++ bool "IMQ AA"
++ help
++ This settings defines how IMQ behaves in respect to its
++ hooking in PREROUTING and POSTROUTING.
+
-+ Choosing this option will make IMQ hook like this:
++ Choosing this option will make IMQ hook like this:
+
-+ PREROUTING: After NAT
-+ POSTROUTING: After NAT
++ PREROUTING: After NAT
++ POSTROUTING: After NAT
+
-+ More information can be found at: www.linuximq.net
++ More information can be found at: www.linuximq.net
+
-+ If not sure leave the default settings alone.
++ If not sure leave the default settings alone.
+
+config IMQ_BEHAVIOR_AB
-+ bool "IMQ AB"
-+ help
-+ This settings defines how IMQ behaves in respect to its
-+ hooking in PREROUTING and POSTROUTING.
++ bool "IMQ AB"
++ help
++ This settings defines how IMQ behaves in respect to its
++ hooking in PREROUTING and POSTROUTING.
+
-+ Choosing this option will make IMQ hook like this:
++ Choosing this option will make IMQ hook like this:
+
-+ PREROUTING: After NAT
-+ POSTROUTING: Before NAT
++ PREROUTING: After NAT
++ POSTROUTING: Before NAT
+
-+ More information can be found at: www.linuximq.net
++ More information can be found at: www.linuximq.net
+
-+ If not sure leave the default settings alone.
++ If not sure leave the default settings alone.
+
+config IMQ_BEHAVIOR_BA
-+ bool "IMQ BA"
-+ help
-+ This settings defines how IMQ behaves in respect to its
-+ hooking in PREROUTING and POSTROUTING.
++ bool "IMQ BA"
++ help
++ This settings defines how IMQ behaves in respect to its
++ hooking in PREROUTING and POSTROUTING.
+
-+ Choosing this option will make IMQ hook like this:
++ Choosing this option will make IMQ hook like this:
+
-+ PREROUTING: Before NAT
-+ POSTROUTING: After NAT
++ PREROUTING: Before NAT
++ POSTROUTING: After NAT
+
-+ More information can be found at: www.linuximq.net
++ More information can be found at: www.linuximq.net
+
-+ If not sure leave the default settings alone.
++ If not sure leave the default settings alone.
+
+config IMQ_BEHAVIOR_BB
-+ bool "IMQ BB"
-+ help
-+ This settings defines how IMQ behaves in respect to its
-+ hooking in PREROUTING and POSTROUTING.
++ bool "IMQ BB"
++ help
++ This settings defines how IMQ behaves in respect to its
++ hooking in PREROUTING and POSTROUTING.
+
-+ Choosing this option will make IMQ hook like this:
++ Choosing this option will make IMQ hook like this:
+
-+ PREROUTING: Before NAT
-+ POSTROUTING: Before NAT
++ PREROUTING: Before NAT
++ POSTROUTING: Before NAT
+
-+ More information can be found at: www.linuximq.net
++ More information can be found at: www.linuximq.net
+
-+ If not sure leave the default settings alone.
++ If not sure leave the default settings alone.
+
+endchoice
+
+config IMQ_NUM_DEVS
+
-+ int "Number of IMQ devices"
++ int "Number of IMQ devices"
+ range 2 8
+ depends on IMQ
-+ default "2"
-+ help
++ default "2"
++ help
+
-+ This settings defines how many IMQ devices will be
++ This settings defines how many IMQ devices will be
+ created.
+
+ The default value is 2.
+
-+ More information can be found at: www.linuximq.net
++ More information can be found at: www.linuximq.net
+
-+ If not sure leave the default settings alone.
++ If not sure leave the default settings alone.
+
config TUN
tristate "Universal TUN/TAP device driver support"
select CRC32
-diff -Nru linux-2.6.17.orig/drivers/net/Makefile linux-2.6.17/drivers/net/Makefile
---- linux-2.6.17.orig/drivers/net/Makefile 2006-06-18 01:49:35.000000000 +0000
-+++ linux-2.6.17/drivers/net/Makefile 2006-09-06 20:58:51.000000000 +0000
-@@ -125,6 +125,7 @@
- endif
+diff -Nru linux-2.6.21.1-orig/drivers/net/Makefile linux-2.6.21.1/drivers/net/Makefile
+--- linux-2.6.21.1-orig/drivers/net/Makefile 2007-04-27 21:49:26.000000000 +0000
++++ linux-2.6.21.1/drivers/net/Makefile 2007-06-02 21:43:55.000000000 +0000
+@@ -124,6 +124,7 @@
+ obj-$(CONFIG_SLHC) += slhc.o
obj-$(CONFIG_DUMMY) += dummy.o
+obj-$(CONFIG_IMQ) += imq.o
obj-$(CONFIG_IFB) += ifb.o
obj-$(CONFIG_DE600) += de600.o
obj-$(CONFIG_DE620) += de620.o
-diff -Nru linux-2.6.17.orig/drivers/net/imq.c linux-2.6.17/drivers/net/imq.c
---- linux-2.6.17.orig/drivers/net/imq.c 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.17/drivers/net/imq.c 2006-09-06 20:58:51.000000000 +0000
-@@ -0,0 +1,403 @@
+diff -Nru linux-2.6.21.1-orig/drivers/net/imq.c linux-2.6.21.1/drivers/net/imq.c
+--- linux-2.6.21.1-orig/drivers/net/imq.c 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.21.1/drivers/net/imq.c 2007-06-02 21:43:55.000000000 +0000
+@@ -0,0 +1,402 @@
+/*
+ * Pseudo-driver for the intermediate queue device.
+ *
@@ -173,31 +173,30 @@
+ * the following changes:
+ *
+ * - Correction of ipv6 support "+"s issue (Hasso Tepper)
-+ * - Correction of imq_init_devs() issue that resulted in
++ * - Correction of imq_init_devs() issue that resulted in
+ * kernel OOPS unloading IMQ as module (Norbert Buchmuller)
+ * - Addition of functionality to choose number of IMQ devices
+ * during kernel config (Andre Correa)
-+ * - Addition of functionality to choose how IMQ hooks on
++ * - Addition of functionality to choose how IMQ hooks on
+ * PRE and POSTROUTING (after or before NAT) (Andre Correa)
+ * - Cosmetic corrections (Norbert Buchmuller) (Andre Correa)
+ *
+ *
-+ * 2005/12/16 - IMQ versions between 2.6.7 and 2.6.13 were
-+ * released with almost no problems. 2.6.14-x was released
-+ * with some important changes: nfcache was removed; After
-+ * some weeks of trouble we figured out that some IMQ fields
++ * 2005/12/16 - IMQ versions between 2.6.7 and 2.6.13 were
++ * released with almost no problems. 2.6.14-x was released
++ * with some important changes: nfcache was removed; After
++ * some weeks of trouble we figured out that some IMQ fields
+ * in skb were missing in skbuff.c - skb_clone and copy_skb_header.
+ * These functions are correctly patched by this new patch version.
+ *
-+ * Thanks for all who helped to figure out all the problems with
++ * Thanks for all who helped to figure out all the problems with
+ * 2.6.14.x: Patrick McHardy, Rune Kock, VeNoMouS, Max CtRiX,
-+ * Kevin Shanahan, Richard Lucassen, Valery Dachev (hopefully
++ * Kevin Shanahan, Richard Lucassen, Valery Dachev (hopefully
+ * I didn't forget anybody). I apologize again for my lack of time.
+ *
+ * More info at: http://www.linuximq.net/ (Andre Correa)
+ */
+
-+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/moduleparam.h>
@@ -213,54 +212,56 @@
+#include <linux/imq.h>
+#include <net/pkt_sched.h>
+
++extern int qdisc_restart1(struct net_device *dev);
++
+static nf_hookfn imq_nf_hook;
+
+static struct nf_hook_ops imq_ingress_ipv4 = {
-+ .hook = imq_nf_hook,
-+ .owner = THIS_MODULE,
-+ .pf = PF_INET,
-+ .hooknum = NF_IP_PRE_ROUTING,
++ .hook = imq_nf_hook,
++ .owner = THIS_MODULE,
++ .pf = PF_INET,
++ .hooknum = NF_IP_PRE_ROUTING,
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
-+ .priority = NF_IP_PRI_MANGLE + 1
++ .priority = NF_IP_PRI_MANGLE + 1
+#else
-+ .priority = NF_IP_PRI_NAT_DST + 1
++ .priority = NF_IP_PRI_NAT_DST + 1
+#endif
+};
+
+static struct nf_hook_ops imq_egress_ipv4 = {
-+ .hook = imq_nf_hook,
-+ .owner = THIS_MODULE,
-+ .pf = PF_INET,
-+ .hooknum = NF_IP_POST_ROUTING,
++ .hook = imq_nf_hook,
++ .owner = THIS_MODULE,
++ .pf = PF_INET,
++ .hooknum = NF_IP_POST_ROUTING,
+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
-+ .priority = NF_IP_PRI_LAST
++ .priority = NF_IP_PRI_LAST
+#else
-+ .priority = NF_IP_PRI_NAT_SRC - 1
++ .priority = NF_IP_PRI_NAT_SRC - 1
+#endif
+};
+
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+static struct nf_hook_ops imq_ingress_ipv6 = {
-+ .hook = imq_nf_hook,
-+ .owner = THIS_MODULE,
-+ .pf = PF_INET6,
-+ .hooknum = NF_IP6_PRE_ROUTING,
++ .hook = imq_nf_hook,
++ .owner = THIS_MODULE,
++ .pf = PF_INET6,
++ .hooknum = NF_IP6_PRE_ROUTING,
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
-+ .priority = NF_IP6_PRI_MANGLE + 1
++ .priority = NF_IP6_PRI_MANGLE + 1
+#else
-+ .priority = NF_IP6_PRI_NAT_DST + 1
++ .priority = NF_IP6_PRI_NAT_DST + 1
+#endif
+};
+
+static struct nf_hook_ops imq_egress_ipv6 = {
-+ .hook = imq_nf_hook,
-+ .owner = THIS_MODULE,
-+ .pf = PF_INET6,
-+ .hooknum = NF_IP6_POST_ROUTING,
++ .hook = imq_nf_hook,
++ .owner = THIS_MODULE,
++ .pf = PF_INET6,
++ .hooknum = NF_IP6_POST_ROUTING,
+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
-+ .priority = NF_IP6_PRI_LAST
++ .priority = NF_IP6_PRI_LAST
+#else
-+ .priority = NF_IP6_PRI_NAT_SRC - 1
++ .priority = NF_IP6_PRI_NAT_SRC - 1
+#endif
+};
+#endif
@@ -275,269 +276,267 @@
+
+static struct net_device_stats *imq_get_stats(struct net_device *dev)
+{
-+ return (struct net_device_stats *)dev->priv;
++ return (struct net_device_stats *)dev->priv;
+}
+
+/* called for packets kfree'd in qdiscs at places other than enqueue */
+static void imq_skb_destructor(struct sk_buff *skb)
+{
-+ struct nf_info *info = skb->nf_info;
++ struct nf_info *info = skb->nf_info;
+
-+ if (info) {
-+ if (info->indev)
-+ dev_put(info->indev);
-+ if (info->outdev)
-+ dev_put(info->outdev);
-+ kfree(info);
-+ }
++ if (info) {
++ if (info->indev)
++ dev_put(info->indev);
++ if (info->outdev)
++ dev_put(info->outdev);
++ kfree(info);
++ }
+}
+
+static int imq_dev_xmit(struct sk_buff *skb, struct net_device *dev)
+{
-+ struct net_device_stats *stats = (struct net_device_stats*) dev->priv;
++ struct net_device_stats *stats = (struct net_device_stats*) dev->priv;
+
-+ stats->tx_bytes += skb->len;
-+ stats->tx_packets++;
++ stats->tx_bytes += skb->len;
++ stats->tx_packets++;
+
-+ skb->imq_flags = 0;
-+ skb->destructor = NULL;
++ skb->imq_flags = 0;
++ skb->destructor = NULL;
+
-+ dev->trans_start = jiffies;
-+ nf_reinject(skb, skb->nf_info, NF_ACCEPT);
-+ return 0;
++ dev->trans_start = jiffies;
++ nf_reinject(skb, skb->nf_info, NF_ACCEPT);
++ return 0;
+}
+
+static int imq_nf_queue(struct sk_buff *skb, struct nf_info *info, unsigned queue_num, void *data)
+{
-+ struct net_device *dev;
-+ struct net_device_stats *stats;
-+ struct sk_buff *skb2 = NULL;
-+ struct Qdisc *q;
-+ unsigned int index = skb->imq_flags&IMQ_F_IFMASK;
-+ int ret = -1;
-+
-+ if (index > numdevs)
-+ return -1;
-+
-+ dev = imq_devs + index;
-+ if (!(dev->flags & IFF_UP)) {
-+ skb->imq_flags = 0;
-+ nf_reinject(skb, info, NF_ACCEPT);
-+ return 0;
-+ }
-+ dev->last_rx = jiffies;
-+
-+ if (skb->destructor) {
-+ skb2 = skb;
-+ skb = skb_clone(skb, GFP_ATOMIC);
-+ if (!skb)
-+ return -1;
-+ }
-+ skb->nf_info = info;
-+
-+ stats = (struct net_device_stats *)dev->priv;
-+ stats->rx_bytes+= skb->len;
-+ stats->rx_packets++;
-+
-+ spin_lock_bh(&dev->queue_lock);
-+ q = dev->qdisc;
-+ if (q->enqueue) {
-+ q->enqueue(skb_get(skb), q);
-+ if (skb_shared(skb)) {
-+ skb->destructor = imq_skb_destructor;
-+ kfree_skb(skb);
-+ ret = 0;
-+ }
-+ }
-+ if (spin_is_locked(&dev->_xmit_lock))
-+ netif_schedule(dev);
-+ else
-+
-+ while (!netif_queue_stopped(dev) &&
-+ qdisc_restart(dev)<0)
-+ /* NOTHING */;
++ struct net_device *dev;
++ struct net_device_stats *stats;
++ struct sk_buff *skb2 = NULL;
++ struct Qdisc *q;
++ unsigned int index = skb->imq_flags&IMQ_F_IFMASK;
++ int ret = -1;
++
++ if (index > numdevs)
++ return -1;
++
++ dev = imq_devs + index;
++ if (!(dev->flags & IFF_UP)) {
++ skb->imq_flags = 0;
++ nf_reinject(skb, info, NF_ACCEPT);
++ return 0;
++ }
++ dev->last_rx = jiffies;
++
++ if (skb->destructor) {
++ skb2 = skb;
++ skb = skb_clone(skb, GFP_ATOMIC);
++ if (!skb)
++ return -1;
++ }
++ skb->nf_info = info;
++
++ stats = (struct net_device_stats *)dev->priv;
++ stats->rx_bytes+= skb->len;
++ stats->rx_packets++;
++
++ spin_lock_bh(&dev->queue_lock);
++ q = dev->qdisc;
++ if (q->enqueue) {
++ q->enqueue(skb_get(skb), q);
++ if (skb_shared(skb)) {
++ skb->destructor = imq_skb_destructor;
++ kfree_skb(skb);
++ ret = 0;
++ }
++ }
++ if (spin_is_locked(&dev->_xmit_lock))
++ netif_schedule(dev);
++ else
++ while (!netif_queue_stopped(dev) && qdisc_restart1(dev) < 0)
++ /* NOTHING */;
+
-+ spin_unlock_bh(&dev->queue_lock);
++ spin_unlock_bh(&dev->queue_lock);
+
-+ if (skb2)
-+ kfree_skb(ret ? skb : skb2);
++ if (skb2)
++ kfree_skb(ret ? skb : skb2);
+
-+ return ret;
++ return ret;
+}
+
+static struct nf_queue_handler nfqh = {
-+ .name = "imq",
-+ .outfn = imq_nf_queue,
++ .name = "imq",
++ .outfn = imq_nf_queue,
+};
+
+static unsigned int imq_nf_hook(unsigned int hook, struct sk_buff **pskb,
-+ const struct net_device *indev,
-+ const struct net_device *outdev,
-+ int (*okfn)(struct sk_buff *))
++ const struct net_device *indev,
++ const struct net_device *outdev,
++ int (*okfn)(struct sk_buff *))
+{
-+ if ((*pskb)->imq_flags & IMQ_F_ENQUEUE)
-+ return NF_QUEUE;
++ if ((*pskb)->imq_flags & IMQ_F_ENQUEUE)
++ return NF_QUEUE;
+
-+ return NF_ACCEPT;
++ return NF_ACCEPT;
+}
+
+
+static int __init imq_init_hooks(void)
+{
-+ int err;
++ int err;
+
-+ err = nf_register_queue_handler(PF_INET, &nfqh);
-+ if (err > 0)
-+ goto err1;
-+ if ((err = nf_register_hook(&imq_ingress_ipv4)))
-+ goto err2;
-+ if ((err = nf_register_hook(&imq_egress_ipv4)))
-+ goto err3;
++ err = nf_register_queue_handler(PF_INET, &nfqh);
++ if (err > 0)
++ goto err1;
++ if ((err = nf_register_hook(&imq_ingress_ipv4)))
++ goto err2;
++ if ((err = nf_register_hook(&imq_egress_ipv4)))
++ goto err3;
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
-+ if ((err = nf_register_queue_handler(PF_INET6, &nfqh)))
-+ goto err4;
-+ if ((err = nf_register_hook(&imq_ingress_ipv6)))
-+ goto err5;
-+ if ((err = nf_register_hook(&imq_egress_ipv6)))
-+ goto err6;
++ if ((err = nf_register_queue_handler(PF_INET6, &nfqh)))
++ goto err4;
++ if ((err = nf_register_hook(&imq_ingress_ipv6)))
++ goto err5;
++ if ((err = nf_register_hook(&imq_egress_ipv6)))
++ goto err6;
+#endif
+
-+ return 0;
++ return 0;
+
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+err6:
-+ nf_unregister_hook(&imq_ingress_ipv6);
++ nf_unregister_hook(&imq_ingress_ipv6);
+err5:
-+ nf_unregister_queue_handler(PF_INET6);
++ nf_unregister_queue_handler(PF_INET6);
+err4:
-+ nf_unregister_hook(&imq_egress_ipv6);
++ nf_unregister_hook(&imq_egress_ipv6);
+#endif
+err3:
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/kernel-desktop-imq.patch?r1=1.3&r2=1.4&f=u
More information about the pld-cvs-commit
mailing list