From: Patrick McHardy <kaber@trash.net>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] How to mark a device not to be used with IMQ?
Date: Sat, 23 Mar 2002 01:49:23 +0000 [thread overview]
Message-ID: <marc-lartc-101684824014775@msgid-missing> (raw)
In-Reply-To: <marc-lartc-101679987821477@msgid-missing>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 79 bytes --]
Ahh stupid netscape fucked up the attachment :)
Hope this works ..
Bye Patrick
[-- Attachment #2: Type: TEXT/PLAIN, Size: 6349 bytes --]
diff -urN iptables-1.2.6a-clean/extensions/.IMQX-test iptables-1.2.6a/extensions/.IMQX-test
--- iptables-1.2.6a-clean/extensions/.IMQX-test Thu Jan 1 01:00:00 1970
+++ iptables-1.2.6a/extensions/.IMQX-test Sat Mar 23 02:37:20 2002
@@ -0,0 +1,3 @@
+#!/bin/sh
+# True if IMQX target patch is applied.
+[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_IMQX.c ] && echo IMQX
diff -urN iptables-1.2.6a-clean/extensions/libipt_IMQX.c iptables-1.2.6a/extensions/libipt_IMQX.c
--- iptables-1.2.6a-clean/extensions/libipt_IMQX.c Thu Jan 1 01:00:00 1970
+++ iptables-1.2.6a/extensions/libipt_IMQX.c Sat Mar 23 02:37:49 2002
@@ -0,0 +1,81 @@
+/* Shared library add-on to iptables to add IMQX target support. */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+#include <iptables.h>
+#include <linux/netfilter_ipv4/ip_tables.h>
+
+/* Function which prints out usage message. */
+static void
+help(void)
+{
+ printf(
+"IMQX target v%s has no options\n",
+NETFILTER_VERSION);
+}
+
+static struct option opts[] = {
+ { 0 }
+};
+
+/* Initialize the target. */
+static void
+init(struct ipt_entry_target *t, unsigned int *nfcache)
+{
+}
+
+/* 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)
+{
+ if (c)
+ 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)
+{
+ printf("IMQX");
+}
+
+/* Saves the union ipt_targinfo in parsable form to stdout. */
+static void
+save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
+{
+}
+
+static
+struct iptables_target mark
+= { NULL,
+ "IMQX",
+ NETFILTER_VERSION,
+ 0,
+ 0,
+ &help,
+ &init,
+ &parse,
+ &final_check,
+ &print,
+ &save,
+ opts
+};
+
+void _init(void)
+{
+ register_target(&mark);
+}
diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch iptables-1.2.6a/patch-o-matic/extra/IMQX.patch
--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch Thu Jan 1 01:00:00 1970
+++ iptables-1.2.6a/patch-o-matic/extra/IMQX.patch Sat Mar 23 02:37:20 2002
@@ -0,0 +1,60 @@
+diff -urN linux-2.4.18-clean/net/ipv4/netfilter/ipt_IMQX.c linux-2.4.18/net/ipv4/netfilter/ipt_IMQX.c
+--- linux-2.4.18-clean/net/ipv4/netfilter/ipt_IMQX.c Thu Jan 1 01:00:00 1970
++++ linux-2.4.18/net/ipv4/netfilter/ipt_IMQX.c Sat Mar 23 01:48:23 2002
+@@ -0,0 +1,56 @@
++/* This is a module which is used for setting the from_imq field of an skb. */
++#include <linux/module.h>
++#include <linux/skbuff.h>
++#include <linux/ip.h>
++#include <net/checksum.h>
++
++#include <linux/netfilter_ipv4/ip_tables.h>
++
++static unsigned int
++target(struct sk_buff **pskb,
++ unsigned int hooknum,
++ const struct net_device *in,
++ const struct net_device *out,
++ const void *targinfo,
++ void *userinfo)
++{
++ (*pskb)->from_imq = 1;
++ (*pskb)->nfcache |= NFC_ALTERED;
++
++ return IPT_CONTINUE;
++}
++
++static int
++checkentry(const char *tablename,
++ const struct ipt_entry *e,
++ void *targinfo,
++ unsigned int targinfosize,
++ unsigned int hook_mask)
++{
++ if (strcmp(tablename, "mangle") != 0) {
++ printk(KERN_WARNING "IMQX: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
++ return 0;
++ }
++
++ return 1;
++}
++
++static struct ipt_target ipt_imqx_reg
++= { { NULL, NULL }, "IMQX", target, checkentry, NULL, THIS_MODULE };
++
++static int __init init(void)
++{
++ if (ipt_register_target(&ipt_imqx_reg))
++ return -EINVAL;
++
++ return 0;
++}
++
++static void __exit fini(void)
++{
++ ipt_unregister_target(&ipt_imqx_reg);
++}
++
++module_init(init);
++module_exit(fini);
++MODULE_LICENSE("GPL");
diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch.config.in iptables-1.2.6a/patch-o-matic/extra/IMQX.patch.config.in
--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch.config.in Thu Jan 1 01:00:00 1970
+++ iptables-1.2.6a/patch-o-matic/extra/IMQX.patch.config.in Sat Mar 23 02:37:20 2002
@@ -0,0 +1,4 @@
+ dep_tristate ' MARK target support' CONFIG_IP_NF_TARGET_MARK $CONFIG_IP_NF_MANGLE
+ if [ "$CONFIG_IMQ" == "y" ]; then
+ dep_tristate ' IMQX target support' CONFIG_IP_NF_TARGET_IMQX $CONFIG_IP_NF_MANGLE
+ fi
diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch.configure.help iptables-1.2.6a/patch-o-matic/extra/IMQX.patch.configure.help
--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch.configure.help Thu Jan 1 01:00:00 1970
+++ iptables-1.2.6a/patch-o-matic/extra/IMQX.patch.configure.help Sat Mar 23 02:37:20 2002
@@ -0,0 +1,8 @@
+CONFIG_IP_NF_TARGET_MARK
+IMQX target support
+CONFIG_IP_NF_TARGET_IMQX
+ IMQX allows you to exclude packets from beeing enqueued
+ to the IMQ device
+
+ If you want to compile it as a module, say M here and read
+ Documentation/modules.txt. If unsure, say `N'.
diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch.help iptables-1.2.6a/patch-o-matic/extra/IMQX.patch.help
--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch.help Thu Jan 1 01:00:00 1970
+++ iptables-1.2.6a/patch-o-matic/extra/IMQX.patch.help Sat Mar 23 02:37:20 2002
@@ -0,0 +1,14 @@
+Author: Patrick McHardy <kaber@trash.net>
+Status: working
+
+This patch adds IMQX (IMQ eXclude) target for excluding
+traffic from beeing enqueued to the IMQ device.
+
+Usage:
+
+ IMQX
+ This target excludes traffic from beeing enqueued
+ to the IMQ device.
+
+Example:
+ iptables -t mangle -A POSTROUTING -o eth0 -j IMQX
diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch.makefile iptables-1.2.6a/patch-o-matic/extra/IMQX.patch.makefile
--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQX.patch.makefile Thu Jan 1 01:00:00 1970
+++ iptables-1.2.6a/patch-o-matic/extra/IMQX.patch.makefile Sat Mar 23 02:37:20 2002
@@ -0,0 +1,2 @@
+obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o
+obj-$(CONFIG_IP_NF_TARGET_IMQX) += ipt_IMQX.o
next prev parent reply other threads:[~2002-03-23 1:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-22 12:31 [LARTC] How to mark a device not to be used with IMQ? Nils Lichtenfeld
2002-03-22 14:02 ` Martin Devera
2002-03-22 14:18 ` Nils Lichtenfeld
2002-03-22 23:50 ` Martin Devera
2002-03-23 1:42 ` Patrick McHardy
2002-03-23 1:49 ` Patrick McHardy [this message]
2002-03-23 12:23 ` Nils Lichtenfeld
2002-03-23 13:09 ` Patrick McHardy
2002-03-23 15:18 ` Martin Devera
2002-03-23 15:29 ` Martin Devera
2002-03-23 15:41 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-lartc-101684824014775@msgid-missing \
--to=kaber@trash.net \
--cc=lartc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.