11 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
12 #include <linux/module.h>
15 #include <linux/ipv6.h>
16 #include <linux/netfilter/x_tables.h>
23 const struct iphdr *iph = ip_hdr(skb);
31 pr_debug(
"src IP %pI4 NOT in range %s%pI4-%pI4\n",
44 pr_debug(
"dst IP %pI4 NOT in range %s%pI4-%pI4\n",
60 for (i = 0; i < 4; ++
i) {
61 if (a->s6_addr32[i] != b->s6_addr32[i])
62 return ntohl(a->s6_addr32[i]) <
ntohl(b->s6_addr32[i]);
72 const struct ipv6hdr *iph = ipv6_hdr(skb);
76 m = iprange_ipv6_lt(&iph->
saddr, &info->src_min.in6);
80 pr_debug(
"src IP %pI6 NOT in range %s%pI6-%pI6\n",
89 m = iprange_ipv6_lt(&iph->
daddr, &info->dst_min.in6);
93 pr_debug(
"dst IP %pI6 NOT in range %s%pI6-%pI6\n",
109 .match = iprange_mt4,
117 .match = iprange_mt6,
123 static int __init iprange_mt_init(
void)
128 static void __exit iprange_mt_exit(
void)