11 #include <linux/kernel.h>
12 #include <linux/module.h>
13 #include <linux/netdevice.h>
14 #include <linux/ipv6.h>
15 #include <linux/netfilter.h>
16 #include <linux/netfilter_ipv4.h>
17 #include <linux/netfilter_ipv6.h>
18 #include <linux/netfilter/x_tables.h>
31 ct = nf_ct_get(skb, &ctinfo);
38 new_addr.in6 = ipv6_hdr(skb)->daddr;
40 new_addr.in6 = ipv6_hdr(skb)->saddr;
42 for (i = 0; i <
ARRAY_SIZE(new_addr.ip6); i++) {
43 new_addr.ip6[
i] &= ~netmask.ip6[
i];
49 newrange.min_addr = new_addr;
50 newrange.max_addr = new_addr;
79 ct = nf_ct_get(skb, &ctinfo);
81 netmask = ~(mr->
range[0].min_ip ^ mr->
range[0].max_ip);
85 new_ip = ip_hdr(skb)->daddr & ~netmask;
87 new_ip = ip_hdr(skb)->saddr & ~netmask;
88 new_ip |= mr->
range[0].min_ip & netmask;
90 memset(&newrange.min_addr, 0,
sizeof(newrange.min_addr));
91 memset(&newrange.max_addr, 0,
sizeof(newrange.max_addr));
93 newrange.min_addr.ip = new_ip;
94 newrange.max_addr.ip = new_ip;
95 newrange.min_proto = mr->
range[0].min;
96 newrange.max_proto = mr->
range[0].max;
122 .target = netmap_tg6,
129 .checkentry = netmap_tg6_checkentry,
136 .target = netmap_tg4,
143 .checkentry = netmap_tg4_check,
148 static int __init netmap_tg_init(
void)
153 static void netmap_tg_exit(
void)