diff options
author | Florian Westphal <fw@strlen.de> | 2019-04-16 10:44:38 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2019-04-23 01:42:20 -0400 |
commit | 2e8b4aa816eaaf480fe68b1086614259caf1bf3c (patch) | |
tree | 2added5a80a6525ee78f7c631839b15fdebf55af | |
parent | f24ea52873c726bf7b54318f00ec45050222b367 (diff) |
xfrm: remove init_path indirection from afinfo_policy
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>
-rw-r--r-- | include/net/xfrm.h | 3 | ||||
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 7 | ||||
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 14 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 21 |
4 files changed, 7 insertions, 38 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 652da5861772..b8de1622141a 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -329,9 +329,6 @@ struct xfrm_policy_afinfo { | |||
329 | void (*decode_session)(struct sk_buff *skb, | 329 | void (*decode_session)(struct sk_buff *skb, |
330 | struct flowi *fl, | 330 | struct flowi *fl, |
331 | int reverse); | 331 | int reverse); |
332 | int (*init_path)(struct xfrm_dst *path, | ||
333 | struct dst_entry *dst, | ||
334 | int nfheader_len); | ||
335 | int (*fill_dst)(struct xfrm_dst *xdst, | 332 | int (*fill_dst)(struct xfrm_dst *xdst, |
336 | struct net_device *dev, | 333 | struct net_device *dev, |
337 | const struct flowi *fl); | 334 | const struct flowi *fl); |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 244d26baa3af..6e89378668ae 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -69,12 +69,6 @@ static int xfrm4_get_saddr(struct net *net, int oif, | |||
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | 71 | ||
72 | static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst, | ||
73 | int nfheader_len) | ||
74 | { | ||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | 72 | static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, |
79 | const struct flowi *fl) | 73 | const struct flowi *fl) |
80 | { | 74 | { |
@@ -267,7 +261,6 @@ static const struct xfrm_policy_afinfo xfrm4_policy_afinfo = { | |||
267 | .dst_lookup = xfrm4_dst_lookup, | 261 | .dst_lookup = xfrm4_dst_lookup, |
268 | .get_saddr = xfrm4_get_saddr, | 262 | .get_saddr = xfrm4_get_saddr, |
269 | .decode_session = _decode_session4, | 263 | .decode_session = _decode_session4, |
270 | .init_path = xfrm4_init_path, | ||
271 | .fill_dst = xfrm4_fill_dst, | 264 | .fill_dst = xfrm4_fill_dst, |
272 | .blackhole_route = ipv4_blackhole_route, | 265 | .blackhole_route = ipv4_blackhole_route, |
273 | }; | 266 | }; |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 0e92fa2f9678..358e834fedce 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -71,19 +71,6 @@ static int xfrm6_get_saddr(struct net *net, int oif, | |||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst, | ||
75 | int nfheader_len) | ||
76 | { | ||
77 | if (dst->ops->family == AF_INET6) { | ||
78 | struct rt6_info *rt = (struct rt6_info *)dst; | ||
79 | path->path_cookie = rt6_get_cookie(rt); | ||
80 | } | ||
81 | |||
82 | path->u.rt6.rt6i_nfheader_len = nfheader_len; | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | 74 | static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, |
88 | const struct flowi *fl) | 75 | const struct flowi *fl) |
89 | { | 76 | { |
@@ -287,7 +274,6 @@ static const struct xfrm_policy_afinfo xfrm6_policy_afinfo = { | |||
287 | .dst_lookup = xfrm6_dst_lookup, | 274 | .dst_lookup = xfrm6_dst_lookup, |
288 | .get_saddr = xfrm6_get_saddr, | 275 | .get_saddr = xfrm6_get_saddr, |
289 | .decode_session = _decode_session6, | 276 | .decode_session = _decode_session6, |
290 | .init_path = xfrm6_init_path, | ||
291 | .fill_dst = xfrm6_fill_dst, | 277 | .fill_dst = xfrm6_fill_dst, |
292 | .blackhole_route = ip6_blackhole_route, | 278 | .blackhole_route = ip6_blackhole_route, |
293 | }; | 279 | }; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 1d1335eab76c..5359c312f016 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2491,21 +2491,14 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family) | |||
2491 | return xdst; | 2491 | return xdst; |
2492 | } | 2492 | } |
2493 | 2493 | ||
2494 | static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst, | 2494 | static void xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst, |
2495 | int nfheader_len) | 2495 | int nfheader_len) |
2496 | { | 2496 | { |
2497 | const struct xfrm_policy_afinfo *afinfo = | 2497 | if (dst->ops->family == AF_INET6) { |
2498 | xfrm_policy_get_afinfo(dst->ops->family); | 2498 | struct rt6_info *rt = (struct rt6_info *)dst; |
2499 | int err; | 2499 | path->path_cookie = rt6_get_cookie(rt); |
2500 | 2500 | path->u.rt6.rt6i_nfheader_len = nfheader_len; | |
2501 | if (!afinfo) | 2501 | } |
2502 | return -EINVAL; | ||
2503 | |||
2504 | err = afinfo->init_path(path, dst, nfheader_len); | ||
2505 | |||
2506 | rcu_read_unlock(); | ||
2507 | |||
2508 | return err; | ||
2509 | } | 2502 | } |
2510 | 2503 | ||
2511 | static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | 2504 | static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, |