libip6t_eui64.c revision ea146a982e26c42f9954f140276f8deeb2edbe98
1/* Shared library add-on to ip6tables to add EUI64 address checking support. */
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. */
15static void
16help(void)
17{
18	printf(
19"eui64 v%s options:\n"
20" This module hasn't got any option\n"
21" This module checks for EUI64 IPv6 addresses\n"
22"\n", IPTABLES_VERSION);
23}
24
25/* Function which parses command options; returns true if it
26   ate an option */
27static int
28parse(int c, char **argv, int invert, unsigned int *flags,
29      const void *entry,
30      struct xt_entry_match **match)
31{
32	return 0;
33}
34
35/* Final check */
36static void final_check(unsigned int flags)
37{
38}
39
40/* Prints out the matchinfo. */
41static void
42print(const void *ip,
43      const struct xt_entry_match *match,
44      int numeric)
45{
46	printf("eui64 ");
47}
48
49/* Saves the union ip6t_matchinfo in parsable form to stdout. */
50static void save(const void *ip, const struct xt_entry_match *match)
51{
52
53}
54
55static struct ip6tables_match eui64 = {
56	.name 		= "eui64",
57	.version	= IPTABLES_VERSION,
58	.size		= IP6T_ALIGN(sizeof(int)),
59	.userspacesize	= IP6T_ALIGN(sizeof(int)),
60	.help		= &help,
61	.parse		= &parse,
62	.final_check	= &final_check,
63	.print		= &print,
64	.save		= &save,
65};
66
67void _init(void)
68{
69	register_match6(&eui64);
70}
71