]>
Commit | Line | Data |
---|---|---|
71430cf6 MT |
1 | --- iptables-1.3.6.orig/extensions.orig/.IMQ-test6 Thu Jan 1 01:00:00 1970\r |
2 | +++ iptables-1.3.6/extensions/.IMQ-test6 Mon Jun 16 10:12:47 2003\r | |
3 | @@ -0,0 +1,3 @@\r | |
4 | +#!/bin/sh\r | |
5 | +# True if IMQ target patch is applied.\r | |
6 | +[ -f $KERNEL_DIR/net/ipv6/netfilter/ip6t_IMQ.c ] && echo IMQ\r | |
7 | --- iptables-1.3.6.orig/extensions.orig/libip6t_IMQ.c Thu Jan 1 01:00:00 1970\r | |
8 | +++ iptables-1.3.6/extensions/libip6t_IMQ.c Mon Jun 16 10:12:47 2003\r | |
9 | @@ -0,0 +1,101 @@\r | |
10 | +/* Shared library add-on to iptables to add IMQ target support. */\r | |
11 | +#include <stdio.h>\r | |
12 | +#include <string.h>\r | |
13 | +#include <stdlib.h>\r | |
14 | +#include <getopt.h>\r | |
15 | +\r | |
16 | +#include <ip6tables.h>\r | |
17 | +#include <linux/netfilter_ipv6/ip6_tables.h>\r | |
18 | +#include <linux/netfilter_ipv6/ip6t_IMQ.h>\r | |
19 | +\r | |
20 | +/* Function which prints out usage message. */\r | |
21 | +static void\r | |
22 | +help(void)\r | |
23 | +{\r | |
24 | + printf(\r | |
25 | +"IMQ target v%s options:\n"\r | |
26 | +" --todev <N> enqueue to imq<N>, defaults to 0\n", \r | |
27 | +IPTABLES_VERSION);\r | |
28 | +}\r | |
29 | +\r | |
30 | +static struct option opts[] = {\r | |
31 | + { "todev", 1, 0, '1' },\r | |
32 | + { 0 }\r | |
33 | +};\r | |
34 | +\r | |
35 | +/* Initialize the target. */\r | |
36 | +static void\r | |
37 | +init(struct ip6t_entry_target *t, unsigned int *nfcache)\r | |
38 | +{\r | |
39 | + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)t->data;\r | |
40 | +\r | |
41 | + mr->todev = 0;\r | |
42 | + *nfcache |= NFC_UNKNOWN;\r | |
43 | +}\r | |
44 | +\r | |
45 | +/* Function which parses command options; returns true if it\r | |
46 | + ate an option */\r | |
47 | +static int\r | |
48 | +parse(int c, char **argv, int invert, unsigned int *flags,\r | |
49 | + const struct ip6t_entry *entry,\r | |
50 | + struct ip6t_entry_target **target)\r | |
51 | +{\r | |
52 | + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)(*target)->data;\r | |
53 | + \r | |
54 | + switch(c) {\r | |
55 | + case '1':\r | |
56 | + if (check_inverse(optarg, &invert, NULL, 0))\r | |
57 | + exit_error(PARAMETER_PROBLEM,\r | |
58 | + "Unexpected `!' after --todev");\r | |
59 | + mr->todev=atoi(optarg);\r | |
60 | + break;\r | |
61 | + default:\r | |
62 | + return 0;\r | |
63 | + }\r | |
64 | + return 1;\r | |
65 | +}\r | |
66 | +\r | |
67 | +static void\r | |
68 | +final_check(unsigned int flags)\r | |
69 | +{\r | |
70 | +}\r | |
71 | +\r | |
72 | +/* Prints out the targinfo. */\r | |
73 | +static void\r | |
74 | +print(const struct ip6t_ip6 *ip,\r | |
75 | + const struct ip6t_entry_target *target,\r | |
76 | + int numeric)\r | |
77 | +{\r | |
78 | + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;\r | |
79 | +\r | |
80 | + printf("IMQ: todev %u ", mr->todev);\r | |
81 | +}\r | |
82 | +\r | |
83 | +/* Saves the union ipt_targinfo in parsable form to stdout. */\r | |
84 | +static void\r | |
85 | +save(const struct ip6t_ip6 *ip, const struct ip6t_entry_target *target)\r | |
86 | +{\r | |
87 | + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;\r | |
88 | +\r | |
89 | + printf("--todev %u", mr->todev);\r | |
90 | +}\r | |
91 | +\r | |
92 | +static struct ip6tables_target imq = {\r | |
93 | + .next = NULL,\r | |
94 | + .name = "IMQ",\r | |
95 | + .version = IPTABLES_VERSION,\r | |
96 | + .size = IP6T_ALIGN(sizeof(struct ip6t_imq_info)),\r | |
97 | + .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_imq_info)),\r | |
98 | + .help = &help,\r | |
99 | + .init = &init,\r | |
100 | + .parse = &parse,\r | |
101 | + .final_check = &final_check,\r | |
102 | + .print = &print,\r | |
103 | + .save = &save,\r | |
104 | + .extra_opts = opts\r | |
105 | +};\r | |
106 | +\r | |
107 | +static __attribute__((constructor)) void _init(void)\r | |
108 | +{\r | |
109 | + register_target6(&imq);\r | |
110 | +}\r | |
111 | --- iptables-1.3.6.orig/extensions.orig/.IMQ-test Thu Jan 1 01:00:00 1970\r | |
112 | +++ iptables-1.3.6/extensions/.IMQ-test Mon Jun 16 10:12:47 2003\r | |
113 | @@ -0,0 +1,3 @@\r | |
114 | +#!/bin/sh\r | |
115 | +# True if IMQ target patch is applied.\r | |
116 | +[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_IMQ.c ] && echo IMQ\r | |
117 | --- iptables-1.3.6.orig/extensions.orig/libipt_IMQ.c Thu Jan 1 01:00:00 1970\r | |
118 | +++ iptables-1.3.6/extensions/libipt_IMQ.c Mon Jun 16 10:12:47 2003\r | |
119 | @@ -0,0 +1,101 @@\r | |
120 | +/* Shared library add-on to iptables to add IMQ target support. */\r | |
121 | +#include <stdio.h>\r | |
122 | +#include <string.h>\r | |
123 | +#include <stdlib.h>\r | |
124 | +#include <getopt.h>\r | |
125 | +\r | |
126 | +#include <iptables.h>\r | |
127 | +#include <linux/netfilter_ipv4/ip_tables.h>\r | |
128 | +#include <linux/netfilter_ipv4/ipt_IMQ.h>\r | |
129 | +\r | |
130 | +/* Function which prints out usage message. */\r | |
131 | +static void\r | |
132 | +help(void)\r | |
133 | +{\r | |
134 | + printf(\r | |
135 | +"IMQ target v%s options:\n"\r | |
136 | +" --todev <N> enqueue to imq<N>, defaults to 0\n", \r | |
137 | +IPTABLES_VERSION);\r | |
138 | +}\r | |
139 | +\r | |
140 | +static struct option opts[] = {\r | |
141 | + { "todev", 1, 0, '1' },\r | |
142 | + { 0 }\r | |
143 | +};\r | |
144 | +\r | |
145 | +/* Initialize the target. */\r | |
146 | +static void\r | |
147 | +init(struct ipt_entry_target *t, unsigned int *nfcache)\r | |
148 | +{\r | |
149 | + struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data;\r | |
150 | +\r | |
151 | + mr->todev = 0;\r | |
152 | + *nfcache |= NFC_UNKNOWN;\r | |
153 | +}\r | |
154 | +\r | |
155 | +/* Function which parses command options; returns true if it\r | |
156 | + ate an option */\r | |
157 | +static int\r | |
158 | +parse(int c, char **argv, int invert, unsigned int *flags,\r | |
159 | + const struct ipt_entry *entry,\r | |
160 | + struct ipt_entry_target **target)\r | |
161 | +{\r | |
162 | + struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data;\r | |
163 | + \r | |
164 | + switch(c) {\r | |
165 | + case '1':\r | |
166 | + if (check_inverse(optarg, &invert, NULL, 0))\r | |
167 | + exit_error(PARAMETER_PROBLEM,\r | |
168 | + "Unexpected `!' after --todev");\r | |
169 | + mr->todev=atoi(optarg);\r | |
170 | + break;\r | |
171 | + default:\r | |
172 | + return 0;\r | |
173 | + }\r | |
174 | + return 1;\r | |
175 | +}\r | |
176 | +\r | |
177 | +static void\r | |
178 | +final_check(unsigned int flags)\r | |
179 | +{\r | |
180 | +}\r | |
181 | +\r | |
182 | +/* Prints out the targinfo. */\r | |
183 | +static void\r | |
184 | +print(const struct ipt_ip *ip,\r | |
185 | + const struct ipt_entry_target *target,\r | |
186 | + int numeric)\r | |
187 | +{\r | |
188 | + struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;\r | |
189 | +\r | |
190 | + printf("IMQ: todev %u ", mr->todev);\r | |
191 | +}\r | |
192 | +\r | |
193 | +/* Saves the union ipt_targinfo in parsable form to stdout. */\r | |
194 | +static void\r | |
195 | +save(const struct ipt_ip *ip, const struct ipt_entry_target *target)\r | |
196 | +{\r | |
197 | + struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;\r | |
198 | +\r | |
199 | + printf("--todev %u", mr->todev);\r | |
200 | +}\r | |
201 | +\r | |
202 | +static struct iptables_target imq = {\r | |
203 | + .next = NULL,\r | |
204 | + .name = "IMQ",\r | |
205 | + .version = IPTABLES_VERSION,\r | |
206 | + .size = IPT_ALIGN(sizeof(struct ipt_imq_info)),\r | |
207 | + .userspacesize = IPT_ALIGN(sizeof(struct ipt_imq_info)),\r | |
208 | + .help = &help,\r | |
209 | + .init = &init,\r | |
210 | + .parse = &parse,\r | |
211 | + .final_check = &final_check,\r | |
212 | + .print = &print,\r | |
213 | + .save = &save,\r | |
214 | + .extra_opts = opts\r | |
215 | +};\r | |
216 | +\r | |
217 | +static __attribute__((constructor)) void _init(void)\r | |
218 | +{\r | |
219 | + register_target(&imq);\r | |
220 | +}\r | |
221 | \r |