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