]> git.pld-linux.org Git - packages/iptables.git/blame - iptables-1.2.6a-imq.diff-3
- not used
[packages/iptables.git] / iptables-1.2.6a-imq.diff-3
CommitLineData
a6da2cd3
JR
1diff -urN iptables-1.2.6a-clean/extensions/.IMQ-test iptables-1.2.6a-imq/extensions/.IMQ-test
2--- iptables-1.2.6a-clean/extensions/.IMQ-test Thu Jan 1 01:00:00 1970
3+++ iptables-1.2.6a-imq/extensions/.IMQ-test Mon Apr 29 01:34:33 2002
4@@ -0,0 +1,3 @@
5+#!/bin/sh
6+# True if IMQ target patch is applied.
7+[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_IMQ.c ] && echo IMQ
8diff -urN iptables-1.2.6a-clean/extensions/.IMQ-test6 iptables-1.2.6a-imq/extensions/.IMQ-test6
9--- iptables-1.2.6a-clean/extensions/.IMQ-test6 Thu Jan 1 01:00:00 1970
10+++ iptables-1.2.6a-imq/extensions/.IMQ-test6 Mon Apr 29 01:34:33 2002
11@@ -0,0 +1,3 @@
12+#!/bin/sh
13+# True if IMQ target patch is applied.
14+[ -f $KERNEL_DIR/net/ipv6/netfilter/ip6t_IMQ.c ] && echo IMQ
15diff -urN iptables-1.2.6a-clean/extensions/libip6t_IMQ.c iptables-1.2.6a-imq/extensions/libip6t_IMQ.c
16--- iptables-1.2.6a-clean/extensions/libip6t_IMQ.c Thu Jan 1 01:00:00 1970
17+++ iptables-1.2.6a-imq/extensions/libip6t_IMQ.c Mon Apr 29 01:34:33 2002
18@@ -0,0 +1,102 @@
19+/* Shared library add-on to iptables to add IMQ target support. */
20+#include <stdio.h>
21+#include <string.h>
22+#include <stdlib.h>
23+#include <getopt.h>
24+
25+#include <ip6tables.h>
26+#include <linux/netfilter_ipv6/ip6_tables.h>
27+#include <linux/netfilter_ipv6/ip6t_IMQ.h>
28+
29+/* Function which prints out usage message. */
30+static void
31+help(void)
32+{
33+ printf(
34+"IMQ target v%s options:\n"
35+" --todev <N> enqueue to imq<N>, defaults to 0\n",
bc580006 36+IPTABLES_VERSION);
a6da2cd3
JR
37+}
38+
39+static struct option opts[] = {
40+ { "todev", 1, 0, '1' },
41+ { 0 }
42+};
43+
44+/* Initialize the target. */
45+static void
46+init(struct ip6t_entry_target *t, unsigned int *nfcache)
47+{
48+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)t->data;
49+
50+ mr->todev = 0;
51+ *nfcache |= NFC_UNKNOWN;
52+}
53+
54+/* Function which parses command options; returns true if it
55+ ate an option */
56+static int
57+parse(int c, char **argv, int invert, unsigned int *flags,
58+ const struct ip6t_entry *entry,
59+ struct ip6t_entry_target **target)
60+{
61+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)(*target)->data;
62+
63+ switch(c) {
64+ case '1':
65+ if (check_inverse(optarg, &invert, NULL, 0))
66+ exit_error(PARAMETER_PROBLEM,
67+ "Unexpected `!' after --todev");
68+ mr->todev=atoi(optarg);
69+ break;
70+ default:
71+ return 0;
72+ }
73+ return 1;
74+}
75+
76+static void
77+final_check(unsigned int flags)
78+{
79+}
80+
81+/* Prints out the targinfo. */
82+static void
83+print(const struct ip6t_ip6 *ip,
84+ const struct ip6t_entry_target *target,
85+ int numeric)
86+{
87+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
88+
89+ printf("IMQ: todev %u ", mr->todev);
90+}
91+
92+/* Saves the union ipt_targinfo in parsable form to stdout. */
93+static void
94+save(const struct ip6t_ip6 *ip, const struct ip6t_entry_target *target)
95+{
96+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
97+
98+ printf("--todev %u", mr->todev);
99+}
100+
101+static
102+struct ip6tables_target imq
103+= { NULL,
104+ "IMQ",
bc580006 105+ IPTABLES_VERSION,
a6da2cd3
JR
106+ IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
107+ IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
108+ &help,
109+ &init,
110+ &parse,
111+ &final_check,
112+ &print,
113+ &save,
114+ opts
115+};
116+
117+void _init(void)
118+{
119+ register_target6(&imq);
120+}
121diff -urN iptables-1.2.6a-clean/extensions/libipt_IMQ.c iptables-1.2.6a-imq/extensions/libipt_IMQ.c
122--- iptables-1.2.6a-clean/extensions/libipt_IMQ.c Thu Jan 1 01:00:00 1970
123+++ iptables-1.2.6a-imq/extensions/libipt_IMQ.c Mon Apr 29 01:34:33 2002
124@@ -0,0 +1,102 @@
125+/* Shared library add-on to iptables to add IMQ target support. */
126+#include <stdio.h>
127+#include <string.h>
128+#include <stdlib.h>
129+#include <getopt.h>
130+
131+#include <iptables.h>
132+#include <linux/netfilter_ipv4/ip_tables.h>
133+#include <linux/netfilter_ipv4/ipt_IMQ.h>
134+
135+/* Function which prints out usage message. */
136+static void
137+help(void)
138+{
139+ printf(
140+"IMQ target v%s options:\n"
141+" --todev <N> enqueue to imq<N>, defaults to 0\n",
bc580006 142+IPTABLES_VERSION);
a6da2cd3
JR
143+}
144+
145+static struct option opts[] = {
146+ { "todev", 1, 0, '1' },
147+ { 0 }
148+};
149+
150+/* Initialize the target. */
151+static void
152+init(struct ipt_entry_target *t, unsigned int *nfcache)
153+{
154+ struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data;
155+
156+ mr->todev = 0;
157+ *nfcache |= NFC_UNKNOWN;
158+}
159+
160+/* Function which parses command options; returns true if it
161+ ate an option */
162+static int
163+parse(int c, char **argv, int invert, unsigned int *flags,
164+ const struct ipt_entry *entry,
165+ struct ipt_entry_target **target)
166+{
167+ struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data;
168+
169+ switch(c) {
170+ case '1':
171+ if (check_inverse(optarg, &invert, NULL, 0))
172+ exit_error(PARAMETER_PROBLEM,
173+ "Unexpected `!' after --todev");
174+ mr->todev=atoi(optarg);
175+ break;
176+ default:
177+ return 0;
178+ }
179+ return 1;
180+}
181+
182+static void
183+final_check(unsigned int flags)
184+{
185+}
186+
187+/* Prints out the targinfo. */
188+static void
189+print(const struct ipt_ip *ip,
190+ const struct ipt_entry_target *target,
191+ int numeric)
192+{
193+ struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
194+
195+ printf("IMQ: todev %u ", mr->todev);
196+}
197+
198+/* Saves the union ipt_targinfo in parsable form to stdout. */
199+static void
200+save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
201+{
202+ struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
203+
204+ printf("--todev %u", mr->todev);
205+}
206+
207+static
208+struct iptables_target imq
209+= { NULL,
210+ "IMQ",
bc580006 211+ IPTABLES_VERSION,
a6da2cd3
JR
212+ IPT_ALIGN(sizeof(struct ipt_imq_info)),
213+ IPT_ALIGN(sizeof(struct ipt_imq_info)),
214+ &help,
215+ &init,
216+ &parse,
217+ &final_check,
218+ &print,
219+ &save,
220+ opts
221+};
222+
223+void _init(void)
224+{
225+ register_target(&imq);
226+}
227diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch
228--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch Thu Jan 1 01:00:00 1970
229+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch Mon Apr 29 01:34:33 2002
230@@ -0,0 +1,94 @@
231+diff -urN linux-2.4.18-clean/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.4.18-imq-nf/include/linux/netfilter_ipv4/ipt_IMQ.h
232+--- linux-2.4.18-clean/include/linux/netfilter_ipv4/ipt_IMQ.h Thu Jan 1 01:00:00 1970
233++++ linux-2.4.18-imq-nf/include/linux/netfilter_ipv4/ipt_IMQ.h Tue Apr 2 21:35:20 2002
234+@@ -0,0 +1,8 @@
235++#ifndef _IPT_IMQ_H
236++#define _IPT_IMQ_H
237++
238++struct ipt_imq_info {
239++ unsigned int todev; /* target imq device */
240++};
241++
242++#endif /* _IPT_IMQ_H */
243+diff -urN linux-2.4.18-clean/net/ipv4/netfilter/ipt_IMQ.c linux-2.4.18-imq-nf/net/ipv4/netfilter/ipt_IMQ.c
244+--- linux-2.4.18-clean/net/ipv4/netfilter/ipt_IMQ.c Thu Jan 1 01:00:00 1970
245++++ linux-2.4.18-imq-nf/net/ipv4/netfilter/ipt_IMQ.c Tue Apr 2 21:34:15 2002
246+@@ -0,0 +1,78 @@
247++/* This target marks packets to be enqueued to an imq device */
248++#include <linux/module.h>
249++#include <linux/skbuff.h>
250++#include <linux/netfilter_ipv4/ip_tables.h>
251++#include <linux/netfilter_ipv4/ipt_IMQ.h>
252++#include <linux/imq.h>
253++
254++static unsigned int imq_target(struct sk_buff **pskb,
255++ unsigned int hooknum,
256++ const struct net_device *in,
257++ const struct net_device *out,
258++ const void *targinfo,
259++ void *userinfo)
260++{
261++ struct ipt_imq_info *mr = (struct ipt_imq_info*)targinfo;
262++
263++ (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
264++ (*pskb)->nfcache |= NFC_ALTERED;
265++
266++ return IPT_CONTINUE;
267++}
268++
269++static int imq_checkentry(const char *tablename,
270++ const struct ipt_entry *e,
271++ void *targinfo,
272++ unsigned int targinfosize,
273++ unsigned int hook_mask)
274++{
275++ struct ipt_imq_info *mr;
276++
277++ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_imq_info))) {
278++ printk(KERN_WARNING "IMQ: invalid targinfosize\n");
279++ return 0;
280++ }
281++ mr = (struct ipt_imq_info*)targinfo;
282++
283++ if (strcmp(tablename, "mangle") != 0) {
284++ printk(KERN_WARNING
285++ "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
286++ tablename);
287++ return 0;
288++ }
289++
290++ if (mr->todev > IMQ_MAX_DEVS) {
291++ printk(KERN_WARNING
292++ "IMQ: invalid device specified, highest is %u\n",
293++ IMQ_MAX_DEVS);
294++ return 0;
295++ }
296++
297++ return 1;
298++}
299++
300++static struct ipt_target ipt_imq_reg = {
301++ { NULL, NULL},
302++ "IMQ",
303++ imq_target,
304++ imq_checkentry,
305++ NULL,
306++ THIS_MODULE
307++};
308++
309++static int __init init(void)
310++{
311++ if (ipt_register_target(&ipt_imq_reg))
312++ return -EINVAL;
313++
314++ return 0;
315++}
316++
317++static void __exit fini(void)
318++{
319++ ipt_unregister_target(&ipt_imq_reg);
320++}
321++
322++module_init(init);
323++module_exit(fini);
324++MODULE_LICENSE("GPL");
325diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.config.in iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.config.in
326--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.config.in Thu Jan 1 01:00:00 1970
327+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.config.in Mon Apr 29 01:34:33 2002
328@@ -0,0 +1,2 @@
329+ dep_tristate ' MARK target support' CONFIG_IP_NF_TARGET_MARK $CONFIG_IP_NF_MANGLE
330+ dep_tristate ' IMQ target support' CONFIG_IP_NF_TARGET_IMQ $CONFIG_IP_NF_MANGLE
331diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.configure.help iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.configure.help
332--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.configure.help Thu Jan 1 01:00:00 1970
333+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.configure.help Mon Apr 29 01:34:33 2002
334@@ -0,0 +1,8 @@
335+CONFIG_IP_NF_TARGET_MARK
336+IMQ target support
337+CONFIG_IP_NF_TARGET_IMQ
338+ This option adds a `IMQ' target which is used to specify if and
339+ to which imq device packets should get enqueued/dequeued.
340+
341+ If you want to compile it as a module, say M here and read
342+ <file:Documentation/modules.txt>. If unsure, say `N'.
343diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.help iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.help
344--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.help Thu Jan 1 01:00:00 1970
345+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.help Mon Apr 29 01:34:33 2002
346@@ -0,0 +1,5 @@
347+Author: Patrick McHardy <kaber@trash.net>
348+Status: Working
349+
350+ This patch adds a new target 'IMQ' which is required
351+ to direct packets through an imq device.
352diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6 iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6
353--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6 Thu Jan 1 01:00:00 1970
354+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6 Mon Apr 29 01:34:33 2002
355@@ -0,0 +1,94 @@
356+diff -urN linux-2.4.18-clean/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.4.18-imq/include/linux/netfilter_ipv6/ip6t_IMQ.h
357+--- linux-2.4.18-clean/include/linux/netfilter_ipv6/ip6t_IMQ.h Thu Jan 1 01:00:00 1970
358++++ linux-2.4.18-imq/include/linux/netfilter_ipv6/ip6t_IMQ.h Sun Apr 28 23:34:53 2002
359+@@ -0,0 +1,8 @@
360++#ifndef _IP6T_IMQ_H
361++#define _IP6T_IMQ_H
362++
363++struct ip6t_imq_info {
364++ unsigned int todev; /* target imq device */
365++};
366++
367++#endif /* _IP6T_IMQ_H */
368+diff -urN linux-2.4.18-clean/net/ipv6/netfilter/ip6t_IMQ.c linux-2.4.18-imq/net/ipv6/netfilter/ip6t_IMQ.c
369+--- linux-2.4.18-clean/net/ipv6/netfilter/ip6t_IMQ.c Thu Jan 1 01:00:00 1970
370++++ linux-2.4.18-imq/net/ipv6/netfilter/ip6t_IMQ.c Sun Apr 28 23:34:11 2002
371+@@ -0,0 +1,78 @@
372++/* This target marks packets to be enqueued to an imq device */
373++#include <linux/module.h>
374++#include <linux/skbuff.h>
375++#include <linux/netfilter_ipv6/ip6_tables.h>
376++#include <linux/netfilter_ipv6/ip6t_IMQ.h>
377++#include <linux/imq.h>
378++
379++static unsigned int imq_target(struct sk_buff **pskb,
380++ unsigned int hooknum,
381++ const struct net_device *in,
382++ const struct net_device *out,
383++ const void *targinfo,
384++ void *userinfo)
385++{
386++ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)targinfo;
387++
388++ (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
389++ (*pskb)->nfcache |= NFC_ALTERED;
390++
391++ return IP6T_CONTINUE;
392++}
393++
394++static int imq_checkentry(const char *tablename,
395++ const struct ip6t_entry *e,
396++ void *targinfo,
397++ unsigned int targinfosize,
398++ unsigned int hook_mask)
399++{
400++ struct ip6t_imq_info *mr;
401++
402++ if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_imq_info))) {
403++ printk(KERN_WARNING "IMQ: invalid targinfosize\n");
404++ return 0;
405++ }
406++ mr = (struct ip6t_imq_info*)targinfo;
407++
408++ if (strcmp(tablename, "mangle") != 0) {
409++ printk(KERN_WARNING
410++ "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
411++ tablename);
412++ return 0;
413++ }
414++
415++ if (mr->todev > IMQ_MAX_DEVS) {
416++ printk(KERN_WARNING
417++ "IMQ: invalid device specified, highest is %u\n",
418++ IMQ_MAX_DEVS);
419++ return 0;
420++ }
421++
422++ return 1;
423++}
424++
425++static struct ip6t_target ip6t_imq_reg = {
426++ { NULL, NULL},
427++ "IMQ",
428++ imq_target,
429++ imq_checkentry,
430++ NULL,
431++ THIS_MODULE
432++};
433++
434++static int __init init(void)
435++{
436++ if (ip6t_register_target(&ip6t_imq_reg))
437++ return -EINVAL;
438++
439++ return 0;
440++}
441++
442++static void __exit fini(void)
443++{
444++ ip6t_unregister_target(&ip6t_imq_reg);
445++}
446++
447++module_init(init);
448++module_exit(fini);
449++MODULE_LICENSE("GPL");
450diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6.config.in iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6.config.in
451--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6.config.in Thu Jan 1 01:00:00 1970
452+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6.config.in Mon Apr 29 01:34:33 2002
453@@ -0,0 +1,2 @@
454+ dep_tristate ' MARK target support' CONFIG_IP6_NF_TARGET_MARK $CONFIG_IP6_NF_MANGLE
455+ dep_tristate ' IMQ target support' CONFIG_IP6_NF_TARGET_IMQ $CONFIG_IP6_NF_MANGLE
456diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6.configure.help iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6.configure.help
457--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6.configure.help Thu Jan 1 01:00:00 1970
458+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6.configure.help Mon Apr 29 01:34:33 2002
459@@ -0,0 +1,8 @@
460+CONFIG_IP6_NF_TARGET_MARK
461+IMQ target support
462+CONFIG_IP6_NF_TARGET_IMQ
463+ This option adds a `IMQ' target which is used to specify if and
464+ to which imq device packets should get enqueued/dequeued.
465+
466+ If you want to compile it as a module, say M here and read
467+ <file:Documentation/modules.txt>. If unsure, say `N'.
468diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6.help iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6.help
469--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6.help Thu Jan 1 01:00:00 1970
470+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6.help Mon Apr 29 01:34:33 2002
471@@ -0,0 +1,5 @@
472+Author: Patrick McHardy <kaber@trash.net>
473+Status: Working
474+
475+ This patch adds a new target 'IMQ' which is required
476+ to direct packets through an imq device.
477diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6.makefile iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6.makefile
478--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.ipv6.makefile Thu Jan 1 01:00:00 1970
479+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.ipv6.makefile Mon Apr 29 01:34:33 2002
480@@ -0,0 +1,2 @@
481+obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o
482+obj-$(CONFIG_IP6_NF_TARGET_IMQ) += ip6t_IMQ.o
483diff -urN iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.makefile iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.makefile
484--- iptables-1.2.6a-clean/patch-o-matic/extra/IMQ.patch.makefile Thu Jan 1 01:00:00 1970
485+++ iptables-1.2.6a-imq/patch-o-matic/extra/IMQ.patch.makefile Mon Apr 29 01:34:33 2002
486@@ -0,0 +1,2 @@
487+obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o
488+obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o
This page took 0.123657 seconds and 4 git commands to generate.