diff options
author | Florian Westphal <fw@strlen.de> | 2019-05-03 11:46:16 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2019-06-05 07:16:30 -0400 |
commit | e46817472a1d7da32e8f265f9469a4e2fa39c60f (patch) | |
tree | 4d3d3886dbdda51b267cdd3c904af7153a166c20 | |
parent | 5c1b9ab3ec81992bef9a8605b8b281b41577b475 (diff) |
xfrm: remove init_flags indirection from xfrm_state_afinfo
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>
-rw-r--r-- | include/net/xfrm.h | 1 | ||||
-rw-r--r-- | net/ipv4/xfrm4_state.c | 8 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 17 |
3 files changed, 3 insertions, 23 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index e8f676ce27be..61214f5c3205 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -353,7 +353,6 @@ struct xfrm_state_afinfo { | |||
353 | const struct xfrm_type *type_map[IPPROTO_MAX]; | 353 | const struct xfrm_type *type_map[IPPROTO_MAX]; |
354 | const struct xfrm_type_offload *type_offload_map[IPPROTO_MAX]; | 354 | const struct xfrm_type_offload *type_offload_map[IPPROTO_MAX]; |
355 | 355 | ||
356 | int (*init_flags)(struct xfrm_state *x); | ||
357 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | 356 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
358 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | 357 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
359 | int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb); | 358 | int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb); |
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c index 018448e222af..62c96da38b4e 100644 --- a/net/ipv4/xfrm4_state.c +++ b/net/ipv4/xfrm4_state.c | |||
@@ -15,13 +15,6 @@ | |||
15 | #include <linux/netfilter_ipv4.h> | 15 | #include <linux/netfilter_ipv4.h> |
16 | #include <linux/export.h> | 16 | #include <linux/export.h> |
17 | 17 | ||
18 | static int xfrm4_init_flags(struct xfrm_state *x) | ||
19 | { | ||
20 | if (xs_net(x)->ipv4.sysctl_ip_no_pmtu_disc) | ||
21 | x->props.flags |= XFRM_STATE_NOPMTUDISC; | ||
22 | return 0; | ||
23 | } | ||
24 | |||
25 | int xfrm4_extract_header(struct sk_buff *skb) | 18 | int xfrm4_extract_header(struct sk_buff *skb) |
26 | { | 19 | { |
27 | const struct iphdr *iph = ip_hdr(skb); | 20 | const struct iphdr *iph = ip_hdr(skb); |
@@ -43,7 +36,6 @@ static struct xfrm_state_afinfo xfrm4_state_afinfo = { | |||
43 | .proto = IPPROTO_IPIP, | 36 | .proto = IPPROTO_IPIP, |
44 | .eth_proto = htons(ETH_P_IP), | 37 | .eth_proto = htons(ETH_P_IP), |
45 | .owner = THIS_MODULE, | 38 | .owner = THIS_MODULE, |
46 | .init_flags = xfrm4_init_flags, | ||
47 | .output = xfrm4_output, | 39 | .output = xfrm4_output, |
48 | .output_finish = xfrm4_output_finish, | 40 | .output_finish = xfrm4_output_finish, |
49 | .extract_input = xfrm4_extract_input, | 41 | .extract_input = xfrm4_extract_input, |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 336d3f6a1a51..5c13a8021d4c 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -2263,25 +2263,14 @@ int xfrm_state_mtu(struct xfrm_state *x, int mtu) | |||
2263 | 2263 | ||
2264 | int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload) | 2264 | int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload) |
2265 | { | 2265 | { |
2266 | const struct xfrm_state_afinfo *afinfo; | ||
2267 | const struct xfrm_mode *inner_mode; | 2266 | const struct xfrm_mode *inner_mode; |
2268 | const struct xfrm_mode *outer_mode; | 2267 | const struct xfrm_mode *outer_mode; |
2269 | int family = x->props.family; | 2268 | int family = x->props.family; |
2270 | int err; | 2269 | int err; |
2271 | 2270 | ||
2272 | err = -EAFNOSUPPORT; | 2271 | if (family == AF_INET && |
2273 | afinfo = xfrm_state_get_afinfo(family); | 2272 | xs_net(x)->ipv4.sysctl_ip_no_pmtu_disc) |
2274 | if (!afinfo) | 2273 | x->props.flags |= XFRM_STATE_NOPMTUDISC; |
2275 | goto error; | ||
2276 | |||
2277 | err = 0; | ||
2278 | if (afinfo->init_flags) | ||
2279 | err = afinfo->init_flags(x); | ||
2280 | |||
2281 | rcu_read_unlock(); | ||
2282 | |||
2283 | if (err) | ||
2284 | goto error; | ||
2285 | 2274 | ||
2286 | err = -EPROTONOSUPPORT; | 2275 | err = -EPROTONOSUPPORT; |
2287 | 2276 | ||