aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2012-10-07 18:47:25 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-08 14:46:34 -0400
commitd851c12b60471188e15e5c8405b289073e8dd025 (patch)
tree102698a4ae2ec89cb931f360cc9229474a6f1cbb /net/ipv4/route.c
parent594f88e96ebaf290e6509b37fff84b310ec1f155 (diff)
ipv4: Always invalidate or update the route on pmtu events
Some protocols, like IPsec still cache routes. So we need to invalidate the old route on pmtu events to avoid the reuse of stale routes. We also need to update the mtu and expire time of the route if we already use a nh exception route, otherwise we ignore newly learned pmtu values after the first expiration. With this patch we always invalidate or update the route on pmtu events. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index ff622069fcef..90ba8358a892 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -904,22 +904,29 @@ out: kfree_skb(skb);
904 return 0; 904 return 0;
905} 905}
906 906
907static u32 __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) 907static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
908{ 908{
909 struct dst_entry *dst = &rt->dst;
909 struct fib_result res; 910 struct fib_result res;
910 911
911 if (mtu < ip_rt_min_pmtu) 912 if (mtu < ip_rt_min_pmtu)
912 mtu = ip_rt_min_pmtu; 913 mtu = ip_rt_min_pmtu;
913 914
915 if (!rt->rt_pmtu) {
916 dst->obsolete = DST_OBSOLETE_KILL;
917 } else {
918 rt->rt_pmtu = mtu;
919 dst->expires = max(1UL, jiffies + ip_rt_mtu_expires);
920 }
921
914 rcu_read_lock(); 922 rcu_read_lock();
915 if (fib_lookup(dev_net(rt->dst.dev), fl4, &res) == 0) { 923 if (fib_lookup(dev_net(dst->dev), fl4, &res) == 0) {
916 struct fib_nh *nh = &FIB_RES_NH(res); 924 struct fib_nh *nh = &FIB_RES_NH(res);
917 925
918 update_or_create_fnhe(nh, fl4->daddr, 0, mtu, 926 update_or_create_fnhe(nh, fl4->daddr, 0, mtu,
919 jiffies + ip_rt_mtu_expires); 927 jiffies + ip_rt_mtu_expires);
920 } 928 }
921 rcu_read_unlock(); 929 rcu_read_unlock();
922 return mtu;
923} 930}
924 931
925static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, 932static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
@@ -929,14 +936,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
929 struct flowi4 fl4; 936 struct flowi4 fl4;
930 937
931 ip_rt_build_flow_key(&fl4, sk, skb); 938 ip_rt_build_flow_key(&fl4, sk, skb);
932 mtu = __ip_rt_update_pmtu(rt, &fl4, mtu); 939 __ip_rt_update_pmtu(rt, &fl4, mtu);
933
934 if (!rt->rt_pmtu) {
935 dst->obsolete = DST_OBSOLETE_KILL;
936 } else {
937 rt->rt_pmtu = mtu;
938 rt->dst.expires = max(1UL, jiffies + ip_rt_mtu_expires);
939 }
940} 940}
941 941
942void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, 942void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,