Skip to content

Commit 2e8b4aa

Browse files
Florian Westphalklassert
authored andcommitted
xfrm: remove init_path indirection from afinfo_policy
handle this directly, its only used by ipv6. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent f24ea52 commit 2e8b4aa

File tree

4 files changed

+7
-38
lines changed

4 files changed

+7
-38
lines changed

include/net/xfrm.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,6 @@ struct xfrm_policy_afinfo {
329329
void (*decode_session)(struct sk_buff *skb,
330330
struct flowi *fl,
331331
int reverse);
332-
int (*init_path)(struct xfrm_dst *path,
333-
struct dst_entry *dst,
334-
int nfheader_len);
335332
int (*fill_dst)(struct xfrm_dst *xdst,
336333
struct net_device *dev,
337334
const struct flowi *fl);

net/ipv4/xfrm4_policy.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ static int xfrm4_get_saddr(struct net *net, int oif,
6969
return 0;
7070
}
7171

72-
static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst,
73-
int nfheader_len)
74-
{
75-
return 0;
76-
}
77-
7872
static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
7973
const struct flowi *fl)
8074
{
@@ -267,7 +261,6 @@ static const struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
267261
.dst_lookup = xfrm4_dst_lookup,
268262
.get_saddr = xfrm4_get_saddr,
269263
.decode_session = _decode_session4,
270-
.init_path = xfrm4_init_path,
271264
.fill_dst = xfrm4_fill_dst,
272265
.blackhole_route = ipv4_blackhole_route,
273266
};

net/ipv6/xfrm6_policy.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,6 @@ static int xfrm6_get_saddr(struct net *net, int oif,
7171
return 0;
7272
}
7373

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-
8774
static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
8875
const struct flowi *fl)
8976
{
@@ -287,7 +274,6 @@ static const struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
287274
.dst_lookup = xfrm6_dst_lookup,
288275
.get_saddr = xfrm6_get_saddr,
289276
.decode_session = _decode_session6,
290-
.init_path = xfrm6_init_path,
291277
.fill_dst = xfrm6_fill_dst,
292278
.blackhole_route = ip6_blackhole_route,
293279
};

net/xfrm/xfrm_policy.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,21 +2491,14 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
24912491
return xdst;
24922492
}
24932493

2494-
static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
2495-
int nfheader_len)
2494+
static void xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
2495+
int nfheader_len)
24962496
{
2497-
const struct xfrm_policy_afinfo *afinfo =
2498-
xfrm_policy_get_afinfo(dst->ops->family);
2499-
int err;
2500-
2501-
if (!afinfo)
2502-
return -EINVAL;
2503-
2504-
err = afinfo->init_path(path, dst, nfheader_len);
2505-
2506-
rcu_read_unlock();
2507-
2508-
return err;
2497+
if (dst->ops->family == AF_INET6) {
2498+
struct rt6_info *rt = (struct rt6_info *)dst;
2499+
path->path_cookie = rt6_get_cookie(rt);
2500+
path->u.rt6.rt6i_nfheader_len = nfheader_len;
2501+
}
25092502
}
25102503

25112504
static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,

0 commit comments

Comments
 (0)