libip6t_eui64.c revision e920f29853671e9a7f7fea3e0b43305136793159
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", NETFILTER_VERSION); 23} 24 25static struct option opts[] = { 26 {0} 27}; 28 29/* Initialize the match. */ 30static void 31init(struct ip6t_entry_match *m, unsigned int *nfcache) 32{ 33 /* Can't cache this */ 34 *nfcache |= NFC_UNKNOWN; 35} 36 37/* Function which parses command options; returns true if it 38 ate an option */ 39static int 40parse(int c, char **argv, int invert, unsigned int *flags, 41 const struct ip6t_entry *entry, 42 unsigned int *nfcache, 43 struct ip6t_entry_match **match) 44{ 45 return 0; 46} 47 48/* Final check */ 49static void final_check(unsigned int flags) 50{ 51} 52 53/* Prints out the matchinfo. */ 54static void 55print(const struct ip6t_ip6 *ip, 56 const struct ip6t_entry_match *match, 57 int numeric) 58{ 59 printf("eui64 "); 60} 61 62/* Saves the union ip6t_matchinfo in parsable form to stdout. */ 63static void save(const struct ip6t_ip6 *ip, const struct ip6t_entry_match *match) 64{ 65 66} 67 68static 69struct ip6tables_match eui64 70= { NULL, 71 "eui64", 72 NETFILTER_VERSION, 73 IP6T_ALIGN(sizeof(int)), 74 IP6T_ALIGN(sizeof(int)), 75 &help, 76 &init, 77 &parse, 78 &final_check, 79 &print, 80 &save, 81 opts 82}; 83 84void _init(void) 85{ 86 register_match6(&eui64); 87} 88