1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
* NATv6: IPv6-to-IPv6 Network Prefix Translation as
* proposed in RFC 6296.
* Based on MAP66 (c) 2010 sven-ola()gmx.de
* (c) 2011 mschiffer()universe-factory.net "I'm the one to blame for any problems with this version ;P"
*/
#include "libip6t_NPTV6.h"
static void SNPTV6_help(void)
{
printf(
"SNPTV6 target options\n"
" --to-source ipv6addr/prefixlength (Prefix to map IPv6 source address to)\n");
NPTV6_help_note();
}
static void SNPTV6_save(const void *ip, const struct xt_entry_target *target)
{
const struct ip6t_nptv6_info* info = (struct ip6t_nptv6_info*)target->data;
printf(" --to-source %s/%d ", xtables_ip6addr_to_numeric(&info->nptv6_prefix), info->nptv6_prefix_len);
}
static const struct xt_option_entry SNPTV6_opts[] = {
{.name = "to-source", .id = 0, .type = XTTYPE_STRING, .flags = XTOPT_MAND},
XTOPT_TABLEEND,
};
static struct xtables_target SNPTV6_tg6_reg = {
.name = "SNPTV6",
.version = XTABLES_VERSION,
.family = NFPROTO_IPV6,
.size = XT_ALIGN(sizeof(struct ip6t_nptv6_info)),
.userspacesize = XT_ALIGN(sizeof(struct ip6t_nptv6_info)),
.help = SNPTV6_help,
.x6_parse = NPTV6_parse,
.print = NPTV6_print,
.save = SNPTV6_save,
.x6_options = SNPTV6_opts,
};
void _init(void)
{
xtables_register_target(&SNPTV6_tg6_reg);
}
|