Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 1 | /* Shared library add-on to iptables for standard target support. */ |
| 2 | #include <stdio.h> |
| 3 | #include <netdb.h> |
| 4 | #include <string.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <limits.h> |
| 7 | #include <getopt.h> |
Yasuyuki KOZAKAI | e72f60e | 2007-07-24 07:00:40 +0000 | [diff] [blame] | 8 | #include <xtables.h> |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 9 | |
| 10 | /* Function which prints out usage message. */ |
| 11 | static void |
| 12 | help(void) |
| 13 | { |
| 14 | printf( |
| 15 | "Standard v%s options:\n" |
Harald Welte | 80fe35d | 2002-05-29 13:08:15 +0000 | [diff] [blame] | 16 | "(If target is DROP, ACCEPT, RETURN or nothing)\n", IPTABLES_VERSION); |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 17 | } |
| 18 | |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 19 | /* Function which parses command options; returns true if it |
| 20 | ate an option */ |
| 21 | static int |
| 22 | parse(int c, char **argv, int invert, unsigned int *flags, |
Yasuyuki KOZAKAI | c0a9ab9 | 2007-07-24 06:02:05 +0000 | [diff] [blame] | 23 | const void *entry, |
Yasuyuki KOZAKAI | 193df8e | 2007-07-24 05:57:28 +0000 | [diff] [blame] | 24 | struct xt_entry_target **target) |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 25 | { |
| 26 | return 0; |
| 27 | } |
| 28 | |
Harald Welte | 3efb6ea | 2001-08-06 18:50:21 +0000 | [diff] [blame] | 29 | static |
Yasuyuki KOZAKAI | e72f60e | 2007-07-24 07:00:40 +0000 | [diff] [blame] | 30 | struct xtables_target standard = { |
Yasuyuki KOZAKAI | e72f60e | 2007-07-24 07:00:40 +0000 | [diff] [blame] | 31 | .family = AF_INET, |
Pablo Neira | 8caee8b | 2004-12-28 13:11:59 +0000 | [diff] [blame] | 32 | .name = "standard", |
| 33 | .version = IPTABLES_VERSION, |
Yasuyuki KOZAKAI | e72f60e | 2007-07-24 07:00:40 +0000 | [diff] [blame] | 34 | .size = XT_ALIGN(sizeof(int)), |
| 35 | .userspacesize = XT_ALIGN(sizeof(int)), |
| 36 | .help = &help, |
Yasuyuki KOZAKAI | e72f60e | 2007-07-24 07:00:40 +0000 | [diff] [blame] | 37 | .parse = &parse, |
Yasuyuki KOZAKAI | e72f60e | 2007-07-24 07:00:40 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | static |
| 41 | struct xtables_target standard6 = { |
Yasuyuki KOZAKAI | e72f60e | 2007-07-24 07:00:40 +0000 | [diff] [blame] | 42 | .family = AF_INET6, |
| 43 | .name = "standard", |
| 44 | .version = IPTABLES_VERSION, |
| 45 | .size = XT_ALIGN(sizeof(int)), |
| 46 | .userspacesize = XT_ALIGN(sizeof(int)), |
Pablo Neira | 8caee8b | 2004-12-28 13:11:59 +0000 | [diff] [blame] | 47 | .help = &help, |
Pablo Neira | 8caee8b | 2004-12-28 13:11:59 +0000 | [diff] [blame] | 48 | .parse = &parse, |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | void _init(void) |
| 52 | { |
Yasuyuki KOZAKAI | e72f60e | 2007-07-24 07:00:40 +0000 | [diff] [blame] | 53 | xtables_register_target(&standard); |
| 54 | xtables_register_target(&standard6); |
Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 55 | } |