* add a prerelease IMQ patch for 2.6.25 * reenable IMQ in the kernel config * resync...
[openwrt/openwrt.git] / target / linux / generic-2.6 / patches-2.6.25 / 150-netfilter_imq.patch
index eb5513050b05a73e75afa3ff21346ea16e6d02f4..3d5ce9b13b0c3e42a036aeec47d9a4df5a401983 100644 (file)
@@ -1,8 +1,6 @@
-Index: linux-2.6.25.1/drivers/net/imq.c
-===================================================================
 --- /dev/null
-+++ linux-2.6.25.1/drivers/net/imq.c
-@@ -0,0 +1,409 @@
++++ b/drivers/net/imq.c
+@@ -0,0 +1,410 @@
 +/*
 + *             Pseudo-driver for the intermediate queue device.
 + *
@@ -68,6 +66,7 @@ Index: linux-2.6.25.1/drivers/net/imq.c
 +#endif
 +#include <linux/imq.h>
 +#include <net/pkt_sched.h>
++#include <net/netfilter/nf_queue.h>
 +
 +extern int qdisc_restart1(struct net_device *dev);
 +
@@ -139,7 +138,7 @@ Index: linux-2.6.25.1/drivers/net/imq.c
 +/* 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_queue_entry *info = skb->nf_queue_entry;
 +
 +      if (info) {
 +              if (info->indev)
@@ -161,17 +160,17 @@ Index: linux-2.6.25.1/drivers/net/imq.c
 +      skb->destructor = NULL;
 +
 +      dev->trans_start = jiffies;
-+      nf_reinject(skb, skb->nf_info, NF_ACCEPT);
++      nf_reinject(skb->nf_queue_entry, NF_ACCEPT);
 +      return 0;
 +}
 +
-+static int imq_nf_queue(struct sk_buff *skb, struct nf_info *info, unsigned queue_num, void *data)
++static int imq_nf_queue(struct nf_queue_entry *info, unsigned queue_num)
 +{
 +      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;
++      unsigned int index = info->skb->imq_flags&IMQ_F_IFMASK;
 +      int ret = -1;
 +
 +      if (index > numdevs)
@@ -179,31 +178,31 @@ Index: linux-2.6.25.1/drivers/net/imq.c
 +
 +      dev = imq_devs + index;
 +      if (!(dev->flags & IFF_UP)) {
-+              skb->imq_flags = 0;
-+              nf_reinject(skb, info, NF_ACCEPT);
++              info->skb->imq_flags = 0;
++              nf_reinject(info, NF_ACCEPT);
 +              return 0;
 +      }
 +      dev->last_rx = jiffies;
 +
-+      if (skb->destructor) {
-+              skb2 = skb;
-+              skb = skb_clone(skb, GFP_ATOMIC);
-+              if (!skb)
++      if (info->skb->destructor) {
++              skb2 = info->skb;
++              info->skb = skb_clone(info->skb, GFP_ATOMIC);
++              if (!info->skb)
 +                      return -1;
 +      }
-+      skb->nf_info = info;
++      info->skb->nf_queue_entry = info;
 +
 +      stats = (struct net_device_stats *)dev->priv;
-+      stats->rx_bytes+= skb->len;
++      stats->rx_bytes+= info->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);
++              q->enqueue(skb_get(info->skb), q);
++              if (skb_shared(info->skb)) {
++                      info->skb->destructor = imq_skb_destructor;
++                      kfree_skb(info->skb);
 +                      ret = 0;
 +              }
 +      }
@@ -216,7 +215,7 @@ Index: linux-2.6.25.1/drivers/net/imq.c
 +      spin_unlock_bh(&dev->queue_lock);
 +
 +      if (skb2)
-+              kfree_skb(ret ? skb : skb2);
++              kfree_skb(ret ? info->skb : skb2);
 +
 +      return ret;
 +}
@@ -398,7 +397,7 @@ Index: linux-2.6.25.1/drivers/net/imq.c
 +    .init = imq_init_module,
 +    .exit = imq_exit_module,
 +};
-+
++ 
 +static int __init imq_init(void)
 +{
 +    return register_pernet_device(&imq_net_ops);
@@ -412,11 +411,9 @@ Index: linux-2.6.25.1/drivers/net/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.25.1/drivers/net/Kconfig
-===================================================================
---- linux-2.6.25.1.orig/drivers/net/Kconfig
-+++ linux-2.6.25.1/drivers/net/Kconfig
-@@ -117,6 +117,129 @@ config EQUALIZER
+--- a/drivers/net/Kconfig
++++ b/drivers/net/Kconfig
+@@ -117,6 +117,129 @@
          To compile this driver as a module, choose M here: the module
          will be called eql.  If unsure, say N.
  
@@ -546,11 +543,9 @@ Index: linux-2.6.25.1/drivers/net/Kconfig
  config TUN
        tristate "Universal TUN/TAP device driver support"
        select CRC32
-Index: linux-2.6.25.1/drivers/net/Makefile
-===================================================================
---- linux-2.6.25.1.orig/drivers/net/Makefile
-+++ linux-2.6.25.1/drivers/net/Makefile
-@@ -143,6 +143,7 @@ obj-$(CONFIG_SLHC) += slhc.o
+--- a/drivers/net/Makefile
++++ b/drivers/net/Makefile
+@@ -143,6 +143,7 @@
  obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o
  
  obj-$(CONFIG_DUMMY) += dummy.o
@@ -558,10 +553,8 @@ Index: linux-2.6.25.1/drivers/net/Makefile
  obj-$(CONFIG_IFB) += ifb.o
  obj-$(CONFIG_MACVLAN) += macvlan.o
  obj-$(CONFIG_DE600) += de600.o
-Index: linux-2.6.25.1/include/linux/imq.h
-===================================================================
 --- /dev/null
-+++ linux-2.6.25.1/include/linux/imq.h
++++ b/include/linux/imq.h
 @@ -0,0 +1,9 @@
 +#ifndef _IMQ_H
 +#define _IMQ_H
@@ -572,10 +565,8 @@ Index: linux-2.6.25.1/include/linux/imq.h
 +#define IMQ_F_ENQUEUE  0x80
 +
 +#endif /* _IMQ_H */
-Index: linux-2.6.25.1/include/linux/netfilter_ipv4/ipt_IMQ.h
-===================================================================
 --- /dev/null
-+++ linux-2.6.25.1/include/linux/netfilter_ipv4/ipt_IMQ.h
++++ b/include/linux/netfilter_ipv4/ipt_IMQ.h
 @@ -0,0 +1,8 @@
 +#ifndef _IPT_IMQ_H
 +#define _IPT_IMQ_H
@@ -585,10 +576,8 @@ Index: linux-2.6.25.1/include/linux/netfilter_ipv4/ipt_IMQ.h
 +};
 +
 +#endif /* _IPT_IMQ_H */
-Index: linux-2.6.25.1/include/linux/netfilter_ipv6/ip6t_IMQ.h
-===================================================================
 --- /dev/null
-+++ linux-2.6.25.1/include/linux/netfilter_ipv6/ip6t_IMQ.h
++++ b/include/linux/netfilter_ipv6/ip6t_IMQ.h
 @@ -0,0 +1,8 @@
 +#ifndef _IP6T_IMQ_H
 +#define _IP6T_IMQ_H
@@ -598,36 +587,32 @@ Index: linux-2.6.25.1/include/linux/netfilter_ipv6/ip6t_IMQ.h
 +};
 +
 +#endif /* _IP6T_IMQ_H */
-Index: linux-2.6.25.1/include/linux/skbuff.h
-===================================================================
---- linux-2.6.25.1.orig/include/linux/skbuff.h
-+++ linux-2.6.25.1/include/linux/skbuff.h
-@@ -296,6 +296,10 @@ struct sk_buff {
+--- a/include/linux/skbuff.h
++++ b/include/linux/skbuff.h
+@@ -296,6 +296,10 @@
        struct nf_conntrack     *nfct;
        struct sk_buff          *nfct_reasm;
  #endif
 +#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+      unsigned char           imq_flags;
-+      struct nf_info          *nf_info;
++      unsigned char                   imq_flags;
++      struct nf_queue_entry   *nf_queue_entry;
 +#endif
  #ifdef CONFIG_BRIDGE_NETFILTER
        struct nf_bridge_info   *nf_bridge;
  #endif
-@@ -1736,6 +1740,10 @@ static inline void __nf_copy(struct sk_b
+@@ -1736,6 +1740,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;
++      dst->nf_queue_entry = src->nf_queue_entry;
 +#endif
  #ifdef CONFIG_BRIDGE_NETFILTER
        dst->nf_bridge  = src->nf_bridge;
        nf_bridge_get(src->nf_bridge);
-Index: linux-2.6.25.1/net/core/dev.c
-===================================================================
---- linux-2.6.25.1.orig/net/core/dev.c
-+++ linux-2.6.25.1/net/core/dev.c
+--- a/net/core/dev.c
++++ b/net/core/dev.c
 @@ -95,6 +95,9 @@
  #include <net/net_namespace.h>
  #include <net/sock.h>
@@ -638,7 +623,7 @@ Index: linux-2.6.25.1/net/core/dev.c
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
  #include <linux/stat.h>
-@@ -1537,7 +1540,11 @@ static int dev_gso_segment(struct sk_buf
+@@ -1537,7 +1540,11 @@
  int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
  {
        if (likely(!skb->next)) {
@@ -651,10 +636,8 @@ Index: linux-2.6.25.1/net/core/dev.c
                        dev_queue_xmit_nit(skb, dev);
  
                if (netif_needs_gso(dev, skb)) {
-Index: linux-2.6.25.1/net/ipv4/netfilter/ipt_IMQ.c
-===================================================================
 --- /dev/null
-+++ linux-2.6.25.1/net/ipv4/netfilter/ipt_IMQ.c
++++ b/net/ipv4/netfilter/ipt_IMQ.c
 @@ -0,0 +1,69 @@
 +/*
 + * This target marks packets to be enqueued to an imq device
@@ -725,17 +708,15 @@ Index: linux-2.6.25.1/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.25.1/net/ipv4/netfilter/Kconfig
-===================================================================
---- linux-2.6.25.1.orig/net/ipv4/netfilter/Kconfig
-+++ linux-2.6.25.1/net/ipv4/netfilter/Kconfig
-@@ -315,6 +315,17 @@ config IP_NF_MANGLE
+--- a/net/ipv4/netfilter/Kconfig
++++ b/net/ipv4/netfilter/Kconfig
+@@ -145,6 +145,17 @@
  
          To compile it as a module, choose M here.  If unsure, say N.
  
 +config IP_NF_TARGET_IMQ
 +       tristate "IMQ target support"
-+       depends on IP_NF_MANGLE && IMQ
++       depends on IP_NF_MANGLE
 +       help
 +         This option adds a `IMQ' target which is used to specify if and
 +         to which IMQ device packets should get enqueued/dequeued.
@@ -744,14 +725,12 @@ Index: linux-2.6.25.1/net/ipv4/netfilter/Kconfig
 +
 +         To compile it as a module, choose M here.  If unsure, say N.
 +
- config IP_NF_TARGET_ECN
-       tristate "ECN target support"
-       depends on IP_NF_MANGLE
-Index: linux-2.6.25.1/net/ipv4/netfilter/Makefile
-===================================================================
---- linux-2.6.25.1.orig/net/ipv4/netfilter/Makefile
-+++ linux-2.6.25.1/net/ipv4/netfilter/Makefile
-@@ -55,6 +55,7 @@ obj-$(CONFIG_IP_NF_MATCH_IPP2P) += ipt_i
+ config IP_NF_TARGET_REJECT
+       tristate "REJECT target support"
+       depends on IP_NF_FILTER
+--- a/net/ipv4/netfilter/Makefile
++++ b/net/ipv4/netfilter/Makefile
+@@ -55,6 +55,7 @@
  obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
  obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
  obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o
@@ -759,10 +738,8 @@ Index: linux-2.6.25.1/net/ipv4/netfilter/Makefile
  obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
  obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
  obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
-Index: linux-2.6.25.1/net/ipv6/netfilter/ip6t_IMQ.c
-===================================================================
 --- /dev/null
-+++ linux-2.6.25.1/net/ipv6/netfilter/ip6t_IMQ.c
++++ b/net/ipv6/netfilter/ip6t_IMQ.c
 @@ -0,0 +1,69 @@
 +/*
 + * This target marks packets to be enqueued to an imq device
@@ -833,11 +810,9 @@ Index: linux-2.6.25.1/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.25.1/net/ipv6/netfilter/Kconfig
-===================================================================
---- linux-2.6.25.1.orig/net/ipv6/netfilter/Kconfig
-+++ linux-2.6.25.1/net/ipv6/netfilter/Kconfig
-@@ -179,6 +179,15 @@ config IP6_NF_MANGLE
+--- a/net/ipv6/netfilter/Kconfig
++++ b/net/ipv6/netfilter/Kconfig
+@@ -179,6 +179,15 @@
  
          To compile it as a module, choose M here.  If unsure, say N.
  
@@ -853,10 +828,8 @@ Index: linux-2.6.25.1/net/ipv6/netfilter/Kconfig
  config IP6_NF_TARGET_HL
        tristate  'HL (hoplimit) target support'
        depends on IP6_NF_MANGLE
-Index: linux-2.6.25.1/net/ipv6/netfilter/Makefile
-===================================================================
---- linux-2.6.25.1.orig/net/ipv6/netfilter/Makefile
-+++ linux-2.6.25.1/net/ipv6/netfilter/Makefile
+--- a/net/ipv6/netfilter/Makefile
++++ b/net/ipv6/netfilter/Makefile
 @@ -6,6 +6,7 @@
  obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o
  obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
@@ -865,11 +838,9 @@ Index: linux-2.6.25.1/net/ipv6/netfilter/Makefile
  obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
  obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o
  
-Index: linux-2.6.25.1/net/sched/sch_generic.c
-===================================================================
---- linux-2.6.25.1.orig/net/sched/sch_generic.c
-+++ linux-2.6.25.1/net/sched/sch_generic.c
-@@ -182,6 +182,13 @@ static inline int qdisc_restart(struct n
+--- a/net/sched/sch_generic.c
++++ b/net/sched/sch_generic.c
+@@ -182,6 +182,12 @@
        return ret;
  }
  
@@ -877,7 +848,6 @@ Index: linux-2.6.25.1/net/sched/sch_generic.c
 +{
 +      return qdisc_restart(dev);
 +}
-+
 +EXPORT_SYMBOL(qdisc_restart1);
 +
  void __qdisc_run(struct net_device *dev)