aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/xt_addrtype.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2019-02-02 10:17:00 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2019-02-04 18:21:12 +0100
commitac02bcf9cc1e4aefb0a7156a2ae26e8396b15f24 (patch)
treef18ef2303361b54f638b972bbef707018b7a346d /net/netfilter/xt_addrtype.c
parentnetfilter: nat: remove module dependency on ipv6 core (diff)
downloadlinux-dev-ac02bcf9cc1e4aefb0a7156a2ae26e8396b15f24.tar.xz
linux-dev-ac02bcf9cc1e4aefb0a7156a2ae26e8396b15f24.zip
netfilter: ipv6: avoid indirect calls for IPV6=y case
indirect calls are only needed if ipv6 is a module. Add helpers to abstract the v6ops indirections and use them instead. fragment, reroute and route_input are kept as indirect calls. The first two are not not used in hot path and route_input is only used by bridge netfilter. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/xt_addrtype.c')
-rw-r--r--net/netfilter/xt_addrtype.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/net/netfilter/xt_addrtype.c b/net/netfilter/xt_addrtype.c
index 89e281b3bfc2..29987ff03621 100644
--- a/net/netfilter/xt_addrtype.c
+++ b/net/netfilter/xt_addrtype.c
@@ -36,7 +36,6 @@ MODULE_ALIAS("ip6t_addrtype");
static u32 match_lookup_rt6(struct net *net, const struct net_device *dev,
const struct in6_addr *addr, u16 mask)
{
- const struct nf_ipv6_ops *v6ops;
struct flowi6 flow;
struct rt6_info *rt;
u32 ret = 0;
@@ -47,18 +46,13 @@ static u32 match_lookup_rt6(struct net *net, const struct net_device *dev,
if (dev)
flow.flowi6_oif = dev->ifindex;
- v6ops = nf_get_ipv6_ops();
- if (v6ops) {
- if (dev && (mask & XT_ADDRTYPE_LOCAL)) {
- if (v6ops->chk_addr(net, addr, dev, true))
- ret = XT_ADDRTYPE_LOCAL;
- }
- route_err = v6ops->route(net, (struct dst_entry **)&rt,
- flowi6_to_flowi(&flow), false);
- } else {
- route_err = 1;
+ if (dev && (mask & XT_ADDRTYPE_LOCAL)) {
+ if (nf_ipv6_chk_addr(net, addr, dev, true))
+ ret = XT_ADDRTYPE_LOCAL;
}
+ route_err = nf_ip6_route(net, (struct dst_entry **)&rt,
+ flowi6_to_flowi(&flow), false);
if (route_err)
return XT_ADDRTYPE_UNREACHABLE;