]>
Commit | Line | Data |
---|---|---|
25866c73 JR |
1 | diff -urN iptables-1.3.8/extensions/libipt_IPV4OPTSSTRIP.c iptables/extensions/libipt_IPV4OPTSSTRIP.c |
2 | --- iptables-1.3.8/extensions/libipt_IPV4OPTSSTRIP.c 1970-01-01 01:00:00.000000000 +0100 | |
3 | +++ iptables/extensions/libipt_IPV4OPTSSTRIP.c 2006-12-12 11:34:45.000000000 +0100 | |
4 | @@ -0,0 +1,74 @@ | |
5 | +/* Shared library add-on to iptables for IPV4OPTSSTRIP | |
6 | + * This modules strip all the IP options. | |
7 | + * | |
8 | + * (C) 2001 by Fabrice MARIE <fabrice@netfilter.org> | |
9 | + * This program is distributed under the terms of GNU GPL v2, 1991 | |
10 | + */ | |
11 | + | |
12 | +#include <stdio.h> | |
13 | +#include <string.h> | |
14 | +#include <stdlib.h> | |
15 | +#include <getopt.h> | |
16 | + | |
17 | +#include <iptables.h> | |
18 | +#include <linux/netfilter_ipv4/ip_tables.h> | |
19 | + | |
20 | +static void help(void) | |
21 | +{ | |
22 | + printf("IPV4OPTSSTRIP v%s target takes no option !! Make sure you use it in the mangle table.\n", | |
76007b2c | 23 | + XTABLES_VERSION); |
25866c73 JR |
24 | +} |
25 | + | |
26 | +static struct option opts[] = { | |
27 | + { 0 } | |
28 | +}; | |
29 | + | |
30 | +/* Function which parses command options; returns true if it | |
31 | + ate an option */ | |
32 | +static int | |
33 | +parse(int c, char **argv, int invert, unsigned int *flags, | |
992f4d93 | 34 | + const void *entry, |
35 | + struct xt_entry_target **target) | |
25866c73 JR |
36 | +{ |
37 | + return 0; | |
38 | +} | |
39 | + | |
40 | +static void | |
41 | +final_check(unsigned int flags) | |
42 | +{ | |
43 | +} | |
44 | + | |
45 | +/* Prints out the targinfo. */ | |
46 | +static void | |
992f4d93 | 47 | +print(const void *ip, |
48 | + const struct xt_entry_target *target, | |
25866c73 JR |
49 | + int numeric) |
50 | +{ | |
51 | + /* nothing to print, we don't take option... */ | |
52 | +} | |
53 | + | |
54 | +/* Saves the stuff in parsable form to stdout. */ | |
55 | +static void | |
992f4d93 | 56 | +save(const void *ip, const struct xt_entry_target *target) |
25866c73 JR |
57 | +{ |
58 | + /* nothing to print, we don't take option... */ | |
59 | +} | |
60 | + | |
76007b2c | 61 | +static struct xtables_target IPV4OPTSSTRIP = { |
25866c73 JR |
62 | + .next = NULL, |
63 | + .name = "IPV4OPTSSTRIP", | |
76007b2c | 64 | + .version = XTABLES_VERSION, |
25866c73 JR |
65 | + .size = IPT_ALIGN(0), |
66 | + .userspacesize = IPT_ALIGN(0), | |
67 | + .help = &help, | |
68 | + .parse = &parse, | |
69 | + .final_check = &final_check, | |
70 | + .print = &print, | |
71 | + .save = &save, | |
72 | + .extra_opts = opts | |
73 | +}; | |
74 | + | |
75 | +void _init(void) | |
76 | +{ | |
76007b2c | 77 | + xtables_register_target(&IPV4OPTSSTRIP); |
25866c73 JR |
78 | +} |
79 | diff -urN iptables-1.3.8/extensions/libipt_IPV4OPTSSTRIP.man iptables/extensions/libipt_IPV4OPTSSTRIP.man | |
80 | --- iptables-1.3.8/extensions/libipt_IPV4OPTSSTRIP.man 1970-01-01 01:00:00.000000000 +0100 | |
81 | +++ iptables/extensions/libipt_IPV4OPTSSTRIP.man 2006-12-12 11:34:45.000000000 +0100 | |
82 | @@ -0,0 +1,5 @@ | |
83 | +Strip all the IP options from a packet. | |
84 | + | |
85 | +The target doesn't take any option, and therefore is extremly easy to use : | |
86 | + | |
87 | +# iptables -t mangle -A PREROUTING -j IPV4OPTSSTRIP | |
34e1a8df | 88 |