iptables-1.2.9-2.3.1.src.rpm
[iptables.git] / extensions / libipt_IPV4OPTSSTRIP.c
1 /* Shared library add-on to iptables for IPV4OPTSSTRIP
2  * This modules strip all the IP options.
3  *
4  * (C) 2001 by Fabrice MARIE <fabrice@netfilter.org>
5  * This program is distributed under the terms of GNU GPL v2, 1991
6  */
7
8 #include <stdio.h>
9 #include <string.h>
10 #include <stdlib.h>
11 #include <getopt.h>
12
13 #include <iptables.h>
14 #include <linux/netfilter_ipv4/ip_tables.h>
15
16 static void init(struct ipt_entry_target *t, unsigned int *nfcache) 
17 {
18         *nfcache |= NFC_UNKNOWN;
19 }
20
21 static void help(void) 
22 {
23         printf("IPV4OPTSSTRIP v%s target takes no option !! Make sure you use it in the mangle table.\n",
24                IPTABLES_VERSION);
25 }
26
27 static struct option opts[] = {
28         { 0 }
29 };
30
31 /* Function which parses command options; returns true if it
32    ate an option */
33 static int
34 parse(int c, char **argv, int invert, unsigned int *flags,
35       const struct ipt_entry *entry,
36       struct ipt_entry_target **target)
37 {
38         return 0;
39 }
40
41 static void
42 final_check(unsigned int flags)
43 {
44 }
45
46 /* Prints out the targinfo. */
47 static void
48 print(const struct ipt_ip *ip,
49       const struct ipt_entry_target *target,
50       int numeric)
51 {
52         /* nothing to print, we don't take option... */
53 }
54
55 /* Saves the stuff in parsable form to stdout. */
56 static void
57 save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
58 {
59         /* nothing to print, we don't take option... */
60 }
61
62 static
63 struct iptables_target IPV4OPTSSTRIP
64 = { NULL,
65     "IPV4OPTSSTRIP",
66     IPTABLES_VERSION,
67     IPT_ALIGN(0),
68     IPT_ALIGN(0),
69     &help,
70     &init,
71     &parse,
72     &final_check,
73     &print,
74     &save,
75     opts
76 };
77
78 void _init(void)
79 {
80         register_target(&IPV4OPTSSTRIP);
81 }