import from old webserver
This commit is contained in:
commit
ef633b2cf4
182 changed files with 69233 additions and 0 deletions
1
noc/patches/bind-9.3.1-configure.sh
Normal file
1
noc/patches/bind-9.3.1-configure.sh
Normal file
|
@ -0,0 +1 @@
|
|||
./configure --prefix=/usr --sysconfdir=/etc/namedb --localstatedir=/var --disable-threads --enable-libbind --enable-ipv6 --with-openssl=no
|
220
noc/patches/iptables-1.3.0-imq1.diff
Normal file
220
noc/patches/iptables-1.3.0-imq1.diff
Normal file
|
@ -0,0 +1,220 @@
|
|||
--- userspace/extensions.orig/.IMQ-test6 Thu Jan 1 01:00:00 1970
|
||||
+++ userspace/extensions/.IMQ-test6 Mon Jun 16 10:12:47 2003
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/sh
|
||||
+# True if IMQ target patch is applied.
|
||||
+[ -f $KERNEL_DIR/net/ipv6/netfilter/ip6t_IMQ.c ] && echo IMQ
|
||||
--- userspace/extensions.orig/libip6t_IMQ.c Thu Jan 1 01:00:00 1970
|
||||
+++ userspace/extensions/libip6t_IMQ.c Mon Jun 16 10:12:47 2003
|
||||
@@ -0,0 +1,101 @@
|
||||
+/* Shared library add-on to iptables to add IMQ target support. */
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <getopt.h>
|
||||
+
|
||||
+#include <ip6tables.h>
|
||||
+#include <linux/netfilter_ipv6/ip6_tables.h>
|
||||
+#include <linux/netfilter_ipv6/ip6t_IMQ.h>
|
||||
+
|
||||
+/* Function which prints out usage message. */
|
||||
+static void
|
||||
+help(void)
|
||||
+{
|
||||
+ printf(
|
||||
+"IMQ target v%s options:\n"
|
||||
+" --todev <N> enqueue to imq<N>, defaults to 0\n",
|
||||
+IPTABLES_VERSION);
|
||||
+}
|
||||
+
|
||||
+static struct option opts[] = {
|
||||
+ { "todev", 1, 0, '1' },
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
+/* Initialize the target. */
|
||||
+static void
|
||||
+init(struct ip6t_entry_target *t, unsigned int *nfcache)
|
||||
+{
|
||||
+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)t->data;
|
||||
+
|
||||
+ mr->todev = 0;
|
||||
+ *nfcache |= NFC_UNKNOWN;
|
||||
+}
|
||||
+
|
||||
+/* Function which parses command options; returns true if it
|
||||
+ ate an option */
|
||||
+static int
|
||||
+parse(int c, char **argv, int invert, unsigned int *flags,
|
||||
+ const struct ip6t_entry *entry,
|
||||
+ struct ip6t_entry_target **target)
|
||||
+{
|
||||
+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)(*target)->data;
|
||||
+
|
||||
+ switch(c) {
|
||||
+ case '1':
|
||||
+ if (check_inverse(optarg, &invert, NULL, 0))
|
||||
+ exit_error(PARAMETER_PROBLEM,
|
||||
+ "Unexpected `!' after --todev");
|
||||
+ mr->todev=atoi(optarg);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+final_check(unsigned int flags)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+/* Prints out the targinfo. */
|
||||
+static void
|
||||
+print(const struct ip6t_ip6 *ip,
|
||||
+ const struct ip6t_entry_target *target,
|
||||
+ int numeric)
|
||||
+{
|
||||
+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
|
||||
+
|
||||
+ printf("IMQ: todev %u ", mr->todev);
|
||||
+}
|
||||
+
|
||||
+/* Saves the union ipt_targinfo in parsable form to stdout. */
|
||||
+static void
|
||||
+save(const struct ip6t_ip6 *ip, const struct ip6t_entry_target *target)
|
||||
+{
|
||||
+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
|
||||
+
|
||||
+ printf("--todev %u", mr->todev);
|
||||
+}
|
||||
+
|
||||
+static struct ip6tables_target imq = {
|
||||
+ .next = NULL,
|
||||
+ .name = "IMQ",
|
||||
+ .version = IPTABLES_VERSION,
|
||||
+ .size = IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
|
||||
+ .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
|
||||
+ .help = &help,
|
||||
+ .init = &init,
|
||||
+ .parse = &parse,
|
||||
+ .final_check = &final_check,
|
||||
+ .print = &print,
|
||||
+ .save = &save,
|
||||
+ .extra_opts = opts
|
||||
+};
|
||||
+
|
||||
+void _init(void)
|
||||
+{
|
||||
+ register_target6(&imq);
|
||||
+}
|
||||
--- userspace/extensions.orig/.IMQ-test Thu Jan 1 01:00:00 1970
|
||||
+++ userspace/extensions/.IMQ-test Mon Jun 16 10:12:47 2003
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/sh
|
||||
+# True if IMQ target patch is applied.
|
||||
+[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_IMQ.c ] && echo IMQ
|
||||
--- userspace/extensions.orig/libipt_IMQ.c Thu Jan 1 01:00:00 1970
|
||||
+++ userspace/extensions/libipt_IMQ.c Mon Jun 16 10:12:47 2003
|
||||
@@ -0,0 +1,101 @@
|
||||
+/* Shared library add-on to iptables to add IMQ target support. */
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <getopt.h>
|
||||
+
|
||||
+#include <iptables.h>
|
||||
+#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
+#include <linux/netfilter_ipv4/ipt_IMQ.h>
|
||||
+
|
||||
+/* Function which prints out usage message. */
|
||||
+static void
|
||||
+help(void)
|
||||
+{
|
||||
+ printf(
|
||||
+"IMQ target v%s options:\n"
|
||||
+" --todev <N> enqueue to imq<N>, defaults to 0\n",
|
||||
+IPTABLES_VERSION);
|
||||
+}
|
||||
+
|
||||
+static struct option opts[] = {
|
||||
+ { "todev", 1, 0, '1' },
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
+/* Initialize the target. */
|
||||
+static void
|
||||
+init(struct ipt_entry_target *t, unsigned int *nfcache)
|
||||
+{
|
||||
+ struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data;
|
||||
+
|
||||
+ mr->todev = 0;
|
||||
+ *nfcache |= NFC_UNKNOWN;
|
||||
+}
|
||||
+
|
||||
+/* Function which parses command options; returns true if it
|
||||
+ ate an option */
|
||||
+static int
|
||||
+parse(int c, char **argv, int invert, unsigned int *flags,
|
||||
+ const struct ipt_entry *entry,
|
||||
+ struct ipt_entry_target **target)
|
||||
+{
|
||||
+ struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data;
|
||||
+
|
||||
+ switch(c) {
|
||||
+ case '1':
|
||||
+ if (check_inverse(optarg, &invert, NULL, 0))
|
||||
+ exit_error(PARAMETER_PROBLEM,
|
||||
+ "Unexpected `!' after --todev");
|
||||
+ mr->todev=atoi(optarg);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+final_check(unsigned int flags)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+/* Prints out the targinfo. */
|
||||
+static void
|
||||
+print(const struct ipt_ip *ip,
|
||||
+ const struct ipt_entry_target *target,
|
||||
+ int numeric)
|
||||
+{
|
||||
+ struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
|
||||
+
|
||||
+ printf("IMQ: todev %u ", mr->todev);
|
||||
+}
|
||||
+
|
||||
+/* Saves the union ipt_targinfo in parsable form to stdout. */
|
||||
+static void
|
||||
+save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
|
||||
+{
|
||||
+ struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
|
||||
+
|
||||
+ printf("--todev %u", mr->todev);
|
||||
+}
|
||||
+
|
||||
+static struct iptables_target imq = {
|
||||
+ .next = NULL,
|
||||
+ .name = "IMQ",
|
||||
+ .version = IPTABLES_VERSION,
|
||||
+ .size = IPT_ALIGN(sizeof(struct ipt_imq_info)),
|
||||
+ .userspacesize = IPT_ALIGN(sizeof(struct ipt_imq_info)),
|
||||
+ .help = &help,
|
||||
+ .init = &init,
|
||||
+ .parse = &parse,
|
||||
+ .final_check = &final_check,
|
||||
+ .print = &print,
|
||||
+ .save = &save,
|
||||
+ .extra_opts = opts
|
||||
+};
|
||||
+
|
||||
+void _init(void)
|
||||
+{
|
||||
+ register_target(&imq);
|
||||
+}
|
BIN
noc/patches/iptables-svn-sinabox.tar.bz2
Normal file
BIN
noc/patches/iptables-svn-sinabox.tar.bz2
Normal file
Binary file not shown.
BIN
noc/patches/kernel-image-2.6.11.5_10.00.Custom_i386.deb
Normal file
BIN
noc/patches/kernel-image-2.6.11.5_10.00.Custom_i386.deb
Normal file
Binary file not shown.
1843
noc/patches/linux-2.6.11.4.config
Normal file
1843
noc/patches/linux-2.6.11.4.config
Normal file
File diff suppressed because it is too large
Load diff
26281
noc/patches/linux-2.6.11.5-sinabox.diff
Normal file
26281
noc/patches/linux-2.6.11.5-sinabox.diff
Normal file
File diff suppressed because it is too large
Load diff
841
noc/patches/linux-2.6.9-imq1.diff
Normal file
841
noc/patches/linux-2.6.9-imq1.diff
Normal file
|
@ -0,0 +1,841 @@
|
|||
diff -Nru linux-2.6.9.orig/drivers/net/Kconfig linux-2.6.9/drivers/net/Kconfig
|
||||
--- linux-2.6.9.orig/drivers/net/Kconfig 2004-10-18 21:55:06.000000000 +0000
|
||||
+++ linux-2.6.9/drivers/net/Kconfig 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -81,6 +81,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.
|
||||
+
|
||||
+ 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.
|
||||
+
|
||||
+choice
|
||||
+ prompt "IMQ behavior (PRE/POSTROUTING)"
|
||||
+ depends on IMQ
|
||||
+ default IMQ_BEHAVIOR_BA
|
||||
+ help
|
||||
+
|
||||
+ This settings defines how IMQ behaves in respect to its
|
||||
+ hooking in PREROUTING and POSTROUTING.
|
||||
+
|
||||
+ 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
|
||||
+
|
||||
+ 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.
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ 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.
|
||||
+
|
||||
+ Choosing this option will make IMQ hook like this:
|
||||
+
|
||||
+ PREROUTING: After NAT
|
||||
+ POSTROUTING: After NAT
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ 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.
|
||||
+
|
||||
+ Choosing this option will make IMQ hook like this:
|
||||
+
|
||||
+ PREROUTING: After NAT
|
||||
+ POSTROUTING: Before NAT
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ 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.
|
||||
+
|
||||
+ Choosing this option will make IMQ hook like this:
|
||||
+
|
||||
+ PREROUTING: Before NAT
|
||||
+ POSTROUTING: After NAT
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ 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.
|
||||
+
|
||||
+ Choosing this option will make IMQ hook like this:
|
||||
+
|
||||
+ PREROUTING: Before NAT
|
||||
+ POSTROUTING: Before NAT
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ If not sure leave the default settings alone.
|
||||
+
|
||||
+endchoice
|
||||
+
|
||||
+config IMQ_NUM_DEVS
|
||||
+
|
||||
+ int "Number of IMQ devices"
|
||||
+ range 2 8
|
||||
+ depends on IMQ
|
||||
+ default "2"
|
||||
+ help
|
||||
+
|
||||
+ This settings defines how many IMQ devices will be
|
||||
+ created.
|
||||
+
|
||||
+ The default value is 2.
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ If not sure leave the default settings alone.
|
||||
+
|
||||
config TUN
|
||||
tristate "Universal TUN/TAP device driver support"
|
||||
depends on NETDEVICES
|
||||
diff -Nru linux-2.6.9.orig/drivers/net/Makefile linux-2.6.9/drivers/net/Makefile
|
||||
--- linux-2.6.9.orig/drivers/net/Makefile 2004-10-18 21:53:45.000000000 +0000
|
||||
+++ linux-2.6.9/drivers/net/Makefile 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -113,6 +113,7 @@
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_DUMMY) += dummy.o
|
||||
+obj-$(CONFIG_IMQ) += imq.o
|
||||
obj-$(CONFIG_DE600) += de600.o
|
||||
obj-$(CONFIG_DE620) += de620.o
|
||||
obj-$(CONFIG_LANCE) += lance.o
|
||||
diff -Nru linux-2.6.9.orig/drivers/net/imq.c linux-2.6.9/drivers/net/imq.c
|
||||
--- linux-2.6.9.orig/drivers/net/imq.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.9/drivers/net/imq.c 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -0,0 +1,387 @@
|
||||
+/*
|
||||
+ * Pseudo-driver for the intermediate queue device.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version
|
||||
+ * 2 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * Authors: Patrick McHardy, <kaber@trash.net>
|
||||
+ *
|
||||
+ * The first version was written by Martin Devera, <devik@cdi.cz>
|
||||
+ *
|
||||
+ * Credits: Jan Rafaj <imq2t@cedric.vabo.cz>
|
||||
+ * - Update patch to 2.4.21
|
||||
+ * Sebastian Strollo <sstrollo@nortelnetworks.com>
|
||||
+ * - Fix "Dead-loop on netdevice imq"-issue
|
||||
+ * Marcel Sebek <sebek64@post.cz>
|
||||
+ * - Update to 2.6.2-rc1
|
||||
+ *
|
||||
+ * After some time of inactivity there is a group taking care
|
||||
+ * of IMQ again: http://www.linuximq.net
|
||||
+ *
|
||||
+ *
|
||||
+ * 2004/06/30 - New version of IMQ patch to kernels <=2.6.7 including
|
||||
+ * the following changes:
|
||||
+ *
|
||||
+ * - Correction of ipv6 support "+"s issue (Hasso Tepper)
|
||||
+ * - 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
|
||||
+ * PRE and POSTROUTING (after or before NAT) (Andre Correa)
|
||||
+ * - Cosmetic corrections (Norbert Buchmuller) (Andre Correa)
|
||||
+ *
|
||||
+ * More info at: http://www.linuximq.net/ (2004-04-22)
|
||||
+ */
|
||||
+
|
||||
+#include <linux/config.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/moduleparam.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/netdevice.h>
|
||||
+#include <linux/rtnetlink.h>
|
||||
+#include <linux/if_arp.h>
|
||||
+#include <linux/netfilter.h>
|
||||
+#include <linux/netfilter_ipv4.h>
|
||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
+ #include <linux/netfilter_ipv6.h>
|
||||
+#endif
|
||||
+#include <linux/imq.h>
|
||||
+#include <net/pkt_sched.h>
|
||||
+
|
||||
+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,
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
|
||||
+ .priority = NF_IP_PRI_MANGLE + 1
|
||||
+#else
|
||||
+ .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,
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
|
||||
+ .priority = NF_IP_PRI_LAST
|
||||
+#else
|
||||
+ .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,
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
|
||||
+ .priority = NF_IP6_PRI_MANGLE + 1
|
||||
+#else
|
||||
+ .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,
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
|
||||
+ .priority = NF_IP6_PRI_LAST
|
||||
+#else
|
||||
+ .priority = NF_IP6_PRI_NAT_SRC - 1
|
||||
+#endif
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+#if defined(CONFIG_IMQ_NUM_DEVS)
|
||||
+static unsigned int numdevs = CONFIG_IMQ_NUM_DEVS;
|
||||
+#else
|
||||
+static unsigned int numdevs = 2;
|
||||
+#endif
|
||||
+
|
||||
+static struct net_device *imq_devs;
|
||||
+
|
||||
+static struct net_device_stats *imq_get_stats(struct net_device *dev)
|
||||
+{
|
||||
+ 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;
|
||||
+
|
||||
+ 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;
|
||||
+
|
||||
+ stats->tx_bytes += skb->len;
|
||||
+ stats->tx_packets++;
|
||||
+
|
||||
+ skb->imq_flags = 0;
|
||||
+ skb->destructor = NULL;
|
||||
+
|
||||
+ 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, 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 */;
|
||||
+
|
||||
+ spin_unlock_bh(&dev->queue_lock);
|
||||
+
|
||||
+ if (skb2)
|
||||
+ kfree_skb(ret ? skb : skb2);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+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 *))
|
||||
+{
|
||||
+ if ((*pskb)->imq_flags & IMQ_F_ENQUEUE)
|
||||
+ return NF_QUEUE;
|
||||
+
|
||||
+ return NF_ACCEPT;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int __init imq_init_hooks(void)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ err = nf_register_queue_handler(PF_INET, imq_nf_queue, NULL);
|
||||
+ 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, imq_nf_queue, NULL)))
|
||||
+ 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;
|
||||
+
|
||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
+err6:
|
||||
+ nf_unregister_hook(&imq_ingress_ipv6);
|
||||
+err5:
|
||||
+ nf_unregister_queue_handler(PF_INET6);
|
||||
+err4:
|
||||
+ nf_unregister_hook(&imq_egress_ipv4);
|
||||
+#endif
|
||||
+err3:
|
||||
+ nf_unregister_hook(&imq_ingress_ipv4);
|
||||
+err2:
|
||||
+ nf_unregister_queue_handler(PF_INET);
|
||||
+err1:
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static void __exit imq_unhook(void)
|
||||
+{
|
||||
+ nf_unregister_hook(&imq_ingress_ipv4);
|
||||
+ nf_unregister_hook(&imq_egress_ipv4);
|
||||
+ nf_unregister_queue_handler(PF_INET);
|
||||
+#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);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+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->flags = IFF_NOARP;
|
||||
+ dev->priv = kmalloc(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;
|
||||
+}
|
||||
+
|
||||
+static void imq_dev_uninit(struct net_device *dev)
|
||||
+{
|
||||
+ kfree(dev->priv);
|
||||
+}
|
||||
+
|
||||
+static int __init imq_init_devs(void)
|
||||
+{
|
||||
+ struct net_device *dev;
|
||||
+ int i,j;
|
||||
+ j = numdevs;
|
||||
+
|
||||
+ if (!numdevs || numdevs > IMQ_MAX_DEVS) {
|
||||
+ printk(KERN_ERR "IMQ: numdevs has to be betweed 1 and %u\n",
|
||||
+ IMQ_MAX_DEVS);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ imq_devs = kmalloc(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--;
|
||||
+
|
||||
+ for (i = 0, dev = imq_devs; i <= numdevs; i++, dev++) {
|
||||
+ SET_MODULE_OWNER(dev);
|
||||
+ strcpy(dev->name, "imq%d");
|
||||
+ dev->init = imq_dev_init;
|
||||
+ dev->uninit = imq_dev_uninit;
|
||||
+
|
||||
+ if (register_netdev(dev) < 0)
|
||||
+ goto err_register;
|
||||
+ }
|
||||
+ printk(KERN_INFO "IMQ starting with %u devices...\n", j);
|
||||
+ return 0;
|
||||
+
|
||||
+err_register:
|
||||
+ for (; i; i--)
|
||||
+ unregister_netdev(--dev);
|
||||
+ kfree(imq_devs);
|
||||
+ return -EIO;
|
||||
+}
|
||||
+
|
||||
+static void imq_cleanup_devs(void)
|
||||
+{
|
||||
+ int i;
|
||||
+ struct net_device *dev = imq_devs;
|
||||
+
|
||||
+ for (i = 0; i <= numdevs; i++)
|
||||
+ unregister_netdev(dev++);
|
||||
+
|
||||
+ kfree(imq_devs);
|
||||
+}
|
||||
+
|
||||
+static int __init imq_init_module(void)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ if ((err = imq_init_devs())) {
|
||||
+ printk(KERN_ERR "IMQ: Error trying imq_init_devs()\n");
|
||||
+ return err;
|
||||
+ }
|
||||
+ if ((err = imq_init_hooks())) {
|
||||
+ printk(KERN_ERR "IMQ: Error trying imq_init_hooks()\n");
|
||||
+ imq_cleanup_devs();
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ printk(KERN_INFO "IMQ driver loaded successfully.\n");
|
||||
+
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
|
||||
+ printk(KERN_INFO "\tHooking IMQ before NAT on PREROUTING.\n");
|
||||
+#else
|
||||
+ printk(KERN_INFO "\tHooking IMQ after NAT on PREROUTING.\n");
|
||||
+#endif
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_AB) || defined(CONFIG_IMQ_BEHAVIOR_BB)
|
||||
+ printk(KERN_INFO "\tHooking IMQ before NAT on POSTROUTING.\n");
|
||||
+#else
|
||||
+ printk(KERN_INFO "\tHooking IMQ after NAT on POSTROUTING.\n");
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit imq_cleanup_module(void)
|
||||
+{
|
||||
+ imq_unhook();
|
||||
+ imq_cleanup_devs();
|
||||
+ printk(KERN_INFO "IMQ driver unloaded successfully.\n");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+module_init(imq_init_module);
|
||||
+module_exit(imq_cleanup_module);
|
||||
+
|
||||
+module_param(numdevs, int, 0);
|
||||
+MODULE_PARM_DESC(numdevs, "number of IMQ devices (how many imq* devices will be created)");
|
||||
+MODULE_AUTHOR("");
|
||||
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+
|
||||
+
|
||||
diff -Nru linux-2.6.9.orig/include/linux/imq.h linux-2.6.9/include/linux/imq.h
|
||||
--- linux-2.6.9.orig/include/linux/imq.h 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.9/include/linux/imq.h 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -0,0 +1,9 @@
|
||||
+#ifndef _IMQ_H
|
||||
+#define _IMQ_H
|
||||
+
|
||||
+#define IMQ_MAX_DEVS 16
|
||||
+
|
||||
+#define IMQ_F_IFMASK 0x7f
|
||||
+#define IMQ_F_ENQUEUE 0x80
|
||||
+
|
||||
+#endif /* _IMQ_H */
|
||||
diff -Nru linux-2.6.9.orig/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.6.9/include/linux/netfilter_ipv4/ipt_IMQ.h
|
||||
--- linux-2.6.9.orig/include/linux/netfilter_ipv4/ipt_IMQ.h 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.9/include/linux/netfilter_ipv4/ipt_IMQ.h 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -0,0 +1,8 @@
|
||||
+#ifndef _IPT_IMQ_H
|
||||
+#define _IPT_IMQ_H
|
||||
+
|
||||
+struct ipt_imq_info {
|
||||
+ unsigned int todev; /* target imq device */
|
||||
+};
|
||||
+
|
||||
+#endif /* _IPT_IMQ_H */
|
||||
diff -Nru linux-2.6.9.orig/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.6.9/include/linux/netfilter_ipv6/ip6t_IMQ.h
|
||||
--- linux-2.6.9.orig/include/linux/netfilter_ipv6/ip6t_IMQ.h 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.9/include/linux/netfilter_ipv6/ip6t_IMQ.h 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -0,0 +1,8 @@
|
||||
+#ifndef _IP6T_IMQ_H
|
||||
+#define _IP6T_IMQ_H
|
||||
+
|
||||
+struct ip6t_imq_info {
|
||||
+ unsigned int todev; /* target imq device */
|
||||
+};
|
||||
+
|
||||
+#endif /* _IP6T_IMQ_H */
|
||||
diff -Nru linux-2.6.9.orig/include/linux/skbuff.h linux-2.6.9/include/linux/skbuff.h
|
||||
--- linux-2.6.9.orig/include/linux/skbuff.h 2004-10-18 21:55:36.000000000 +0000
|
||||
+++ linux-2.6.9/include/linux/skbuff.h 2004-10-19 18:40:20.000000000 +0000
|
||||
@@ -251,6 +251,11 @@
|
||||
__u32 nfcache;
|
||||
__u32 nfctinfo;
|
||||
struct nf_conntrack *nfct;
|
||||
+
|
||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
||||
+ unsigned char imq_flags;
|
||||
+ struct nf_info *nf_info;
|
||||
+#endif
|
||||
#ifdef CONFIG_NETFILTER_DEBUG
|
||||
unsigned int nf_debug;
|
||||
#endif
|
||||
diff -Nru linux-2.6.9.orig/net/ipv4/netfilter/Kconfig linux-2.6.9/net/ipv4/netfilter/Kconfig
|
||||
--- linux-2.6.9.orig/net/ipv4/netfilter/Kconfig 2004-10-18 21:54:55.000000000 +0000
|
||||
+++ linux-2.6.9/net/ipv4/netfilter/Kconfig 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -363,6 +363,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
|
||||
+ help
|
||||
+ This option adds a `IMQ' target which is used to specify if and
|
||||
+ to which IMQ device packets should get enqueued/dequeued.
|
||||
+
|
||||
+ For more information visit: http://www.linuximq.net/
|
||||
+
|
||||
+ To compile it as a module, choose M here. If unsure, say N.
|
||||
+
|
||||
config IP_NF_TARGET_LOG
|
||||
tristate "LOG target support"
|
||||
depends on IP_NF_IPTABLES
|
||||
diff -Nru linux-2.6.9.orig/net/ipv4/netfilter/Makefile linux-2.6.9/net/ipv4/netfilter/Makefile
|
||||
--- linux-2.6.9.orig/net/ipv4/netfilter/Makefile 2004-10-18 21:53:43.000000000 +0000
|
||||
+++ linux-2.6.9/net/ipv4/netfilter/Makefile 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -74,6 +74,7 @@
|
||||
obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_DSCP) += ipt_DSCP.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o
|
||||
+obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o
|
||||
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
|
||||
diff -Nru linux-2.6.9.orig/net/ipv4/netfilter/ipt_IMQ.c linux-2.6.9/net/ipv4/netfilter/ipt_IMQ.c
|
||||
--- linux-2.6.9.orig/net/ipv4/netfilter/ipt_IMQ.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.9/net/ipv4/netfilter/ipt_IMQ.c 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -0,0 +1,78 @@
|
||||
+/*
|
||||
+ * This target marks packets to be enqueued to an imq device
|
||||
+ */
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
+#include <linux/netfilter_ipv4/ipt_IMQ.h>
|
||||
+#include <linux/imq.h>
|
||||
+
|
||||
+static unsigned int imq_target(struct sk_buff **pskb,
|
||||
+ const struct net_device *in,
|
||||
+ const struct net_device *out,
|
||||
+ unsigned int hooknum,
|
||||
+ const void *targinfo,
|
||||
+ void *userdata)
|
||||
+{
|
||||
+ struct ipt_imq_info *mr = (struct ipt_imq_info*)targinfo;
|
||||
+
|
||||
+ (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
|
||||
+ (*pskb)->nfcache |= NFC_ALTERED;
|
||||
+
|
||||
+ return IPT_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+static int imq_checkentry(const char *tablename,
|
||||
+ const struct ipt_entry *e,
|
||||
+ void *targinfo,
|
||||
+ unsigned int targinfosize,
|
||||
+ unsigned int hook_mask)
|
||||
+{
|
||||
+ struct ipt_imq_info *mr;
|
||||
+
|
||||
+ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_imq_info))) {
|
||||
+ printk(KERN_WARNING "IMQ: invalid targinfosize\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ mr = (struct ipt_imq_info*)targinfo;
|
||||
+
|
||||
+ if (strcmp(tablename, "mangle") != 0) {
|
||||
+ printk(KERN_WARNING
|
||||
+ "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
|
||||
+ tablename);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (mr->todev > IMQ_MAX_DEVS) {
|
||||
+ printk(KERN_WARNING
|
||||
+ "IMQ: invalid device specified, highest is %u\n",
|
||||
+ IMQ_MAX_DEVS);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static struct ipt_target ipt_imq_reg = {
|
||||
+ .name = "IMQ",
|
||||
+ .target = imq_target,
|
||||
+ .checkentry = imq_checkentry,
|
||||
+ .me = THIS_MODULE
|
||||
+};
|
||||
+
|
||||
+static int __init init(void)
|
||||
+{
|
||||
+ if (ipt_register_target(&ipt_imq_reg))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit fini(void)
|
||||
+{
|
||||
+ ipt_unregister_target(&ipt_imq_reg);
|
||||
+}
|
||||
+
|
||||
+module_init(init);
|
||||
+module_exit(fini);
|
||||
+MODULE_LICENSE("GPL");
|
||||
diff -Nru linux-2.6.9.orig/net/ipv6/netfilter/Kconfig linux-2.6.9/net/ipv6/netfilter/Kconfig
|
||||
--- linux-2.6.9.orig/net/ipv6/netfilter/Kconfig 2004-10-18 21:55:06.000000000 +0000
|
||||
+++ linux-2.6.9/net/ipv6/netfilter/Kconfig 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -187,6 +187,15 @@
|
||||
|
||||
To compile it as a module, choose M here. If unsure, say N.
|
||||
|
||||
+config IP6_NF_TARGET_IMQ
|
||||
+ tristate "IMQ target support"
|
||||
+ depends on IP6_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.
|
||||
+
|
||||
+ To compile it as a module, choose M here. If unsure, say N.
|
||||
+
|
||||
config IP6_NF_TARGET_LOG
|
||||
tristate "LOG target support"
|
||||
depends on IP6_NF_FILTER
|
||||
diff -Nru linux-2.6.9.orig/net/ipv6/netfilter/Makefile linux-2.6.9/net/ipv6/netfilter/Makefile
|
||||
--- linux-2.6.9.orig/net/ipv6/netfilter/Makefile 2004-10-18 21:54:32.000000000 +0000
|
||||
+++ linux-2.6.9/net/ipv6/netfilter/Makefile 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -20,6 +20,7 @@
|
||||
obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
|
||||
obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
|
||||
obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o
|
||||
+obj-$(CONFIG_IP6_NF_TARGET_IMQ) += ip6t_IMQ.o
|
||||
obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
|
||||
obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
|
||||
obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o
|
||||
diff -Nru linux-2.6.9.orig/net/ipv6/netfilter/ip6t_IMQ.c linux-2.6.9/net/ipv6/netfilter/ip6t_IMQ.c
|
||||
--- linux-2.6.9.orig/net/ipv6/netfilter/ip6t_IMQ.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.9/net/ipv6/netfilter/ip6t_IMQ.c 2004-10-19 18:34:52.000000000 +0000
|
||||
@@ -0,0 +1,78 @@
|
||||
+/*
|
||||
+ * This target marks packets to be enqueued to an imq device
|
||||
+ */
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/netfilter_ipv6/ip6_tables.h>
|
||||
+#include <linux/netfilter_ipv6/ip6t_IMQ.h>
|
||||
+#include <linux/imq.h>
|
||||
+
|
||||
+static unsigned int imq_target(struct sk_buff **pskb,
|
||||
+ unsigned int hooknum,
|
||||
+ const struct net_device *in,
|
||||
+ const struct net_device *out,
|
||||
+ const void *targinfo,
|
||||
+ void *userdata)
|
||||
+{
|
||||
+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)targinfo;
|
||||
+
|
||||
+ (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
|
||||
+ (*pskb)->nfcache |= NFC_ALTERED;
|
||||
+
|
||||
+ return IP6T_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+static int imq_checkentry(const char *tablename,
|
||||
+ const struct ip6t_entry *e,
|
||||
+ void *targinfo,
|
||||
+ unsigned int targinfosize,
|
||||
+ unsigned int hook_mask)
|
||||
+{
|
||||
+ struct ip6t_imq_info *mr;
|
||||
+
|
||||
+ if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_imq_info))) {
|
||||
+ printk(KERN_WARNING "IMQ: invalid targinfosize\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ mr = (struct ip6t_imq_info*)targinfo;
|
||||
+
|
||||
+ if (strcmp(tablename, "mangle") != 0) {
|
||||
+ printk(KERN_WARNING
|
||||
+ "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
|
||||
+ tablename);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (mr->todev > IMQ_MAX_DEVS) {
|
||||
+ printk(KERN_WARNING
|
||||
+ "IMQ: invalid device specified, highest is %u\n",
|
||||
+ IMQ_MAX_DEVS);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static struct ip6t_target ip6t_imq_reg = {
|
||||
+ .name = "IMQ",
|
||||
+ .target = imq_target,
|
||||
+ .checkentry = imq_checkentry,
|
||||
+ .me = THIS_MODULE
|
||||
+};
|
||||
+
|
||||
+static int __init init(void)
|
||||
+{
|
||||
+ if (ip6t_register_target(&ip6t_imq_reg))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit fini(void)
|
||||
+{
|
||||
+ ip6t_unregister_target(&ip6t_imq_reg);
|
||||
+}
|
||||
+
|
||||
+module_init(init);
|
||||
+module_exit(fini);
|
||||
+MODULE_LICENSE("GPL");
|
||||
diff -Nru linux-2.6.9.orig/net/sched/sch_generic.c linux-2.6.9/net/sched/sch_generic.c
|
||||
--- linux-2.6.9.orig/net/sched/sch_generic.c 2004-10-18 21:53:07.000000000 +0000
|
||||
+++ linux-2.6.9/net/sched/sch_generic.c 2004-10-19 18:45:08.000000000 +0000
|
||||
@@ -29,6 +29,9 @@
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
||||
+#include <linux/imq.h>
|
||||
+#endif
|
||||
#include <linux/init.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/list.h>
|
||||
@@ -136,7 +139,13 @@
|
||||
|
||||
if (!netif_queue_stopped(dev)) {
|
||||
int ret;
|
||||
- if (netdev_nit)
|
||||
+
|
||||
+ if (netdev_nit
|
||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
||||
+ && !(skb->imq_flags & IMQ_F_ENQUEUE)
|
||||
+#endif
|
||||
+ )
|
||||
+
|
||||
dev_queue_xmit_nit(skb, dev);
|
||||
|
||||
ret = dev->hard_start_xmit(skb, dev);
|
13540
noc/patches/usagi-26-s20050314.diff
Normal file
13540
noc/patches/usagi-26-s20050314.diff
Normal file
File diff suppressed because it is too large
Load diff
173
noc/patches/usagi-iptables-s20050314.diff
Normal file
173
noc/patches/usagi-iptables-s20050314.diff
Normal file
|
@ -0,0 +1,173 @@
|
|||
diff -urN iptables-1.2.11/extensions/.state-test6 iptables/extensions/.state-test6
|
||||
--- iptables-1.2.11/extensions/.state-test6 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ iptables/extensions/.state-test6 2003-11-28 04:14:10.000000000 +0100
|
||||
@@ -0,0 +1,2 @@
|
||||
+#!/bin/sh
|
||||
+[ -f $KERNEL_DIR/net/ipv6/netfilter/ip6t_state.c -a -f $KERNEL_DIR/include/linux/netfilter_ipv6/ip6t_state.h ] && echo state
|
||||
diff -urN iptables-1.2.11/extensions/libip6t_state.c iptables/extensions/libip6t_state.c
|
||||
--- iptables-1.2.11/extensions/libip6t_state.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ iptables/extensions/libip6t_state.c 2003-11-28 04:14:10.000000000 +0100
|
||||
@@ -0,0 +1,163 @@
|
||||
+/* Shared library add-on to ip6tables to add state tracking support. */
|
||||
+#include <stdio.h>
|
||||
+#include <netdb.h>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <getopt.h>
|
||||
+#include <ip6tables.h>
|
||||
+#include <linux/netfilter_ipv6/ip6_conntrack.h>
|
||||
+#include <linux/netfilter_ipv6/ip6t_state.h>
|
||||
+
|
||||
+/* Function which prints out usage message. */
|
||||
+static void
|
||||
+help(void)
|
||||
+{
|
||||
+ printf(
|
||||
+"state v%s options:\n"
|
||||
+" [!] --state [INVALID|ESTABLISHED|NEW|RELATED][,...]\n"
|
||||
+" State(s) to match\n"
|
||||
+"\n", IPTABLES_VERSION);
|
||||
+}
|
||||
+
|
||||
+static struct option opts[] = {
|
||||
+ { "state", 1, 0, '1' },
|
||||
+ {0}
|
||||
+};
|
||||
+
|
||||
+/* Initialize the match. */
|
||||
+static void
|
||||
+init(struct ip6t_entry_match *m, unsigned int *nfcache)
|
||||
+{
|
||||
+ /* Can't cache this */
|
||||
+ *nfcache |= NFC_UNKNOWN;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+parse_state(const char *state, size_t strlen, struct ip6t_state_info *sinfo)
|
||||
+{
|
||||
+ if (strncasecmp(state, "INVALID", strlen) == 0)
|
||||
+ sinfo->statemask |= IP6T_STATE_INVALID;
|
||||
+ else if (strncasecmp(state, "NEW", strlen) == 0)
|
||||
+ sinfo->statemask |= IP6T_STATE_BIT(IP6_CT_NEW);
|
||||
+ else if (strncasecmp(state, "ESTABLISHED", strlen) == 0)
|
||||
+ sinfo->statemask |= IP6T_STATE_BIT(IP6_CT_ESTABLISHED);
|
||||
+ else if (strncasecmp(state, "RELATED", strlen) == 0)
|
||||
+ sinfo->statemask |= IP6T_STATE_BIT(IP6_CT_RELATED);
|
||||
+ else
|
||||
+ return 0;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+parse_states(const char *arg, struct ip6t_state_info *sinfo)
|
||||
+{
|
||||
+ const char *comma;
|
||||
+
|
||||
+ while ((comma = strchr(arg, ',')) != NULL) {
|
||||
+ if (comma == arg || !parse_state(arg, comma-arg, sinfo))
|
||||
+ exit_error(PARAMETER_PROBLEM, "Bad state `%s'", arg);
|
||||
+ arg = comma+1;
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(arg) == 0 || !parse_state(arg, strlen(arg), sinfo))
|
||||
+ exit_error(PARAMETER_PROBLEM, "Bad state `%s'", arg);
|
||||
+}
|
||||
+
|
||||
+/* Function which parses command options; returns true if it
|
||||
+ ate an option */
|
||||
+static int
|
||||
+parse(int c, char **argv, int invert, unsigned int *flags,
|
||||
+ const struct ip6t_entry *entry,
|
||||
+ unsigned int *nfcache,
|
||||
+ struct ip6t_entry_match **match)
|
||||
+{
|
||||
+ struct ip6t_state_info *sinfo = (struct ip6t_state_info *)(*match)->data;
|
||||
+
|
||||
+ switch (c) {
|
||||
+ case '1':
|
||||
+ check_inverse(optarg, &invert, &optind, 0);
|
||||
+
|
||||
+ parse_states(argv[optind-1], sinfo);
|
||||
+ if (invert)
|
||||
+ sinfo->statemask = ~sinfo->statemask;
|
||||
+ *flags = 1;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/* Final check; must have specified --state. */
|
||||
+static void final_check(unsigned int flags)
|
||||
+{
|
||||
+ if (!flags)
|
||||
+ exit_error(PARAMETER_PROBLEM, "You must specify `--state'");
|
||||
+}
|
||||
+
|
||||
+static void print_state(unsigned int statemask)
|
||||
+{
|
||||
+ const char *sep = "";
|
||||
+
|
||||
+ if (statemask & IP6T_STATE_INVALID) {
|
||||
+ printf("%sINVALID", sep);
|
||||
+ sep = ",";
|
||||
+ }
|
||||
+ if (statemask & IP6T_STATE_BIT(IP6_CT_NEW)) {
|
||||
+ printf("%sNEW", sep);
|
||||
+ sep = ",";
|
||||
+ }
|
||||
+ if (statemask & IP6T_STATE_BIT(IP6_CT_RELATED)) {
|
||||
+ printf("%sRELATED", sep);
|
||||
+ sep = ",";
|
||||
+ }
|
||||
+ if (statemask & IP6T_STATE_BIT(IP6_CT_ESTABLISHED)) {
|
||||
+ printf("%sESTABLISHED", sep);
|
||||
+ sep = ",";
|
||||
+ }
|
||||
+ printf(" ");
|
||||
+}
|
||||
+
|
||||
+/* Prints out the matchinfo. */
|
||||
+static void
|
||||
+print(const struct ip6t_ip6 *ip,
|
||||
+ const struct ip6t_entry_match *match,
|
||||
+ int numeric)
|
||||
+{
|
||||
+ struct ip6t_state_info *sinfo = (struct ip6t_state_info *)match->data;
|
||||
+
|
||||
+ printf("state ");
|
||||
+ print_state(sinfo->statemask);
|
||||
+}
|
||||
+
|
||||
+/* Saves the matchinfo in parsable form to stdout. */
|
||||
+static void save(const struct ip6t_ip6 *ip, const struct ip6t_entry_match *match)
|
||||
+{
|
||||
+ struct ip6t_state_info *sinfo = (struct ip6t_state_info *)match->data;
|
||||
+
|
||||
+ printf("--state ");
|
||||
+ print_state(sinfo->statemask);
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+struct ip6tables_match state
|
||||
+= { NULL,
|
||||
+ "state",
|
||||
+ IPTABLES_VERSION,
|
||||
+ IP6T_ALIGN(sizeof(struct ip6t_state_info)),
|
||||
+ IP6T_ALIGN(sizeof(struct ip6t_state_info)),
|
||||
+ &help,
|
||||
+ &init,
|
||||
+ &parse,
|
||||
+ &final_check,
|
||||
+ &print,
|
||||
+ &save,
|
||||
+ opts
|
||||
+};
|
||||
+
|
||||
+void _init(void)
|
||||
+{
|
||||
+ register_match6(&state);
|
||||
+}
|
Loading…
Add table
Add a link
Reference in a new issue