1 --- linux-2.6.20-original/drivers/net/imq.c 1970-01-01 02:00:00.000000000 +0200
2 +++ linux-2.6.20/drivers/net/imq.c 2007-02-12 23:55:04.000000000 +0200
5 + * Pseudo-driver for the intermediate queue device.
7 + * This program is free software; you can redistribute it and/or
8 + * modify it under the terms of the GNU General Public License
9 + * as published by the Free Software Foundation; either version
10 + * 2 of the License, or (at your option) any later version.
12 + * Authors: Patrick McHardy, <kaber@trash.net>
14 + * The first version was written by Martin Devera, <devik@cdi.cz>
16 + * Credits: Jan Rafaj <imq2t@cedric.vabo.cz>
17 + * - Update patch to 2.4.21
18 + * Sebastian Strollo <sstrollo@nortelnetworks.com>
19 + * - Fix "Dead-loop on netdevice imq"-issue
20 + * Marcel Sebek <sebek64@post.cz>
21 + * - Update to 2.6.2-rc1
23 + * After some time of inactivity there is a group taking care
24 + * of IMQ again: http://www.linuximq.net
27 + * 2004/06/30 - New version of IMQ patch to kernels <=2.6.7 including
28 + * the following changes:
30 + * - Correction of ipv6 support "+"s issue (Hasso Tepper)
31 + * - Correction of imq_init_devs() issue that resulted in
32 + * kernel OOPS unloading IMQ as module (Norbert Buchmuller)
33 + * - Addition of functionality to choose number of IMQ devices
34 + * during kernel config (Andre Correa)
35 + * - Addition of functionality to choose how IMQ hooks on
36 + * PRE and POSTROUTING (after or before NAT) (Andre Correa)
37 + * - Cosmetic corrections (Norbert Buchmuller) (Andre Correa)
40 + * 2005/12/16 - IMQ versions between 2.6.7 and 2.6.13 were
41 + * released with almost no problems. 2.6.14-x was released
42 + * with some important changes: nfcache was removed; After
43 + * some weeks of trouble we figured out that some IMQ fields
44 + * in skb were missing in skbuff.c - skb_clone and copy_skb_header.
45 + * These functions are correctly patched by this new patch version.
47 + * Thanks for all who helped to figure out all the problems with
48 + * 2.6.14.x: Patrick McHardy, Rune Kock, VeNoMouS, Max CtRiX,
49 + * Kevin Shanahan, Richard Lucassen, Valery Dachev (hopefully
50 + * I didn't forget anybody). I apologize again for my lack of time.
52 + * More info at: http://www.linuximq.net/ (Andre Correa)
55 +#include <linux/module.h>
56 +#include <linux/kernel.h>
57 +#include <linux/moduleparam.h>
58 +#include <linux/skbuff.h>
59 +#include <linux/netdevice.h>
60 +#include <linux/rtnetlink.h>
61 +#include <linux/if_arp.h>
62 +#include <linux/netfilter.h>
63 +#include <linux/netfilter_ipv4.h>
64 +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
65 + #include <linux/netfilter_ipv6.h>
67 +#include <linux/imq.h>
68 +#include <net/pkt_sched.h>
70 +extern int qdisc_restart1(struct net_device *dev);
72 +static nf_hookfn imq_nf_hook;
74 +static struct nf_hook_ops imq_ingress_ipv4 = {
75 + .hook = imq_nf_hook,
76 + .owner = THIS_MODULE,
78 + .hooknum = NF_IP_PRE_ROUTING,
79 +#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
80 + .priority = NF_IP_PRI_MANGLE + 1
82 + .priority = NF_IP_PRI_NAT_DST + 1
86 +static struct nf_hook_ops imq_egress_ipv4 = {
87 + .hook = imq_nf_hook,
88 + .owner = THIS_MODULE,
90 + .hooknum = NF_IP_POST_ROUTING,
91 +#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
92 + .priority = NF_IP_PRI_LAST
94 + .priority = NF_IP_PRI_NAT_SRC - 1
98 +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
99 +static struct nf_hook_ops imq_ingress_ipv6 = {
100 + .hook = imq_nf_hook,
101 + .owner = THIS_MODULE,
103 + .hooknum = NF_IP6_PRE_ROUTING,
104 +#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
105 + .priority = NF_IP6_PRI_MANGLE + 1
107 + .priority = NF_IP6_PRI_NAT_DST + 1
111 +static struct nf_hook_ops imq_egress_ipv6 = {
112 + .hook = imq_nf_hook,
113 + .owner = THIS_MODULE,
115 + .hooknum = NF_IP6_POST_ROUTING,
116 +#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
117 + .priority = NF_IP6_PRI_LAST
119 + .priority = NF_IP6_PRI_NAT_SRC - 1
124 +#if defined(CONFIG_IMQ_NUM_DEVS)
125 +static unsigned int numdevs = CONFIG_IMQ_NUM_DEVS;
127 +static unsigned int numdevs = 2;
130 +static struct net_device *imq_devs;
132 +static struct net_device_stats *imq_get_stats(struct net_device *dev)
134 + return (struct net_device_stats *)dev->priv;
137 +/* called for packets kfree'd in qdiscs at places other than enqueue */
138 +static void imq_skb_destructor(struct sk_buff *skb)
140 + struct nf_info *info = skb->nf_info;
144 + dev_put(info->indev);
146 + dev_put(info->outdev);
151 +static int imq_dev_xmit(struct sk_buff *skb, struct net_device *dev)
153 + struct net_device_stats *stats = (struct net_device_stats*) dev->priv;
155 + stats->tx_bytes += skb->len;
156 + stats->tx_packets++;
158 + skb->imq_flags = 0;
159 + skb->destructor = NULL;
161 + dev->trans_start = jiffies;
162 + nf_reinject(skb, skb->nf_info, NF_ACCEPT);
166 +static int imq_nf_queue(struct sk_buff *skb, struct nf_info *info, unsigned queue_num, void *data)
168 + struct net_device *dev;
169 + struct net_device_stats *stats;
170 + struct sk_buff *skb2 = NULL;
172 + unsigned int index = skb->imq_flags&IMQ_F_IFMASK;
175 + if (index > numdevs)
178 + dev = imq_devs + index;
179 + if (!(dev->flags & IFF_UP)) {
180 + skb->imq_flags = 0;
181 + nf_reinject(skb, info, NF_ACCEPT);
184 + dev->last_rx = jiffies;
186 + if (skb->destructor) {
188 + skb = skb_clone(skb, GFP_ATOMIC);
192 + skb->nf_info = info;
194 + stats = (struct net_device_stats *)dev->priv;
195 + stats->rx_bytes+= skb->len;
196 + stats->rx_packets++;
198 + spin_lock_bh(&dev->queue_lock);
201 + q->enqueue(skb_get(skb), q);
202 + if (skb_shared(skb)) {
203 + skb->destructor = imq_skb_destructor;
208 + if (spin_is_locked(&dev->_xmit_lock))
209 + netif_schedule(dev);
211 + while (!netif_queue_stopped(dev) && qdisc_restart1(dev) < 0)
214 + spin_unlock_bh(&dev->queue_lock);
217 + kfree_skb(ret ? skb : skb2);
222 +static struct nf_queue_handler nfqh = {
224 + .outfn = imq_nf_queue,
227 +static unsigned int imq_nf_hook(unsigned int hook, struct sk_buff **pskb,
228 + const struct net_device *indev,
229 + const struct net_device *outdev,
230 + int (*okfn)(struct sk_buff *))
232 + if ((*pskb)->imq_flags & IMQ_F_ENQUEUE)
239 +static int __init imq_init_hooks(void)
243 + err = nf_register_queue_handler(PF_INET, &nfqh);
246 + if ((err = nf_register_hook(&imq_ingress_ipv4)))
248 + if ((err = nf_register_hook(&imq_egress_ipv4)))
250 +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
251 + if ((err = nf_register_queue_handler(PF_INET6, &nfqh)))
253 + if ((err = nf_register_hook(&imq_ingress_ipv6)))
255 + if ((err = nf_register_hook(&imq_egress_ipv6)))
261 +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
263 + nf_unregister_hook(&imq_ingress_ipv6);
265 + nf_unregister_queue_handler(PF_INET6);
267 + nf_unregister_hook(&imq_egress_ipv6);
270 + nf_unregister_hook(&imq_ingress_ipv4);
272 + nf_unregister_queue_handler(PF_INET);
277 +static void __exit imq_unhook(void)
279 + nf_unregister_hook(&imq_ingress_ipv4);
280 + nf_unregister_hook(&imq_egress_ipv4);
281 + nf_unregister_queue_handler(PF_INET);
282 +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
283 + nf_unregister_hook(&imq_ingress_ipv6);
284 + nf_unregister_hook(&imq_egress_ipv6);
285 + nf_unregister_queue_handler(PF_INET6);
289 +static int __init imq_dev_init(struct net_device *dev)
291 + dev->hard_start_xmit = imq_dev_xmit;
292 + dev->type = ARPHRD_VOID;
294 + dev->tx_queue_len = 30;
295 + dev->flags = IFF_NOARP;
296 + dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
297 + if (dev->priv == NULL)
299 + memset(dev->priv, 0, sizeof(struct net_device_stats));
300 + dev->get_stats = imq_get_stats;
305 +static void imq_dev_uninit(struct net_device *dev)
310 +static int __init imq_init_devs(void)
312 + struct net_device *dev;
316 + if (!numdevs || numdevs > IMQ_MAX_DEVS) {
317 + printk(KERN_ERR "IMQ: numdevs has to be betweed 1 and %u\n",
322 + imq_devs = kmalloc(sizeof(struct net_device) * numdevs, GFP_KERNEL);
325 + memset(imq_devs, 0, sizeof(struct net_device) * numdevs);
327 + /* we start counting at zero */
330 + for (i = 0, dev = imq_devs; i <= numdevs; i++, dev++) {
331 + SET_MODULE_OWNER(dev);
332 + strcpy(dev->name, "imq%d");
333 + dev->init = imq_dev_init;
334 + dev->uninit = imq_dev_uninit;
336 + if (register_netdev(dev) < 0)
339 + printk(KERN_INFO "IMQ starting with %u devices...\n", j);
344 + unregister_netdev(--dev);
349 +static void imq_cleanup_devs(void)
352 + struct net_device *dev = imq_devs;
354 + for (i = 0; i <= numdevs; i++)
355 + unregister_netdev(dev++);
360 +static int __init imq_init_module(void)
364 + if ((err = imq_init_devs())) {
365 + printk(KERN_ERR "IMQ: Error trying imq_init_devs()\n");
368 + if ((err = imq_init_hooks())) {
369 + printk(KERN_ERR "IMQ: Error trying imq_init_hooks()\n");
370 + imq_cleanup_devs();
374 + printk(KERN_INFO "IMQ driver loaded successfully.\n");
376 +#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
377 + printk(KERN_INFO "\tHooking IMQ before NAT on PREROUTING.\n");
379 + printk(KERN_INFO "\tHooking IMQ after NAT on PREROUTING.\n");
381 +#if defined(CONFIG_IMQ_BEHAVIOR_AB) || defined(CONFIG_IMQ_BEHAVIOR_BB)
382 + printk(KERN_INFO "\tHooking IMQ before NAT on POSTROUTING.\n");
384 + printk(KERN_INFO "\tHooking IMQ after NAT on POSTROUTING.\n");
390 +static void __exit imq_cleanup_module(void)
393 + imq_cleanup_devs();
394 + printk(KERN_INFO "IMQ driver unloaded successfully.\n");
398 +module_init(imq_init_module);
399 +module_exit(imq_cleanup_module);
401 +module_param(numdevs, int, 0);
402 +MODULE_PARM_DESC(numdevs, "number of IMQ devices (how many imq* devices will be created)");
403 +MODULE_AUTHOR("http://www.linuximq.net");
404 +MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
405 +MODULE_LICENSE("GPL");
406 --- linux-2.6.20-original/drivers/net/Kconfig 2007-02-04 20:44:54.000000000 +0200
407 +++ linux-2.6.20/drivers/net/Kconfig 2007-02-12 23:55:04.000000000 +0200
409 To compile this driver as a module, choose M here: the module
410 will be called eql. If unsure, say N.
413 + tristate "IMQ (intermediate queueing device) support"
414 + depends on NETDEVICES && NETFILTER
416 + The IMQ device(s) is used as placeholder for QoS queueing
417 + disciplines. Every packet entering/leaving the IP stack can be
418 + directed through the IMQ device where it's enqueued/dequeued to the
419 + attached qdisc. This allows you to treat network devices as classes
420 + and distribute bandwidth among them. Iptables is used to specify
421 + through which IMQ device, if any, packets travel.
423 + More information at: http://www.linuximq.net/
425 + To compile this driver as a module, choose M here: the module
426 + will be called imq. If unsure, say N.
429 + prompt "IMQ behavior (PRE/POSTROUTING)"
431 + default IMQ_BEHAVIOR_BA
434 + This settings defines how IMQ behaves in respect to its
435 + hooking in PREROUTING and POSTROUTING.
437 + IMQ can work in any of the following ways:
439 + PREROUTING | POSTROUTING
440 + -----------------|-------------------
441 + #1 After NAT | After NAT
442 + #2 After NAT | Before NAT
443 + #3 Before NAT | After NAT
444 + #4 Before NAT | Before NAT
446 + The default behavior is to hook before NAT on PREROUTING
447 + and after NAT on POSTROUTING (#3).
449 + This settings are specially usefull when trying to use IMQ
450 + to shape NATed clients.
452 + More information can be found at: www.linuximq.net
454 + If not sure leave the default settings alone.
456 +config IMQ_BEHAVIOR_AA
459 + This settings defines how IMQ behaves in respect to its
460 + hooking in PREROUTING and POSTROUTING.
462 + Choosing this option will make IMQ hook like this:
464 + PREROUTING: After NAT
465 + POSTROUTING: After NAT
467 + More information can be found at: www.linuximq.net
469 + If not sure leave the default settings alone.
471 +config IMQ_BEHAVIOR_AB
474 + This settings defines how IMQ behaves in respect to its
475 + hooking in PREROUTING and POSTROUTING.
477 + Choosing this option will make IMQ hook like this:
479 + PREROUTING: After NAT
480 + POSTROUTING: Before NAT
482 + More information can be found at: www.linuximq.net
484 + If not sure leave the default settings alone.
486 +config IMQ_BEHAVIOR_BA
489 + This settings defines how IMQ behaves in respect to its
490 + hooking in PREROUTING and POSTROUTING.
492 + Choosing this option will make IMQ hook like this:
494 + PREROUTING: Before NAT
495 + POSTROUTING: After NAT
497 + More information can be found at: www.linuximq.net
499 + If not sure leave the default settings alone.
501 +config IMQ_BEHAVIOR_BB
504 + This settings defines how IMQ behaves in respect to its
505 + hooking in PREROUTING and POSTROUTING.
507 + Choosing this option will make IMQ hook like this:
509 + PREROUTING: Before NAT
510 + POSTROUTING: Before NAT
512 + More information can be found at: www.linuximq.net
514 + If not sure leave the default settings alone.
520 + int "Number of IMQ devices"
526 + This settings defines how many IMQ devices will be
529 + The default value is 2.
531 + More information can be found at: www.linuximq.net
533 + If not sure leave the default settings alone.
536 tristate "Universal TUN/TAP device driver support"
538 --- linux-2.6.20-original/drivers/net/Makefile 2007-02-04 20:44:54.000000000 +0200
539 +++ linux-2.6.20/drivers/net/Makefile 2007-02-12 23:55:04.000000000 +0200
541 obj-$(CONFIG_SLHC) += slhc.o
543 obj-$(CONFIG_DUMMY) += dummy.o
544 +obj-$(CONFIG_IMQ) += imq.o
545 obj-$(CONFIG_IFB) += ifb.o
546 obj-$(CONFIG_DE600) += de600.o
547 obj-$(CONFIG_DE620) += de620.o
548 --- linux-2.6.20-original/include/linux/imq.h 1970-01-01 02:00:00.000000000 +0200
549 +++ linux-2.6.20/include/linux/imq.h 2007-02-12 23:55:04.000000000 +0200
554 +#define IMQ_MAX_DEVS 16
556 +#define IMQ_F_IFMASK 0x7f
557 +#define IMQ_F_ENQUEUE 0x80
560 --- linux-2.6.20-original/include/linux/netfilter_ipv4/ipt_IMQ.h 1970-01-01 02:00:00.000000000 +0200
561 +++ linux-2.6.20/include/linux/netfilter_ipv4/ipt_IMQ.h 2007-02-12 23:55:04.000000000 +0200
566 +struct ipt_imq_info {
567 + unsigned int todev; /* target imq device */
570 +#endif /* _IPT_IMQ_H */
571 --- linux-2.6.20-original/include/linux/netfilter_ipv6/ip6t_IMQ.h 1970-01-01 02:00:00.000000000 +0200
572 +++ linux-2.6.20/include/linux/netfilter_ipv6/ip6t_IMQ.h 2007-02-12 23:55:04.000000000 +0200
577 +struct ip6t_imq_info {
578 + unsigned int todev; /* target imq device */
581 +#endif /* _IP6T_IMQ_H */
582 --- linux-2.6.20-original/include/linux/skbuff.h 2007-02-04 20:44:54.000000000 +0200
583 +++ linux-2.6.20/include/linux/skbuff.h 2007-02-12 23:55:04.000000000 +0200
585 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
586 struct sk_buff *nfct_reasm;
588 +#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
589 + unsigned char imq_flags;
590 + struct nf_info *nf_info;
592 #ifdef CONFIG_BRIDGE_NETFILTER
593 struct nf_bridge_info *nf_bridge;
595 --- linux-2.6.20-original/net/core/dev.c 2007-02-04 20:44:54.000000000 +0200
596 +++ linux-2.6.20/net/core/dev.c 2007-02-12 23:55:04.000000000 +0200
598 #include <linux/skbuff.h>
599 #include <net/sock.h>
600 #include <linux/rtnetlink.h>
601 +#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
602 +#include <linux/imq.h>
604 #include <linux/proc_fs.h>
605 #include <linux/seq_file.h>
606 #include <linux/stat.h>
607 @@ -1343,7 +1346,11 @@
608 int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
610 if (likely(!skb->next)) {
613 +#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
614 + && !(skb->imq_flags & IMQ_F_ENQUEUE)
617 dev_queue_xmit_nit(skb, dev);
619 if (netif_needs_gso(dev, skb)) {
620 --- linux-2.6.20-original/net/core/skbuff.c 2007-02-04 20:44:54.000000000 +0200
621 +++ linux-2.6.20/net/core/skbuff.c 2007-02-12 23:55:04.000000000 +0200
624 nf_conntrack_get_reasm(skb->nfct_reasm);
626 +#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
629 +#endif /*CONFIG_IMQ*/
630 #ifdef CONFIG_BRIDGE_NETFILTER
632 nf_bridge_get(skb->nf_bridge);
634 #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
635 new->ipvs_property = old->ipvs_property;
637 +#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
638 + new->imq_flags = old->imq_flags;
639 + new->nf_info = old->nf_info;
640 +#endif /*CONFIG_IMQ*/
641 #ifdef CONFIG_BRIDGE_NETFILTER
642 new->nf_bridge = old->nf_bridge;
643 nf_bridge_get(old->nf_bridge);
644 --- linux-2.6.20-original/net/ipv4/netfilter/ipt_IMQ.c 1970-01-01 02:00:00.000000000 +0200
645 +++ linux-2.6.20/net/ipv4/netfilter/ipt_IMQ.c 2007-02-12 23:55:04.000000000 +0200
648 + * This target marks packets to be enqueued to an imq device
650 +#include <linux/module.h>
651 +#include <linux/skbuff.h>
652 +#include <linux/netfilter_ipv4/ip_tables.h>
653 +#include <linux/netfilter_ipv4/ipt_IMQ.h>
654 +#include <linux/imq.h>
656 +static unsigned int imq_target(struct sk_buff **pskb,
657 + const struct net_device *in,
658 + const struct net_device *out,
659 + unsigned int hooknum,
660 + const struct xt_target *target,
661 + const void *targinfo)
663 + struct ipt_imq_info *mr = (struct ipt_imq_info*)targinfo;
665 + (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
667 + return IPT_CONTINUE;
670 +static int imq_checkentry(const char *tablename,
672 + const struct xt_target *target,
674 + unsigned int hook_mask)
676 + struct ipt_imq_info *mr;
678 + mr = (struct ipt_imq_info*)targinfo;
680 + if (mr->todev > IMQ_MAX_DEVS) {
681 + printk(KERN_WARNING
682 + "IMQ: invalid device specified, highest is %u\n",
690 +static struct ipt_target ipt_imq_reg = {
692 + .target = imq_target,
693 + .targetsize = sizeof(struct ipt_imq_info),
694 + .checkentry = imq_checkentry,
699 +static int __init init(void)
701 + if (xt_register_target(&ipt_imq_reg))
707 +static void __exit fini(void)
709 + xt_unregister_target(&ipt_imq_reg);
715 +MODULE_AUTHOR("http://www.linuximq.net");
716 +MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
717 +MODULE_LICENSE("GPL");
718 --- linux-2.6.20-original/net/ipv4/netfilter/Kconfig 2007-02-04 20:44:54.000000000 +0200
719 +++ linux-2.6.20/net/ipv4/netfilter/Kconfig 2007-02-12 23:55:04.000000000 +0200
722 To compile it as a module, choose M here. If unsure, say N.
724 +config IP_NF_TARGET_IMQ
725 + tristate "IMQ target support"
726 + depends on IP_NF_MANGLE
728 + This option adds a `IMQ' target which is used to specify if and
729 + to which IMQ device packets should get enqueued/dequeued.
731 + For more information visit: http://www.linuximq.net/
733 + To compile it as a module, choose M here. If unsure, say N.
735 config IP_NF_TARGET_TOS
736 tristate "TOS target support"
737 depends on IP_NF_MANGLE
738 --- linux-2.6.20-original/net/ipv4/netfilter/Makefile 2007-02-04 20:44:54.000000000 +0200
739 +++ linux-2.6.20/net/ipv4/netfilter/Makefile 2007-02-12 23:55:04.000000000 +0200
741 obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o
742 obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o
743 obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
744 +obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o
745 obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
746 obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
747 obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
748 --- linux-2.6.20-original/net/ipv6/netfilter/ip6t_IMQ.c 1970-01-01 02:00:00.000000000 +0200
749 +++ linux-2.6.20/net/ipv6/netfilter/ip6t_IMQ.c 2007-02-12 23:55:04.000000000 +0200
752 + * This target marks packets to be enqueued to an imq device
754 +#include <linux/module.h>
755 +#include <linux/skbuff.h>
756 +#include <linux/netfilter_ipv6/ip6_tables.h>
757 +#include <linux/netfilter_ipv6/ip6t_IMQ.h>
758 +#include <linux/imq.h>
760 +static unsigned int imq_target(struct sk_buff **pskb,
761 + const struct net_device *in,
762 + const struct net_device *out,
763 + unsigned int hooknum,
764 + const struct xt_target *target,
765 + const void *targinfo)
767 + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)targinfo;
769 + (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
771 + return IP6T_CONTINUE;
774 +static int imq_checkentry(const char *tablename,
776 + const struct xt_target *target,
778 + unsigned int hook_mask)
780 + struct ip6t_imq_info *mr;
782 + mr = (struct ip6t_imq_info*)targinfo;
784 + if (mr->todev > IMQ_MAX_DEVS) {
785 + printk(KERN_WARNING
786 + "IMQ: invalid device specified, highest is %u\n",
794 +static struct ip6t_target ip6t_imq_reg = {
796 + .target = imq_target,
797 + .targetsize = sizeof(struct ip6t_imq_info),
799 + .checkentry = imq_checkentry,
803 +static int __init init(void)
805 + if (xt_register_target(&ip6t_imq_reg))
811 +static void __exit fini(void)
813 + xt_unregister_target(&ip6t_imq_reg);
819 +MODULE_AUTHOR("http://www.linuximq.net");
820 +MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
821 +MODULE_LICENSE("GPL");
822 --- linux-2.6.20-original/net/ipv6/netfilter/Kconfig 2007-02-04 20:44:54.000000000 +0200
823 +++ linux-2.6.20/net/ipv6/netfilter/Kconfig 2007-02-12 23:55:04.000000000 +0200
826 To compile it as a module, choose M here. If unsure, say N.
828 +config IP6_NF_TARGET_IMQ
829 + tristate "IMQ target support"
830 + depends on IP6_NF_MANGLE
832 + This option adds a `IMQ' target which is used to specify if and
833 + to which imq device packets should get enqueued/dequeued.
835 + To compile it as a module, choose M here. If unsure, say N.
837 config IP6_NF_TARGET_HL
838 tristate 'HL (hoplimit) target support'
839 depends on IP6_NF_MANGLE
840 --- linux-2.6.20-original/net/ipv6/netfilter/Makefile 2007-02-04 20:44:54.000000000 +0200
841 +++ linux-2.6.20/net/ipv6/netfilter/Makefile 2007-02-12 23:55:04.000000000 +0200
843 obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o
844 obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
845 obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
846 +obj-$(CONFIG_IP6_NF_TARGET_IMQ) += ip6t_IMQ.o
847 obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o
848 obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
849 obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
850 --- linux-2.6.20-original/net/sched/sch_generic.c 2007-02-04 20:44:54.000000000 +0200
851 +++ linux-2.6.20/net/sched/sch_generic.c 2007-02-12 23:55:04.000000000 +0200
854 NOTE: Called under dev->queue_lock with locally disabled BH.
857 static inline int qdisc_restart(struct net_device *dev)
859 struct Qdisc *q = dev->qdisc;
864 +int qdisc_restart1(struct net_device *dev)
866 + return qdisc_restart(dev);
869 void __qdisc_run(struct net_device *dev)
871 if (unlikely(dev->qdisc == &noop_qdisc))
873 EXPORT_SYMBOL(qdisc_reset);
874 EXPORT_SYMBOL(qdisc_lock_tree);
875 EXPORT_SYMBOL(qdisc_unlock_tree);
876 +EXPORT_SYMBOL(qdisc_restart1);