10 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11 #include <linux/module.h>
13 #include <linux/netdevice.h>
20 #include <linux/netfilter/x_tables.h>
29 if (ipv4_is_multicast(addr) || ipv4_is_lbcast(addr) ||
30 ipv4_is_zeronet(addr))
35 static bool rpfilter_lookup_reverse(
struct flowi4 *fl4,
40 struct net *
net = dev_net(dev);
43 if (fib_lookup(net, fl4, &
res))
51 #ifdef CONFIG_IP_ROUTE_MULTIPATH
72 const struct iphdr *iph;
83 if (ipv4_is_multicast(iph->
daddr)) {
84 if (ipv4_is_zeronet(iph->
saddr))
85 return ipv4_is_local_multicast(iph->
daddr) ^ invert;
91 flow.daddr = iph->
saddr;
92 flow.saddr = rpfilter_get_saddr(iph->
daddr);
98 return rpfilter_lookup_reverse(&flow, par->
in, info->
flags) ^ invert;
104 unsigned int options = ~XT_RPFILTER_OPTION_MASK;
105 if (info->
flags & options) {
106 pr_info(
"unknown options encountered");
112 pr_info(
"match only valid in the \'raw\' "
113 "or \'mangle\' tables, not \'%s\'.\n", par->
table);
123 .checkentry = rpfilter_check,
124 .match = rpfilter_mt,
130 static int __init rpfilter_mt_init(
void)
135 static void __exit rpfilter_mt_exit(
void)