9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
10 #include <linux/kernel.h>
11 #include <linux/module.h>
16 #include <linux/netfilter.h>
18 #include <linux/netfilter/x_tables.h>
30 return ((a1->
ip ^ a2->
ip) & m->
ip) == 0;
32 return ipv6_masked_addr_cmp(&a1->
in6, &m->
in6, &a2->
in6) == 0;
39 unsigned short family)
41 #define MATCH_ADDR(x,y,z) (!e->match.x || \
42 (xt_addr_cmp(&e->x, &e->y, (const union nf_inet_addr *)(z), family) \
44 #define MATCH(x,y) (!e->match.x || ((e->x == (y)) ^ e->invert.x))
56 unsigned short family)
65 if (strict && info->
len != sp->
len)
68 for (i = sp->
len - 1; i >= 0; i--) {
69 pos = strict ? i - sp->
len + 1 : 0;
74 if (match_xfrm_state(sp->
xvec[i], e, family)) {
81 return strict ? 1 : 0;
86 unsigned short family)
93 if (dst->xfrm ==
NULL)
96 for (i = 0; dst && dst->xfrm; dst = dst->
child, i++) {
102 if (match_xfrm_state(dst->xfrm, e, family)) {
109 return strict ? i == info->
len : 0;
119 ret = match_policy_in(skb, info, par->
family);
121 ret = match_policy_out(skb, info, par->
family);
136 pr_info(
"neither incoming nor outgoing policy selected\n");
141 pr_info(
"output policy not valid in PREROUTING and INPUT\n");
146 pr_info(
"input policy not valid in POSTROUTING and OUTPUT\n");
150 pr_info(
"too many policy elements\n");
160 .checkentry = policy_mt_check,
168 .checkentry = policy_mt_check,
175 static int __init policy_mt_init(
void)
180 static void __exit policy_mt_exit(
void)