nbd's makefile/menuconfig rewrite
[openwrt/staging/dedeckeh.git] / openwrt / package / iptables / patches / ipp2p-0.7.1.patch
1 diff -urN iptables-1.2.11.old/extensions/libipt_ipp2p.c iptables-1.2.11/extensions/libipt_ipp2p.c
2 --- iptables-1.2.11.old/extensions/libipt_ipp2p.c 1970-01-01 01:00:00.000000000 +0100
3 +++ iptables-1.2.11/extensions/libipt_ipp2p.c 2005-03-01 17:49:59.000000000 +0100
4 @@ -0,0 +1,482 @@
5 +
6 +#include <stdio.h>
7 +#include <netdb.h>
8 +#include <string.h>
9 +#include <stdlib.h>
10 +#include <getopt.h>
11 +#include <ctype.h>
12 +
13 +#include <iptables.h>
14 +
15 +#include <linux/netfilter_ipv4/ipt_ipp2p.h>
16 +
17 +
18 +
19 +
20 +static void
21 +help(void)
22 +{
23 + printf(
24 + "IPP2P v%s options:\n"
25 + " --ipp2p Grab all known p2p packets\n"
26 + " --ipp2p-data Identify all known p2p download commands (obsolete)\n\n"
27 + " --edk [TCP&UDP] All known eDonkey/eMule/Overnet packets\n"
28 + " --dc [TCP] All known Direct Connect packets\n"
29 + " --kazaa [TCP&UDP] All known KaZaA packets\n"
30 + " --gnu [TCP&UDP] All known Gnutella packets\n"
31 + " --bit [TCP&UDP] All known BitTorrent packets\n"
32 + " --apple [TCP] All known AppleJuice packets (beta - just a few tests until now)\n"
33 + " --winmx [TCP] All known WinMX (beta - need feedback)\n"
34 + " --soul [TCP] All known SoulSeek (beta - need feedback!)\n"
35 + " --ares [TCP] All known Ares - use with DROP only (beta - need feedback!)\n\n"
36 + " --edk-data [TCP] eDonkey/eMule/Overnet download commands (obsolete)\n"
37 + " --dc-data [TCP] Direct Connect download command (obsolete)\n"
38 + " --kazaa-data [TCP] KaZaA download command (obsolete)\n"
39 + " --gnu-data [TCP] Gnutella download command (obsolete)\n"
40 + "\nNote that the follwing options will have the same meaning:\n"
41 + " '--ipp2p' is equal to '--edk --dc --kazaa --gnu'\n"
42 + " '--ipp2p-data' is equal to '--edk-data --dc-data --kazaa-data --gnu-data'\n"
43 + "\nIPP2P was intended for TCP only. Due to increasing usage of UDP we needed to change this:\n"
44 + " --udp search UDP packets only\n"
45 + " --tcp search TCP packets only\n"
46 + " --udp --tcp search UDP and TCP packets\n"
47 + "\nSee README included with this package for more details or visit http://www.ipp2p.org\n"
48 + "\nExamples:\n"
49 + " iptables -A FORWARD -m ipp2p --ipp2p -j MARK --set-mark 0x01\n"
50 + " iptables -A FORWARD -m ipp2p --udp --kazaa --bit -j DROP\n"
51 + " iptables -A FORWARD -m ipp2p --tcp --edk --soul -j DROP\n\n"
52 + , IPP2P_VERSION);
53 +}
54 +
55 +
56 +
57 +static struct option opts[] = {
58 + { "ipp2p", 0, 0, '1' },
59 + { "edk", 0, 0, '2' },
60 + { "ipp2p-data", 0, 0, '3' },
61 + { "kazaa-data", 0, 0, '4' },
62 + { "edk-data", 0, 0, '5' },
63 + { "dc-data", 0, 0, '6' },
64 + { "dc", 0, 0, '7' },
65 + { "gnu-data", 0, 0, '8' },
66 + { "gnu", 0, 0, '9' },
67 + { "kazaa", 0, 0, 'a' },
68 + { "bit", 0, 0, 'b' },
69 + { "apple", 0, 0, 'c' },
70 + { "soul", 0, 0, 'd' },
71 + { "winmx", 0, 0, 'e' },
72 + { "ares", 0, 0, 'f' },
73 + { "debug", 0, 0, 'g' },
74 + { "udp", 0, 0, 'h' },
75 + { "tcp", 0, 0, 'i' },
76 + {0}
77 +};
78 +
79 +
80 +
81 +static void
82 +init(struct ipt_entry_match *m, unsigned int *nfcache)
83 +{
84 + struct ipt_p2p_info *info = (struct ipt_p2p_info *)m->data;
85 +
86 + *nfcache |= NFC_UNKNOWN;
87 +
88 + /*init the module with default values*/
89 + info->cmd = 0;
90 + info->debug = 0;
91 + info->proto = IPP2P_PROTO_DEFAULT;
92 +
93 +}
94 +
95 +
96 +static int
97 +parse(int c, char **argv, int invert, unsigned int *flags,
98 + const struct ipt_entry *entry,
99 + unsigned int *nfcache,
100 + struct ipt_entry_match **match)
101 +{
102 + struct ipt_p2p_info *info = (struct ipt_p2p_info *)(*match)->data;
103 +
104 + switch (c) {
105 + case '1': /*cmd: ipp2p*/
106 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
107 + exit_error(PARAMETER_PROBLEM,
108 + "ipp2p: `--ipp2p' may only be "
109 + "specified once!");
110 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
111 + exit_error(PARAMETER_PROBLEM,
112 + "ipp2p: `--ipp2p-data' may only be "
113 + "specified alone!");
114 + if ((*flags) != 0)
115 + exit_error(PARAMETER_PROBLEM,
116 + "ipp2p: `--ipp2p' may only be "
117 + "specified alone!");
118 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
119 + *flags += SHORT_HAND_IPP2P;
120 + info->cmd = *flags;
121 + break;
122 +
123 + case '2': /*cmd: edk*/
124 + if ((*flags & IPP2P_EDK) == IPP2P_EDK)
125 + exit_error(PARAMETER_PROBLEM,
126 + "ipp2p: `--edk' may only be "
127 + "specified once");
128 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
129 + exit_error(PARAMETER_PROBLEM,
130 + "ipp2p: `--ipp2p' may only be "
131 + "specified alone!");
132 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
133 + exit_error(PARAMETER_PROBLEM,
134 + "ipp2p: `--ipp2p-data' may only be "
135 + "specified alone!");
136 + if ((*flags & IPP2P_DATA_EDK) == IPP2P_DATA_EDK)
137 + exit_error(PARAMETER_PROBLEM,
138 + "ipp2p: use `--edk' OR `--edk-data' but not both of them!");
139 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
140 + *flags += IPP2P_EDK;
141 + info->cmd = *flags;
142 + break;
143 +
144 + case '3': /*cmd: ipp2p-data*/
145 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
146 + exit_error(PARAMETER_PROBLEM,
147 + "ipp2p: `--ipp2p-data' may only be "
148 + "specified once!");
149 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
150 + exit_error(PARAMETER_PROBLEM,
151 + "ipp2p: `--ipp2p' may only be "
152 + "specified alone!");
153 + if ((*flags) != 0)
154 + exit_error(PARAMETER_PROBLEM,
155 + "ipp2p: `--ipp2p-data' may only be "
156 + "specified alone!");
157 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
158 + *flags += SHORT_HAND_DATA;
159 + info->cmd = *flags;
160 + break;
161 +
162 + case '4': /*cmd: kazaa-data*/
163 + if ((*flags & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA)
164 + exit_error(PARAMETER_PROBLEM,
165 + "ipp2p: `--kazaa-data' may only be "
166 + "specified once!");
167 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
168 + exit_error(PARAMETER_PROBLEM,
169 + "ipp2p: `--ipp2p' may only be "
170 + "specified alone!");
171 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
172 + exit_error(PARAMETER_PROBLEM,
173 + "ipp2p: `--ipp2p-data' may only be "
174 + "specified alone!");
175 + if ((*flags & IPP2P_KAZAA) == IPP2P_KAZAA)
176 + exit_error(PARAMETER_PROBLEM,
177 + "ipp2p: use `--kazaa' OR `--kazaa-data' but not both of them!");
178 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
179 + *flags += IPP2P_DATA_KAZAA;
180 + info->cmd = *flags;
181 + break;
182 +
183 + case '5': /*cmd: edk-data*/
184 + if ((*flags & IPP2P_DATA_EDK) == IPP2P_DATA_EDK)
185 + exit_error(PARAMETER_PROBLEM,
186 + "ipp2p: `--edk-data' may only be "
187 + "specified once!");
188 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
189 + exit_error(PARAMETER_PROBLEM,
190 + "ipp2p: `--ipp2p' may only be "
191 + "specified alone!");
192 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
193 + exit_error(PARAMETER_PROBLEM,
194 + "ipp2p: `--ipp2p-data' may only be "
195 + "specified alone!");
196 + if ((*flags & IPP2P_EDK) == IPP2P_EDK)
197 + exit_error(PARAMETER_PROBLEM,
198 + "ipp2p: use `--edk' OR `--edk-data' but not both of them!");
199 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
200 + *flags += IPP2P_DATA_EDK;
201 + info->cmd = *flags;
202 + break;
203 +
204 + case '6': /*cmd: dc-data*/
205 + if ((*flags & IPP2P_DATA_DC) == IPP2P_DATA_DC)
206 + exit_error(PARAMETER_PROBLEM,
207 + "ipp2p: `--dc-data' may only be "
208 + "specified once!");
209 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
210 + exit_error(PARAMETER_PROBLEM,
211 + "ipp2p: `--ipp2p-data' may only be "
212 + "specified alone!");
213 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
214 + exit_error(PARAMETER_PROBLEM,
215 + "ipp2p: `--ipp2p' may only be "
216 + "specified alone!");
217 + if ((*flags & IPP2P_DC) == IPP2P_DC)
218 + exit_error(PARAMETER_PROBLEM,
219 + "ipp2p: use `--dc' OR `--dc-data' but not both of them!");
220 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
221 + *flags += IPP2P_DATA_DC;
222 + info->cmd = *flags;
223 + break;
224 +
225 + case '7': /*cmd: dc*/
226 + if ((*flags & IPP2P_DC) == IPP2P_DC)
227 + exit_error(PARAMETER_PROBLEM,
228 + "ipp2p: `--dc' may only be "
229 + "specified once!");
230 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
231 + exit_error(PARAMETER_PROBLEM,
232 + "ipp2p: `--ipp2p' may only be "
233 + "specified alone!");
234 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
235 + exit_error(PARAMETER_PROBLEM,
236 + "ipp2p: `--ipp2p-data' may only be "
237 + "specified alone!");
238 + if ((*flags & IPP2P_DATA_DC) == IPP2P_DATA_DC)
239 + exit_error(PARAMETER_PROBLEM,
240 + "ipp2p: use `--dc' OR `--dc-data' but not both of them!");
241 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
242 + *flags += IPP2P_DC;
243 + info->cmd = *flags;
244 + break;
245 +
246 +
247 + case '8': /*cmd: gnu-data*/
248 + if ((*flags & IPP2P_DATA_GNU) == IPP2P_DATA_GNU)
249 + exit_error(PARAMETER_PROBLEM,
250 + "ipp2p: `--gnu-data' may only be "
251 + "specified once!");
252 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
253 + exit_error(PARAMETER_PROBLEM,
254 + "ipp2p: `--ipp2p' may only be "
255 + "specified alone!");
256 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
257 + exit_error(PARAMETER_PROBLEM,
258 + "ipp2p: `--ipp2p-data' may only be "
259 + "specified alone!");
260 + if ((*flags & IPP2P_GNU) == IPP2P_GNU)
261 + exit_error(PARAMETER_PROBLEM,
262 + "ipp2p: use `--gnu' OR `--gnu-data' but not both of them!");
263 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
264 + *flags += IPP2P_DATA_GNU;
265 + info->cmd = *flags;
266 + break;
267 +
268 + case '9': /*cmd: gnu*/
269 + if ((*flags & IPP2P_GNU) == IPP2P_GNU)
270 + exit_error(PARAMETER_PROBLEM,
271 + "ipp2p: `--gnu' may only be "
272 + "specified once!");
273 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
274 + exit_error(PARAMETER_PROBLEM,
275 + "ipp2p: `--ipp2p-data' may only be "
276 + "specified alone!");
277 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
278 + exit_error(PARAMETER_PROBLEM,
279 + "ipp2p: `--ipp2p' may only be "
280 + "specified alone!");
281 + if ((*flags & IPP2P_DATA_GNU) == IPP2P_DATA_GNU)
282 + exit_error(PARAMETER_PROBLEM,
283 + "ipp2p: use `--gnu' OR `--gnu-data' but not both of them!");
284 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
285 + *flags += IPP2P_GNU;
286 + info->cmd = *flags;
287 + break;
288 +
289 + case 'a': /*cmd: kazaa*/
290 + if ((*flags & IPP2P_KAZAA) == IPP2P_KAZAA)
291 + exit_error(PARAMETER_PROBLEM,
292 + "ipp2p: `--kazaa' may only be "
293 + "specified once!");
294 + if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA)
295 + exit_error(PARAMETER_PROBLEM,
296 + "ipp2p: `--ipp2p-data' may only be "
297 + "specified alone!");
298 + if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
299 + exit_error(PARAMETER_PROBLEM,
300 + "ipp2p: `--ipp2p' may only be "
301 + "specified alone!");
302 + if ((*flags & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA)
303 + exit_error(PARAMETER_PROBLEM,
304 + "ipp2p: use `--kazaa' OR `--kazaa-data' but not both of them!");
305 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
306 + *flags += IPP2P_KAZAA;
307 + info->cmd = *flags;
308 + break;
309 +
310 + case 'b': /*cmd: bit*/
311 + if ((*flags & IPP2P_BIT) == IPP2P_BIT)
312 + exit_error(PARAMETER_PROBLEM,
313 + "ipp2p: `--bit' may only be "
314 + "specified once!");
315 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
316 + *flags += IPP2P_BIT;
317 + info->cmd = *flags;
318 + break;
319 +
320 + case 'c': /*cmd: apple*/
321 + if ((*flags & IPP2P_APPLE) == IPP2P_APPLE)
322 + exit_error(PARAMETER_PROBLEM,
323 + "ipp2p: `--apple' may only be "
324 + "specified once!");
325 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
326 + *flags += IPP2P_APPLE;
327 + info->cmd = *flags;
328 + break;
329 +
330 +
331 + case 'd': /*cmd: soul*/
332 + if ((*flags & IPP2P_SOUL) == IPP2P_SOUL)
333 + exit_error(PARAMETER_PROBLEM,
334 + "ipp2p: `--soul' may only be "
335 + "specified once!");
336 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
337 + *flags += IPP2P_SOUL;
338 + info->cmd = *flags;
339 + break;
340 +
341 +
342 + case 'e': /*cmd: winmx*/
343 + if ((*flags & IPP2P_WINMX) == IPP2P_WINMX)
344 + exit_error(PARAMETER_PROBLEM,
345 + "ipp2p: `--winmx' may only be "
346 + "specified once!");
347 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
348 + *flags += IPP2P_WINMX;
349 + info->cmd = *flags;
350 + break;
351 +
352 + case 'f': /*cmd: ares*/
353 + if ((*flags & IPP2P_ARES) == IPP2P_ARES)
354 + exit_error(PARAMETER_PROBLEM,
355 + "ipp2p: `--ares' may only be "
356 + "specified once!");
357 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
358 + *flags += IPP2P_ARES;
359 + info->cmd = *flags;
360 + break;
361 +
362 + case 'g': /*cmd: debug*/
363 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
364 + info->debug = 1;
365 + break;
366 +
367 + case 'h': /*cmd: udp*/
368 + if ((info->proto & IPP2P_PROTO_UDP) == IPP2P_PROTO_UDP)
369 + exit_error(PARAMETER_PROBLEM,
370 + "ipp2p: --udp may only be specified once!");
371 +
372 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
373 + info->proto += IPP2P_PROTO_UDP;
374 + break;
375 +
376 +
377 + case 'i': /*cmd: tcp*/
378 + if ((info->proto & IPP2P_PROTO_TCP) == IPP2P_PROTO_TCP)
379 + exit_error(PARAMETER_PROBLEM,
380 + "ipp2p: --tcp may only be specified once!");
381 + if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!");
382 + info->proto += IPP2P_PROTO_TCP;
383 + break;
384 +
385 +
386 + default:
387 + exit_error(PARAMETER_PROBLEM,
388 + "\nipp2p-parameter problem: for ipp2p usage type: iptables -m ipp2p --help\n");
389 + return 0;
390 + }
391 + return 1;
392 +}
393 +
394 +
395 +static void
396 +final_check(unsigned int flags)
397 +{
398 + if (!flags)
399 + exit_error(PARAMETER_PROBLEM,
400 + "\nipp2p-parameter problem: for ipp2p usage type: iptables -m ipp2p --help\n");
401 +}
402 +
403 +
404 +
405 +static void
406 +print(const struct ipt_ip *ip,
407 + const struct ipt_entry_match *match,
408 + int numeric)
409 +{
410 + struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data;
411 +
412 + printf("ipp2p v%s", IPP2P_VERSION);
413 + if ((info->cmd & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) printf(" --ipp2p");
414 + if ((info->cmd & SHORT_HAND_DATA) == SHORT_HAND_DATA) printf(" --ipp2p-data");
415 + if ((info->cmd & IPP2P_KAZAA) == IPP2P_KAZAA) printf(" --kazaa");
416 + if ((info->cmd & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA) printf(" --kazaa-data");
417 + if ((info->cmd & IPP2P_DATA_GNU) == IPP2P_DATA_GNU) printf(" --gnu-data");
418 + if ((info->cmd & IPP2P_GNU) == IPP2P_GNU) printf(" --gnu");
419 + if ((info->cmd & IPP2P_EDK) == IPP2P_EDK) printf(" --edk");
420 + if ((info->cmd & IPP2P_DATA_EDK) == IPP2P_DATA_EDK) printf(" --edk-data");
421 + if ((info->cmd & IPP2P_DATA_DC) == IPP2P_DATA_DC) printf(" --dc-data");
422 + if ((info->cmd & IPP2P_DC) == IPP2P_DC) printf(" --dc");
423 + if ((info->cmd & IPP2P_BIT) == IPP2P_BIT) printf(" --bit");
424 + if ((info->cmd & IPP2P_APPLE) == IPP2P_APPLE) printf(" --apple");
425 + if ((info->cmd & IPP2P_SOUL) == IPP2P_SOUL) printf(" --soul");
426 + if ((info->cmd & IPP2P_WINMX) == IPP2P_WINMX) printf(" --winmx");
427 + if ((info->cmd & IPP2P_ARES) == IPP2P_ARES) printf(" --ares");
428 + if ((info->proto & IPP2P_PROTO_UDP) == IPP2P_PROTO_UDP) printf(" --udp");
429 + if ((info->proto & IPP2P_PROTO_TCP) == IPP2P_PROTO_TCP) printf(" --tcp");
430 + if (info->debug != 0) printf(" --debug");
431 + printf(" ");
432 +}
433 +
434 +
435 +
436 +static void
437 +save(const struct ipt_ip *ip, const struct ipt_entry_match *match)
438 +{
439 + struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data;
440 +
441 + if ((info->cmd & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) printf("--ipp2p ");
442 + if ((info->cmd & SHORT_HAND_DATA) == SHORT_HAND_DATA) printf("--ipp2p-data ");
443 + if ((info->cmd & IPP2P_KAZAA) == IPP2P_KAZAA) printf("--kazaa ");
444 + if ((info->cmd & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA) printf("--kazaa-data ");
445 + if ((info->cmd & IPP2P_DATA_GNU) == IPP2P_DATA_GNU) printf("--gnu-data ");
446 + if ((info->cmd & IPP2P_GNU) == IPP2P_GNU) printf("--gnu ");
447 + if ((info->cmd & IPP2P_EDK) == IPP2P_EDK) printf("--edk ");
448 + if ((info->cmd & IPP2P_DATA_EDK) == IPP2P_DATA_EDK) printf("--edk-data ");
449 + if ((info->cmd & IPP2P_DATA_DC) == IPP2P_DATA_DC) printf("--dc-data ");
450 + if ((info->cmd & IPP2P_DC) == IPP2P_DC) printf("--dc ");
451 + if ((info->cmd & IPP2P_BIT) == IPP2P_BIT) printf("--bit ");
452 + if ((info->cmd & IPP2P_APPLE) == IPP2P_APPLE) printf("--apple ");
453 + if ((info->cmd & IPP2P_SOUL) == IPP2P_SOUL) printf("--soul ");
454 + if ((info->cmd & IPP2P_WINMX) == IPP2P_WINMX) printf("--winmx ");
455 + if ((info->cmd & IPP2P_ARES) == IPP2P_ARES) printf("--ares ");
456 + if ((info->proto & IPP2P_PROTO_UDP) == IPP2P_PROTO_UDP) printf("--udp ");
457 + if ((info->proto & IPP2P_PROTO_TCP) == IPP2P_PROTO_TCP) printf("--tcp ");
458 + if (info->debug != 0) printf("--debug ");
459 +}
460 +
461 +
462 +
463 +
464 +static
465 +struct iptables_match ipp2p
466 += { NULL,
467 + "ipp2p",
468 + IPTABLES_VERSION,
469 + IPT_ALIGN(sizeof(struct ipt_p2p_info)),
470 + IPT_ALIGN(sizeof(struct ipt_p2p_info)),
471 + &help,
472 + &init,
473 + &parse,
474 + &final_check,
475 + &print,
476 + &save,
477 + opts
478 +};
479 +
480 +
481 +
482 +void _init(void)
483 +{
484 + register_match(&ipp2p);
485 +}
486 +
487 diff -urN iptables-1.2.11.old/extensions/Makefile iptables-1.2.11/extensions/Makefile
488 --- iptables-1.2.11.old/extensions/Makefile 2004-06-17 12:22:54.000000000 +0200
489 +++ iptables-1.2.11/extensions/Makefile 2005-03-01 17:51:19.000000000 +0100
490 @@ -8,6 +8,10 @@
491 PF_EXT_SLIB:=ah connlimit connmark conntrack dscp ecn esp helper icmp iprange length limit mac mark multiport owner physdev pkttype realm rpc sctp standard state tcp tcpmss tos ttl udp unclean CLASSIFY CONNMARK DNAT DSCP ECN LOG MARK MASQUERADE MIRROR NETMAP NOTRACK REDIRECT REJECT SAME SNAT TARPIT TCPMSS TOS TRACE TTL ULOG
492 PF6_EXT_SLIB:=eui64 hl icmpv6 length limit mac mark multiport owner standard tcp udp HL LOG MARK TRACE
493
494 +
495 +# ipp2p
496 +PF_EXT_SLIB += ipp2p
497 +
498 # Optionals
499 PF_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T)))
500 PF6_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test6),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T)))
501 diff -urN iptables-1.2.11.old/include/linux/netfilter_ipv4/ipt_ipp2p.h iptables-1.2.11/include/linux/netfilter_ipv4/ipt_ipp2p.h
502 --- iptables-1.2.11.old/include/linux/netfilter_ipv4/ipt_ipp2p.h 1970-01-01 01:00:00.000000000 +0100
503 +++ iptables-1.2.11/include/linux/netfilter_ipv4/ipt_ipp2p.h 2005-03-01 17:48:03.000000000 +0100
504 @@ -0,0 +1,34 @@
505 +#ifndef __IPT_IPP2P_H
506 +#define __IPT_IPP2P_H
507 +#define IPP2P_VERSION "0.7.1"
508 +
509 +struct ipt_p2p_info {
510 + int cmd;
511 + int debug;
512 + int proto;
513 +};
514 +
515 +#endif //__IPT_IPP2P_H
516 +
517 +#define SHORT_HAND_IPP2P 1 /* --ipp2p switch*/
518 +#define SHORT_HAND_DATA 4 /* --ipp2p-data switch*/
519 +#define SHORT_HAND_NONE 5 /* no short hand*/
520 +
521 +#define IPP2P_EDK 2
522 +#define IPP2P_DATA_KAZAA 8
523 +#define IPP2P_DATA_EDK 16
524 +#define IPP2P_DATA_DC 32
525 +#define IPP2P_DC 64
526 +#define IPP2P_DATA_GNU 128
527 +#define IPP2P_GNU 256
528 +#define IPP2P_KAZAA 512
529 +#define IPP2P_BIT 1024
530 +#define IPP2P_APPLE 2048
531 +#define IPP2P_SOUL 4096
532 +#define IPP2P_WINMX 8192
533 +#define IPP2P_ARES 16384
534 +
535 +#define IPP2P_PROTO_DEFAULT 1
536 +#define IPP2P_PROTO_UDP 2
537 +#define IPP2P_PROTO_TCP 4
538 +