]> git.pld-linux.org Git - packages/kernel.git/blob - linux-2.4.23-netfilter-IMQ-target.patch
- obsolete
[packages/kernel.git] / linux-2.4.23-netfilter-IMQ-target.patch
1 diff -urN linux-2.4.23.org/Documentation/Configure.help linux-2.4.23/Documentation/Configure.help
2 --- linux-2.4.23.org/Documentation/Configure.help       2003-12-01 23:06:42.851544654 +0100
3 +++ linux-2.4.23/Documentation/Configure.help   2003-12-01 23:09:21.073624835 +0100
4 @@ -3549,6 +3549,14 @@
5    If unsure, say `N'.
6  
7  
8 +IMQ target support
9 +CONFIG_IP_NF_TARGET_IMQ
10 +  This option adds a `IMQ' target which is used to specify if and
11 +  to which imq device packets should get enqueued/dequeued.
12 +
13 +  If you want to compile it as a module, say M here and read
14 +  <file:Documentation/modules.txt>.  If unsure, say `N'.
15 +
16  MARK target support
17  CONFIG_IP_NF_TARGET_MARK
18    This option adds a `MARK' target, which allows you to create rules
19 @@ -3870,6 +3878,14 @@
20    Not working as a module.
21  
22  
23 +IMQ target support
24 +CONFIG_IP6_NF_TARGET_IMQ
25 +  This option adds a `IMQ' target which is used to specify if and
26 +  to which imq device packets should get enqueued/dequeued.
27 +
28 +  If you want to compile it as a module, say M here and read
29 +  <file:Documentation/modules.txt>.  If unsure, say `N'.
30 +
31  MARK target support
32  CONFIG_IP6_NF_TARGET_MARK
33    This option adds a `MARK' target, which allows you to create rules
34 diff -urN linux-2.4.23.org/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.4.23/include/linux/netfilter_ipv4/ipt_IMQ.h
35 --- linux-2.4.23.org/include/linux/netfilter_ipv4/ipt_IMQ.h     1970-01-01 01:00:00.000000000 +0100
36 +++ linux-2.4.23/include/linux/netfilter_ipv4/ipt_IMQ.h 2003-12-01 23:09:00.853831794 +0100
37 @@ -0,0 +1,8 @@
38 +#ifndef _IPT_IMQ_H
39 +#define _IPT_IMQ_H
40 +
41 +struct ipt_imq_info {
42 +       unsigned int todev;     /* target imq device */
43 +};
44 +
45 +#endif /* _IPT_IMQ_H */
46 diff -urN linux-2.4.23.org/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.4.23/include/linux/netfilter_ipv6/ip6t_IMQ.h
47 --- linux-2.4.23.org/include/linux/netfilter_ipv6/ip6t_IMQ.h    1970-01-01 01:00:00.000000000 +0100
48 +++ linux-2.4.23/include/linux/netfilter_ipv6/ip6t_IMQ.h        2003-12-01 23:09:20.860669143 +0100
49 @@ -0,0 +1,8 @@
50 +#ifndef _IP6T_IMQ_H
51 +#define _IP6T_IMQ_H
52 +
53 +struct ip6t_imq_info {
54 +       unsigned int todev;     /* target imq device */
55 +};
56 +
57 +#endif /* _IP6T_IMQ_H */
58 diff -urN linux-2.4.23.org/net/ipv4/netfilter/Config.in linux-2.4.23/net/ipv4/netfilter/Config.in
59 --- linux-2.4.23.org/net/ipv4/netfilter/Config.in       2003-12-01 23:04:11.215094025 +0100
60 +++ linux-2.4.23/net/ipv4/netfilter/Config.in   2003-12-01 23:09:00.904821185 +0100
61 @@ -213,6 +213,7 @@
62      dep_tristate '    DSCP target support' CONFIG_IP_NF_TARGET_DSCP $CONFIG_IP_NF_MANGLE
63   
64      dep_tristate '    MARK target support' CONFIG_IP_NF_TARGET_MARK $CONFIG_IP_NF_MANGLE
65 +    dep_tristate '    IMQ target support' CONFIG_IP_NF_TARGET_IMQ $CONFIG_IP_NF_MANGLE
66      dep_tristate '    ROUTE target support' CONFIG_IP_NF_TARGET_ROUTE $CONFIG_IP_NF_MANGLE
67   
68      dep_tristate '    IPMARK target support' CONFIG_IP_NF_TARGET_IPMARK $CONFIG_IP_NF_MANGLE
69 diff -urN linux-2.4.23.org/net/ipv4/netfilter/ipt_IMQ.c linux-2.4.23/net/ipv4/netfilter/ipt_IMQ.c
70 --- linux-2.4.23.org/net/ipv4/netfilter/ipt_IMQ.c       1970-01-01 01:00:00.000000000 +0100
71 +++ linux-2.4.23/net/ipv4/netfilter/ipt_IMQ.c   2003-12-01 23:09:00.855831378 +0100
72 @@ -0,0 +1,78 @@
73 +/* This target marks packets to be enqueued to an imq device */
74 +#include <linux/module.h>
75 +#include <linux/skbuff.h>
76 +#include <linux/netfilter_ipv4/ip_tables.h>
77 +#include <linux/netfilter_ipv4/ipt_IMQ.h>
78 +#include <linux/imq.h>
79 +
80 +static unsigned int imq_target(struct sk_buff **pskb,
81 +                              unsigned int hooknum,
82 +                              const struct net_device *in,
83 +                              const struct net_device *out,
84 +                              const void *targinfo,
85 +                              void *userinfo)
86 +{
87 +       struct ipt_imq_info *mr = (struct ipt_imq_info*)targinfo;
88 +
89 +       (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
90 +       (*pskb)->nfcache |= NFC_ALTERED;
91 +
92 +       return IPT_CONTINUE;
93 +}
94 +
95 +static int imq_checkentry(const char *tablename,
96 +                         const struct ipt_entry *e,
97 +                         void *targinfo,
98 +                         unsigned int targinfosize,
99 +                         unsigned int hook_mask)
100 +{
101 +       struct ipt_imq_info *mr;
102 +
103 +       if (targinfosize != IPT_ALIGN(sizeof(struct ipt_imq_info))) {
104 +               printk(KERN_WARNING "IMQ: invalid targinfosize\n");
105 +               return 0;
106 +       }
107 +       mr = (struct ipt_imq_info*)targinfo;
108 +
109 +       if (strcmp(tablename, "mangle") != 0) {
110 +               printk(KERN_WARNING
111 +                      "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
112 +                      tablename);
113 +               return 0;
114 +       }
115 +       
116 +       if (mr->todev > IMQ_MAX_DEVS) {
117 +               printk(KERN_WARNING
118 +                      "IMQ: invalid device specified, highest is %u\n",
119 +                      IMQ_MAX_DEVS);
120 +               return 0;
121 +       }
122 +       
123 +       return 1;
124 +}
125 +
126 +static struct ipt_target ipt_imq_reg = {
127 +       { NULL, NULL},
128 +       "IMQ",
129 +       imq_target,
130 +       imq_checkentry,
131 +       NULL,
132 +       THIS_MODULE
133 +};
134 +
135 +static int __init init(void)
136 +{
137 +       if (ipt_register_target(&ipt_imq_reg))
138 +               return -EINVAL;
139 +
140 +       return 0;
141 +}
142 +
143 +static void __exit fini(void)
144 +{
145 +       ipt_unregister_target(&ipt_imq_reg);
146 +}
147 +
148 +module_init(init);
149 +module_exit(fini);
150 +MODULE_LICENSE("GPL");
151 diff -urN linux-2.4.23.org/net/ipv4/netfilter/Makefile linux-2.4.23/net/ipv4/netfilter/Makefile
152 --- linux-2.4.23.org/net/ipv4/netfilter/Makefile        2003-12-01 23:04:11.173102762 +0100
153 +++ linux-2.4.23/net/ipv4/netfilter/Makefile    2003-12-01 23:09:01.130774173 +0100
154 @@ -189,6 +189,7 @@
155  obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
156  obj-$(CONFIG_IP_NF_TARGET_DSCP) += ipt_DSCP.o
157  obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o
158 +obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o
159  obj-$(CONFIG_IP_NF_TARGET_IPMARK) += ipt_IPMARK.o
160  obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
161  obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
162 diff -urN linux-2.4.23.org/net/ipv6/netfilter/Config.in linux-2.4.23/net/ipv6/netfilter/Config.in
163 --- linux-2.4.23.org/net/ipv6/netfilter/Config.in       2003-12-01 23:04:12.073915340 +0100
164 +++ linux-2.4.23/net/ipv6/netfilter/Config.in   2003-12-01 23:09:20.915657702 +0100
165 @@ -83,6 +83,7 @@
166    if [ "$CONFIG_IP6_NF_MANGLE" != "n" ]; then
167  #    dep_tristate '    TOS target support' CONFIG_IP6_NF_TARGET_TOS $CONFIG_IP_NF_MANGLE
168      dep_tristate '    MARK target support' CONFIG_IP6_NF_TARGET_MARK $CONFIG_IP6_NF_MANGLE
169 +    dep_tristate '    IMQ target support' CONFIG_IP6_NF_TARGET_IMQ $CONFIG_IP6_NF_MANGLE
170      dep_mbool '    ROUTE target support' CONFIG_IP6_NF_TARGET_ROUTE $CONFIG_IP6_NF_MANGLE
171    fi
172    #dep_tristate '  LOG target support' CONFIG_IP6_NF_TARGET_LOG $CONFIG_IP6_NF_IPTABLES
173 diff -urN linux-2.4.23.org/net/ipv6/netfilter/ip6t_IMQ.c linux-2.4.23/net/ipv6/netfilter/ip6t_IMQ.c
174 --- linux-2.4.23.org/net/ipv6/netfilter/ip6t_IMQ.c      1970-01-01 01:00:00.000000000 +0100
175 +++ linux-2.4.23/net/ipv6/netfilter/ip6t_IMQ.c  2003-12-01 23:09:20.862668727 +0100
176 @@ -0,0 +1,78 @@
177 +/* This target marks packets to be enqueued to an imq device */
178 +#include <linux/module.h>
179 +#include <linux/skbuff.h>
180 +#include <linux/netfilter_ipv6/ip6_tables.h>
181 +#include <linux/netfilter_ipv6/ip6t_IMQ.h>
182 +#include <linux/imq.h>
183 +
184 +static unsigned int imq_target(struct sk_buff **pskb,
185 +                              unsigned int hooknum,
186 +                              const struct net_device *in,
187 +                              const struct net_device *out,
188 +                              const void *targinfo,
189 +                              void *userinfo)
190 +{
191 +       struct ip6t_imq_info *mr = (struct ip6t_imq_info*)targinfo;
192 +
193 +       (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
194 +       (*pskb)->nfcache |= NFC_ALTERED;
195 +
196 +       return IP6T_CONTINUE;
197 +}
198 +
199 +static int imq_checkentry(const char *tablename,
200 +                         const struct ip6t_entry *e,
201 +                         void *targinfo,
202 +                         unsigned int targinfosize,
203 +                         unsigned int hook_mask)
204 +{
205 +       struct ip6t_imq_info *mr;
206 +
207 +       if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_imq_info))) {
208 +               printk(KERN_WARNING "IMQ: invalid targinfosize\n");
209 +               return 0;
210 +       }
211 +       mr = (struct ip6t_imq_info*)targinfo;
212 +
213 +       if (strcmp(tablename, "mangle") != 0) {
214 +               printk(KERN_WARNING
215 +                      "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
216 +                      tablename);
217 +               return 0;
218 +       }
219 +       
220 +       if (mr->todev > IMQ_MAX_DEVS) {
221 +               printk(KERN_WARNING
222 +                      "IMQ: invalid device specified, highest is %u\n",
223 +                      IMQ_MAX_DEVS);
224 +               return 0;
225 +       }
226 +       
227 +       return 1;
228 +}
229 +
230 +static struct ip6t_target ip6t_imq_reg = {
231 +       { NULL, NULL},
232 +       "IMQ",
233 +       imq_target,
234 +       imq_checkentry,
235 +       NULL,
236 +       THIS_MODULE
237 +};
238 +
239 +static int __init init(void)
240 +{
241 +       if (ip6t_register_target(&ip6t_imq_reg))
242 +               return -EINVAL;
243 +
244 +       return 0;
245 +}
246 +
247 +static void __exit fini(void)
248 +{
249 +       ip6t_unregister_target(&ip6t_imq_reg);
250 +}
251 +
252 +module_init(init);
253 +module_exit(fini);
254 +MODULE_LICENSE("GPL");
255 diff -urN linux-2.4.23.org/net/ipv6/netfilter/Makefile linux-2.4.23/net/ipv6/netfilter/Makefile
256 --- linux-2.4.23.org/net/ipv6/netfilter/Makefile        2003-12-01 23:04:12.067916588 +0100
257 +++ linux-2.4.23/net/ipv6/netfilter/Makefile    2003-12-01 23:09:21.138611314 +0100
258 @@ -30,6 +30,7 @@
259  obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
260  obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
261  obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o
262 +obj-$(CONFIG_IP6_NF_TARGET_IMQ) += ip6t_IMQ.o
263  obj-$(CONFIG_IP6_NF_TARGET_ROUTE) += ip6t_ROUTE.o
264  obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o
265  obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
This page took 0.04846 seconds and 3 git commands to generate.