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