Harald Welte | e920f29 | 2002-03-24 20:57:26 +0000 | [diff] [blame] | 1 | /* Shared library add-on to ip6tables to add EUI64 address checking support. */ |
András Kis-Szabó | 81adae9 | 2001-04-12 15:35:32 +0000 | [diff] [blame] | 2 | #include <stdio.h> |
| 3 | #include <netdb.h> |
| 4 | #include <string.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <getopt.h> |
| 7 | #if defined(__GLIBC__) && __GLIBC__ == 2 |
| 8 | #include <net/ethernet.h> |
| 9 | #else |
| 10 | #include <linux/if_ether.h> |
| 11 | #endif |
| 12 | #include <ip6tables.h> |
| 13 | |
| 14 | /* Function which prints out usage message. */ |
| 15 | static void |
| 16 | help(void) |
| 17 | { |
| 18 | printf( |
Harald Welte | e920f29 | 2002-03-24 20:57:26 +0000 | [diff] [blame] | 19 | "eui64 v%s options:\n" |
András Kis-Szabó | 81adae9 | 2001-04-12 15:35:32 +0000 | [diff] [blame] | 20 | " This module hasn't got any option\n" |
Harald Welte | e920f29 | 2002-03-24 20:57:26 +0000 | [diff] [blame] | 21 | " This module checks for EUI64 IPv6 addresses\n" |
Harald Welte | 80fe35d | 2002-05-29 13:08:15 +0000 | [diff] [blame] | 22 | "\n", IPTABLES_VERSION); |
András Kis-Szabó | 81adae9 | 2001-04-12 15:35:32 +0000 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | static struct option opts[] = { |
| 26 | {0} |
| 27 | }; |
| 28 | |
András Kis-Szabó | 81adae9 | 2001-04-12 15:35:32 +0000 | [diff] [blame] | 29 | /* Function which parses command options; returns true if it |
| 30 | ate an option */ |
| 31 | static int |
| 32 | parse(int c, char **argv, int invert, unsigned int *flags, |
| 33 | const struct ip6t_entry *entry, |
| 34 | unsigned int *nfcache, |
| 35 | struct ip6t_entry_match **match) |
| 36 | { |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | /* Final check */ |
| 41 | static void final_check(unsigned int flags) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | /* Prints out the matchinfo. */ |
| 46 | static void |
| 47 | print(const struct ip6t_ip6 *ip, |
| 48 | const struct ip6t_entry_match *match, |
| 49 | int numeric) |
| 50 | { |
Harald Welte | e920f29 | 2002-03-24 20:57:26 +0000 | [diff] [blame] | 51 | printf("eui64 "); |
András Kis-Szabó | 81adae9 | 2001-04-12 15:35:32 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | /* Saves the union ip6t_matchinfo in parsable form to stdout. */ |
| 55 | static void save(const struct ip6t_ip6 *ip, const struct ip6t_entry_match *match) |
| 56 | { |
Harald Welte | e920f29 | 2002-03-24 20:57:26 +0000 | [diff] [blame] | 57 | |
András Kis-Szabó | 81adae9 | 2001-04-12 15:35:32 +0000 | [diff] [blame] | 58 | } |
| 59 | |
Harald Welte | 02aa733 | 2005-02-01 15:38:20 +0000 | [diff] [blame] | 60 | static struct ip6tables_match eui64 = { |
| 61 | .name = "eui64", |
| 62 | .version = IPTABLES_VERSION, |
| 63 | .size = IP6T_ALIGN(sizeof(int)), |
| 64 | .userspacesize = IP6T_ALIGN(sizeof(int)), |
| 65 | .help = &help, |
Harald Welte | 02aa733 | 2005-02-01 15:38:20 +0000 | [diff] [blame] | 66 | .parse = &parse, |
| 67 | .final_check = &final_check, |
| 68 | .print = &print, |
| 69 | .save = &save, |
| 70 | .extra_opts = opts, |
András Kis-Szabó | 81adae9 | 2001-04-12 15:35:32 +0000 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | void _init(void) |
| 74 | { |
Harald Welte | e920f29 | 2002-03-24 20:57:26 +0000 | [diff] [blame] | 75 | register_match6(&eui64); |
András Kis-Szabó | 81adae9 | 2001-04-12 15:35:32 +0000 | [diff] [blame] | 76 | } |