yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | /* Shared library add-on to iptables to add NOTRACK target support. */ |
| 2 | #include <stdio.h> |
| 3 | #include <string.h> |
| 4 | #include <stdlib.h> |
| 5 | #include <getopt.h> |
| 6 | |
| 7 | #include <xtables.h> |
| 8 | #include <linux/netfilter/x_tables.h> |
| 9 | |
| 10 | static void NOTRACK_help(void) |
| 11 | { |
| 12 | printf("NOTRACK target takes no options\n"); |
| 13 | } |
| 14 | |
| 15 | static int |
| 16 | NOTRACK_parse(int c, char **argv, int invert, unsigned int *flags, |
| 17 | const void *entry, struct xt_entry_target **target) |
| 18 | { |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | static struct xtables_target notrack_target = { |
| 23 | .family = NFPROTO_IPV4, |
| 24 | .name = "NOTRACK", |
| 25 | .version = XTABLES_VERSION, |
| 26 | .size = XT_ALIGN(0), |
| 27 | .userspacesize = XT_ALIGN(0), |
| 28 | .help = NOTRACK_help, |
| 29 | .parse = NOTRACK_parse, |
| 30 | }; |
| 31 | |
| 32 | static struct xtables_target notrack_target6 = { |
| 33 | .family = NFPROTO_IPV6, |
| 34 | .name = "NOTRACK", |
| 35 | .version = XTABLES_VERSION, |
| 36 | .size = XT_ALIGN(0), |
| 37 | .userspacesize = XT_ALIGN(0), |
| 38 | .help = NOTRACK_help, |
| 39 | .parse = NOTRACK_parse, |
| 40 | }; |
| 41 | |
| 42 | void _init(void) |
| 43 | { |
| 44 | xtables_register_target(¬rack_target); |
| 45 | xtables_register_target(¬rack_target6); |
| 46 | } |