xfrm: remove init_path indirection from afinfo_policy
authorFlorian Westphal <fw@strlen.de>
Tue, 16 Apr 2019 14:44:38 +0000 (16:44 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 23 Apr 2019 05:42:20 +0000 (07:42 +0200)
handle this directly, its only used by ipv6.

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

index 652da58617726a59e11199b26b865122d2e7725f..b8de1622141abc839dd6ab75b265957836babf05 100644 (file)
@@ -329,9 +329,6 @@ struct xfrm_policy_afinfo {
        void                    (*decode_session)(struct sk_buff *skb,
                                                  struct flowi *fl,
                                                  int reverse);
-       int                     (*init_path)(struct xfrm_dst *path,
-                                            struct dst_entry *dst,
-                                            int nfheader_len);
        int                     (*fill_dst)(struct xfrm_dst *xdst,
                                            struct net_device *dev,
                                            const struct flowi *fl);
index 244d26baa3afaaf75b93140a86f4f06fb85ac5eb..6e89378668aefa7239d58a0451a8e7f8bc7b170e 100644 (file)
@@ -69,12 +69,6 @@ static int xfrm4_get_saddr(struct net *net, int oif,
        return 0;
 }
 
-static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst,
-                          int nfheader_len)
-{
-       return 0;
-}
-
 static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
                          const struct flowi *fl)
 {
@@ -267,7 +261,6 @@ static const struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
        .dst_lookup =           xfrm4_dst_lookup,
        .get_saddr =            xfrm4_get_saddr,
        .decode_session =       _decode_session4,
-       .init_path =            xfrm4_init_path,
        .fill_dst =             xfrm4_fill_dst,
        .blackhole_route =      ipv4_blackhole_route,
 };
index 0e92fa2f96789b6f758c3b68d6ba96db74fde142..358e834fedced5e2ae80a9a36fd37d9f8cc09e68 100644 (file)
@@ -71,19 +71,6 @@ static int xfrm6_get_saddr(struct net *net, int oif,
        return 0;
 }
 
-static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst,
-                          int nfheader_len)
-{
-       if (dst->ops->family == AF_INET6) {
-               struct rt6_info *rt = (struct rt6_info *)dst;
-               path->path_cookie = rt6_get_cookie(rt);
-       }
-
-       path->u.rt6.rt6i_nfheader_len = nfheader_len;
-
-       return 0;
-}
-
 static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
                          const struct flowi *fl)
 {
@@ -287,7 +274,6 @@ static const struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
        .dst_lookup =           xfrm6_dst_lookup,
        .get_saddr =            xfrm6_get_saddr,
        .decode_session =       _decode_session6,
-       .init_path =            xfrm6_init_path,
        .fill_dst =             xfrm6_fill_dst,
        .blackhole_route =      ip6_blackhole_route,
 };
index 1d1335eab76c6adc367d121b130998c905267f18..5359c312f01693bdffc598f7a1a9c7f1fcb89a75 100644 (file)
@@ -2491,21 +2491,14 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
        return xdst;
 }
 
-static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
-                                int nfheader_len)
+static void xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
+                          int nfheader_len)
 {
-       const struct xfrm_policy_afinfo *afinfo =
-               xfrm_policy_get_afinfo(dst->ops->family);
-       int err;
-
-       if (!afinfo)
-               return -EINVAL;
-
-       err = afinfo->init_path(path, dst, nfheader_len);
-
-       rcu_read_unlock();
-
-       return err;
+       if (dst->ops->family == AF_INET6) {
+               struct rt6_info *rt = (struct rt6_info *)dst;
+               path->path_cookie = rt6_get_cookie(rt);
+               path->u.rt6.rt6i_nfheader_len = nfheader_len;
+       }
 }
 
 static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,