iptables-1.3.2-20050720
[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 help(void) 
17 {
18         printf("IPV4OPTSSTRIP v%s target takes no option !! Make sure you use it in the mangle table.\n",
19                IPTABLES_VERSION);
20 }
21
22 static struct option opts[] = {
23         { 0 }
24 };
25
26 /* Function which parses command options; returns true if it
27    ate an option */
28 static int
29 parse(int c, char **argv, int invert, unsigned int *flags,
30       const struct ipt_entry *entry,
31       struct ipt_entry_target **target)
32 {
33         return 0;
34 }
35
36 static void
37 final_check(unsigned int flags)
38 {
39 }
40
41 /* Prints out the targinfo. */
42 static void
43 print(const struct ipt_ip *ip,
44       const struct ipt_entry_target *target,
45       int numeric)
46 {
47         /* nothing to print, we don't take option... */
48 }
49
50 /* Saves the stuff in parsable form to stdout. */
51 static void
52 save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
53 {
54         /* nothing to print, we don't take option... */
55 }
56
57 static struct iptables_target IPV4OPTSSTRIP = { 
58         .next           = NULL,
59         .name           = "IPV4OPTSSTRIP",
60         .version        = IPTABLES_VERSION,
61         .size           = IPT_ALIGN(0),
62         .userspacesize  = IPT_ALIGN(0),
63         .help           = &help,
64         .parse          = &parse,
65         .final_check    = &final_check,
66         .print          = &print,
67         .save           = &save,
68         .extra_opts     = opts
69 };
70
71 void _init(void)
72 {
73         register_target(&IPV4OPTSSTRIP);
74 }