xfrm: remove init_flags indirection from xfrm_state_afinfo
authorFlorian Westphal <fw@strlen.de>
Fri, 3 May 2019 15:46:16 +0000 (17:46 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 5 Jun 2019 11:16:30 +0000 (13:16 +0200)
There is only one implementation of this function; just call it directly.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/net/xfrm.h
net/ipv4/xfrm4_state.c
net/xfrm/xfrm_state.c

index e8f676ce27be0425fde6fdb664ffd06a780eb40c..61214f5c320574cd5362753d8841fca4ff027f6d 100644 (file)
@@ -353,7 +353,6 @@ struct xfrm_state_afinfo {
        const struct xfrm_type          *type_map[IPPROTO_MAX];
        const struct xfrm_type_offload  *type_offload_map[IPPROTO_MAX];
 
-       int                     (*init_flags)(struct xfrm_state *x);
        int                     (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
        int                     (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
        int                     (*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
index 018448e222af605065c3cb0a1422c1f327e91396..62c96da38b4eb72ac6f74b86a566adde99b65df0 100644 (file)
 #include <linux/netfilter_ipv4.h>
 #include <linux/export.h>
 
-static int xfrm4_init_flags(struct xfrm_state *x)
-{
-       if (xs_net(x)->ipv4.sysctl_ip_no_pmtu_disc)
-               x->props.flags |= XFRM_STATE_NOPMTUDISC;
-       return 0;
-}
-
 int xfrm4_extract_header(struct sk_buff *skb)
 {
        const struct iphdr *iph = ip_hdr(skb);
@@ -43,7 +36,6 @@ static struct xfrm_state_afinfo xfrm4_state_afinfo = {
        .proto                  = IPPROTO_IPIP,
        .eth_proto              = htons(ETH_P_IP),
        .owner                  = THIS_MODULE,
-       .init_flags             = xfrm4_init_flags,
        .output                 = xfrm4_output,
        .output_finish          = xfrm4_output_finish,
        .extract_input          = xfrm4_extract_input,
index 336d3f6a1a51fe44c92450d54aa1b30fc97a4367..5c13a8021d4c1c4d5ce8f3b937ad35823d0cf00b 100644 (file)
@@ -2263,25 +2263,14 @@ int xfrm_state_mtu(struct xfrm_state *x, int mtu)
 
 int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload)
 {
-       const struct xfrm_state_afinfo *afinfo;
        const struct xfrm_mode *inner_mode;
        const struct xfrm_mode *outer_mode;
        int family = x->props.family;
        int err;
 
-       err = -EAFNOSUPPORT;
-       afinfo = xfrm_state_get_afinfo(family);
-       if (!afinfo)
-               goto error;
-
-       err = 0;
-       if (afinfo->init_flags)
-               err = afinfo->init_flags(x);
-
-       rcu_read_unlock();
-
-       if (err)
-               goto error;
+       if (family == AF_INET &&
+           xs_net(x)->ipv4.sysctl_ip_no_pmtu_disc)
+               x->props.flags |= XFRM_STATE_NOPMTUDISC;
 
        err = -EPROTONOSUPPORT;