]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/iptables-1.4.1-imq.diff
Fix vnstat directory creation
[people/pmueller/ipfire-2.x.git] / src / patches / iptables-1.4.1-imq.diff
CommitLineData
6abfa988
AF
1--- iptables-1.4.1-rc3.orig/extensions/.IMQ-test 1970-01-01 10:00:00.000000000 +1000
2+++ iptables-1.4.1-rc3/extensions/.IMQ-test 2008-06-08 22:41:49.000000000 +1000
3@@ -0,0 +1,3 @@
4+#!/bin/sh
5+# True if IMQ target patch is applied.
6+[ -f $KERNEL_DIR/include/linux/netfilter_ipv4/ipt_IMQ.h ] && echo IMQ
7diff -pruN iptables-1.4.1-rc3.orig/extensions/.IMQ-test6 iptables-1.4.1-rc3/extensions/.IMQ-test6
8--- iptables-1.4.1-rc3.orig/extensions/.IMQ-test6 1970-01-01 10:00:00.000000000 +1000
9+++ iptables-1.4.1-rc3/extensions/.IMQ-test6 2008-06-08 22:41:49.000000000 +1000
10@@ -0,0 +1,3 @@
11+#!/bin/sh
12+# True if IMQ target patch is applied.
13+[ -f $KERNEL_DIR/include/linux/netfilter_ipv6/ip6t_IMQ.h ] && echo IMQ
14diff -pruN iptables-1.4.1-rc3.orig/extensions/libip6t_IMQ.c iptables-1.4.1-rc3/extensions/libip6t_IMQ.c
15--- iptables-1.4.1-rc3.orig/extensions/libip6t_IMQ.c 1970-01-01 10:00:00.000000000 +1000
16+++ iptables-1.4.1-rc3/extensions/libip6t_IMQ.c 2008-06-08 22:46:57.000000000 +1000
17@@ -0,0 +1,89 @@
18+/* Shared library add-on to iptables to add IMQ target support. */
19+#include <stdio.h>
20+#include <string.h>
21+#include <stdlib.h>
22+#include <getopt.h>
23+
24+#include <ip6tables.h>
25+#include <linux/netfilter_ipv6/ip6_tables.h>
26+#include <linux/netfilter_ipv6/ip6t_IMQ.h>
27+
28+/* Function which prints out usage message. */
29+static void IMQ_help(void)
30+{
31+ printf(
32+"IMQ target v%s options:\n"
33+" --todev <N> enqueue to imq<N>, defaults to 0\n",
34+XTABLES_VERSION);
35+}
36+
37+static struct option IMQ_opts[] = {
38+ { "todev", 1, 0, '1' },
39+ { 0 }
40+};
41+
42+/* Initialize the target. */
43+static void IMQ_init(struct xt_entry_target *t)
44+{
45+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)t->data;
46+
47+ mr->todev = 0;
48+}
49+
50+/* Function which parses command options; returns true if it
51+ ate an option */
52+static int IMQ_parse(int c, char **argv, int invert, unsigned int *flags,
53+ const void *entry,
54+ struct xt_entry_target **target)
55+{
56+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)(*target)->data;
57+
58+ switch(c) {
59+ case '1':
60+ if (check_inverse(optarg, &invert, NULL, 0))
61+ exit_error(PARAMETER_PROBLEM,
62+ "Unexpected `!' after --todev");
63+ mr->todev=atoi(optarg);
64+ break;
65+ default:
66+ return 0;
67+ }
68+ return 1;
69+}
70+
71+/* Prints out the targinfo. */
72+static void IMQ_print(const void *ip,
73+ const struct xt_entry_target *target,
74+ int numeric)
75+{
76+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
77+
78+ printf("IMQ: todev %u ", mr->todev);
79+}
80+
81+/* Saves the union ipt_targinfo in parsable form to stdout. */
82+static void IMQ_save(const void *ip, const struct xt_entry_target *target)
83+{
84+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
85+
86+ printf("--todev %u", mr->todev);
87+}
88+
89+static struct xtables_target imq = {
90+ .name = "IMQ",
91+ .version = XTABLES_VERSION,
92+ .family = PF_INET6,
93+ .size = XT_ALIGN(sizeof(struct ip6t_imq_info)),
94+ .userspacesize = XT_ALIGN(sizeof(struct ip6t_imq_info)),
95+ .help = IMQ_help,
96+ .init = IMQ_init,
97+ .parse = IMQ_parse,
98+ .print = IMQ_print,
99+ .save = IMQ_save,
100+ .extra_opts = IMQ_opts,
101+};
102+
103+void _init(void)
104+{
105+ xtables_register_target(&imq);
106+}
107diff -pruN iptables-1.4.1-rc3.orig/extensions/libipt_IMQ.c iptables-1.4.1-rc3/extensions/libipt_IMQ.c
108--- iptables-1.4.1-rc3.orig/extensions/libipt_IMQ.c 1970-01-01 10:00:00.000000000 +1000
109+++ iptables-1.4.1-rc3/extensions/libipt_IMQ.c 2008-06-08 22:46:25.000000000 +1000
110@@ -0,0 +1,88 @@
111+/* Shared library add-on to iptables to add IMQ target support. */
112+#include <stdio.h>
113+#include <string.h>
114+#include <stdlib.h>
115+#include <getopt.h>
116+
117+#include <iptables.h>
118+#include <linux/netfilter_ipv4/ip_tables.h>
119+#include <linux/netfilter_ipv4/ipt_IMQ.h>
120+
121+/* Function which prints out usage message. */
122+static void IMQ_help(void)
123+{
124+ printf(
125+"IMQ target v%s options:\n"
126+" --todev <N> enqueue to imq<N>, defaults to 0\n",
127+XTABLES_VERSION);
128+}
129+
130+static struct option IMQ_opts[] = {
131+ { "todev", 1, 0, '1' },
132+ { 0 }
133+};
134+
135+/* Initialize the target. */
136+static void IMQ_init(struct xt_entry_target *t)
137+{
138+ struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data;
139+
140+ mr->todev = 0;
141+}
142+
143+/* Function which parses command options; returns true if it
144+ ate an option */
145+static int IMQ_parse(int c, char **argv, int invert, unsigned int *flags,
146+ const void *entry, struct xt_entry_target **target)
147+{
148+ struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data;
149+
150+ switch(c) {
151+ case '1':
152+ if (check_inverse(optarg, &invert, NULL, 0))
153+ exit_error(PARAMETER_PROBLEM,
154+ "Unexpected `!' after --todev");
155+ mr->todev=atoi(optarg);
156+ break;
157+ default:
158+ return 0;
159+ }
160+ return 1;
161+}
162+
163+/* Prints out the targinfo. */
164+static void IMQ_print(const void *ip,
165+ const struct xt_entry_target *target,
166+ int numeric)
167+{
168+ struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
169+
170+ printf("IMQ: todev %u ", mr->todev);
171+}
172+
173+/* Saves the union ipt_targinfo in parsable form to stdout. */
174+static void IMQ_save(const void *ip, const struct xt_entry_target *target)
175+{
176+ struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
177+
178+ printf("--todev %u", mr->todev);
179+}
180+
181+static struct xtables_target imq = {
182+ .name = "IMQ",
183+ .version = XTABLES_VERSION,
184+ .family = PF_INET,
185+ .size = XT_ALIGN(sizeof(struct ipt_imq_info)),
186+ .userspacesize = XT_ALIGN(sizeof(struct ipt_imq_info)),
187+ .help = IMQ_help,
188+ .init = IMQ_init,
189+ .parse = IMQ_parse,
190+ .print = IMQ_print,
191+ .save = IMQ_save,
192+ .extra_opts = IMQ_opts,
193+};
194+
195+void _init(void)
196+{
197+ xtables_register_target(&imq);
198+}