aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gartrell <agartrell@fb.com>2014-09-09 19:40:26 -0400
committerSimon Horman <horms@verge.net.au>2014-09-15 20:03:36 -0400
commit919aa0b2bbcf013467295dc9736db6fb575a4fb0 (patch)
treea02c65d49e572c4971c33255f5ed7066b6e88358
parent4a4739d56b006c4b34dfba03c356056e110521ca (diff)
ipvs: Pull out update_pmtu code
Another step toward heterogeneous pools, this removes another piece of functionality currently specific to each address family type. Signed-off-by: Alex Gartrell <agartrell@fb.com> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--net/netfilter/ipvs/ip_vs_xmit.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index b3b54d7a6c17..034a282a6f8c 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -204,6 +204,15 @@ static inline bool crosses_local_route_boundary(int skb_af, struct sk_buff *skb,
204 return false; 204 return false;
205} 205}
206 206
207static inline void maybe_update_pmtu(int skb_af, struct sk_buff *skb, int mtu)
208{
209 struct sock *sk = skb->sk;
210 struct rtable *ort = skb_rtable(skb);
211
212 if (!skb->dev && sk && sk->sk_state != TCP_TIME_WAIT)
213 ort->dst.ops->update_pmtu(&ort->dst, sk, NULL, mtu);
214}
215
207/* Get route to destination or remote server */ 216/* Get route to destination or remote server */
208static int 217static int
209__ip_vs_get_out_rt(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest, 218__ip_vs_get_out_rt(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest,
@@ -213,7 +222,6 @@ __ip_vs_get_out_rt(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest,
213 struct netns_ipvs *ipvs = net_ipvs(net); 222 struct netns_ipvs *ipvs = net_ipvs(net);
214 struct ip_vs_dest_dst *dest_dst; 223 struct ip_vs_dest_dst *dest_dst;
215 struct rtable *rt; /* Route to the other host */ 224 struct rtable *rt; /* Route to the other host */
216 struct rtable *ort; /* Original route */
217 struct iphdr *iph; 225 struct iphdr *iph;
218 __be16 df; 226 __be16 df;
219 int mtu; 227 int mtu;
@@ -284,16 +292,12 @@ __ip_vs_get_out_rt(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest,
284 mtu = dst_mtu(&rt->dst); 292 mtu = dst_mtu(&rt->dst);
285 df = iph->frag_off & htons(IP_DF); 293 df = iph->frag_off & htons(IP_DF);
286 } else { 294 } else {
287 struct sock *sk = skb->sk;
288
289 mtu = dst_mtu(&rt->dst) - sizeof(struct iphdr); 295 mtu = dst_mtu(&rt->dst) - sizeof(struct iphdr);
290 if (mtu < 68) { 296 if (mtu < 68) {
291 IP_VS_DBG_RL("%s(): mtu less than 68\n", __func__); 297 IP_VS_DBG_RL("%s(): mtu less than 68\n", __func__);
292 goto err_put; 298 goto err_put;
293 } 299 }
294 ort = skb_rtable(skb); 300 maybe_update_pmtu(skb_af, skb, mtu);
295 if (!skb->dev && sk && sk->sk_state != TCP_TIME_WAIT)
296 ort->dst.ops->update_pmtu(&ort->dst, sk, NULL, mtu);
297 /* MTU check allowed? */ 301 /* MTU check allowed? */
298 df = sysctl_pmtu_disc(ipvs) ? iph->frag_off & htons(IP_DF) : 0; 302 df = sysctl_pmtu_disc(ipvs) ? iph->frag_off & htons(IP_DF) : 0;
299 } 303 }
@@ -372,7 +376,6 @@ __ip_vs_get_out_rt_v6(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest,
372 struct net *net = dev_net(skb_dst(skb)->dev); 376 struct net *net = dev_net(skb_dst(skb)->dev);
373 struct ip_vs_dest_dst *dest_dst; 377 struct ip_vs_dest_dst *dest_dst;
374 struct rt6_info *rt; /* Route to the other host */ 378 struct rt6_info *rt; /* Route to the other host */
375 struct rt6_info *ort; /* Original route */
376 struct dst_entry *dst; 379 struct dst_entry *dst;
377 int mtu; 380 int mtu;
378 int local, noref = 1; 381 int local, noref = 1;
@@ -438,17 +441,13 @@ __ip_vs_get_out_rt_v6(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest,
438 if (likely(!(rt_mode & IP_VS_RT_MODE_TUNNEL))) 441 if (likely(!(rt_mode & IP_VS_RT_MODE_TUNNEL)))
439 mtu = dst_mtu(&rt->dst); 442 mtu = dst_mtu(&rt->dst);
440 else { 443 else {
441 struct sock *sk = skb->sk;
442
443 mtu = dst_mtu(&rt->dst) - sizeof(struct ipv6hdr); 444 mtu = dst_mtu(&rt->dst) - sizeof(struct ipv6hdr);
444 if (mtu < IPV6_MIN_MTU) { 445 if (mtu < IPV6_MIN_MTU) {
445 IP_VS_DBG_RL("%s(): mtu less than %d\n", __func__, 446 IP_VS_DBG_RL("%s(): mtu less than %d\n", __func__,
446 IPV6_MIN_MTU); 447 IPV6_MIN_MTU);
447 goto err_put; 448 goto err_put;
448 } 449 }
449 ort = (struct rt6_info *) skb_dst(skb); 450 maybe_update_pmtu(skb_af, skb, mtu);
450 if (!skb->dev && sk && sk->sk_state != TCP_TIME_WAIT)
451 ort->dst.ops->update_pmtu(&ort->dst, sk, NULL, mtu);
452 } 451 }
453 452
454 if (unlikely(__mtu_check_toobig_v6(skb, mtu))) { 453 if (unlikely(__mtu_check_toobig_v6(skb, mtu))) {