summaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorHiroaki SHIMODA <shimoda.hiroaki@gmail.com>2011-03-09 20:09:58 +0000
committerDavid S. Miller <davem@davemloft.net>2011-03-13 18:37:49 -0700
commit46af31800b6916c92fffa529dc3c357008da957d (patch)
tree2c66ee7b78527da504a294f1bd8a2a899623fead /net/ipv4/route.c
parentbef55aebd560c5a6f8883c421abccee39978c58c (diff)
downloadlinux-46af31800b6916c92fffa529dc3c357008da957d.tar.gz
linux-46af31800b6916c92fffa529dc3c357008da957d.tar.bz2
linux-46af31800b6916c92fffa529dc3c357008da957d.zip
ipv4: Fix PMTU update.
On current net-next-2.6, when Linux receives ICMP Type: 3, Code: 4 (Destination unreachable (Fragmentation needed)), icmp_unreach -> ip_rt_frag_needed (peer->pmtu_expires is set here) -> tcp_v4_err -> do_pmtu_discovery -> ip_rt_update_pmtu (peer->pmtu_expires is already set, so check_peer_pmtu is skipped.) -> check_peer_pmtu check_peer_pmtu is skipped and MTU is not updated. To fix this, let check_peer_pmtu execute unconditionally. And some minor fixes 1) Avoid potential peer->pmtu_expires set to be zero. 2) In check_peer_pmtu, argument of time_before is reversed. 3) check_peer_pmtu expects peer->pmtu_orig is initialized as zero, but not initialized. Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.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, 17 insertions, 5 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 5655095a89e0..209989cf7d1b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1533,9 +1533,15 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
if (mtu < ip_rt_min_pmtu)
mtu = ip_rt_min_pmtu;
if (!peer->pmtu_expires || mtu < peer->pmtu_learned) {
+ unsigned long pmtu_expires;
+
+ pmtu_expires = jiffies + ip_rt_mtu_expires;
+ if (!pmtu_expires)
+ pmtu_expires = 1UL;
+
est_mtu = mtu;
peer->pmtu_learned = mtu;
- peer->pmtu_expires = jiffies + ip_rt_mtu_expires;
+ peer->pmtu_expires = pmtu_expires;
}
inet_putpeer(peer);
@@ -1549,7 +1555,7 @@ static void check_peer_pmtu(struct dst_entry *dst, struct inet_peer *peer)
{
unsigned long expires = peer->pmtu_expires;
- if (time_before(expires, jiffies)) {
+ if (time_before(jiffies, expires)) {
u32 orig_dst_mtu = dst_mtu(dst);
if (peer->pmtu_learned < orig_dst_mtu) {
if (!peer->pmtu_orig)
@@ -1574,14 +1580,20 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
if (mtu < ip_rt_min_pmtu)
mtu = ip_rt_min_pmtu;
if (!peer->pmtu_expires || mtu < peer->pmtu_learned) {
+ unsigned long pmtu_expires;
+
+ pmtu_expires = jiffies + ip_rt_mtu_expires;
+ if (!pmtu_expires)
+ pmtu_expires = 1UL;
+
peer->pmtu_learned = mtu;
- peer->pmtu_expires = jiffies + ip_rt_mtu_expires;
+ peer->pmtu_expires = pmtu_expires;
atomic_inc(&__rt_peer_genid);
rt->rt_peer_genid = rt_peer_genid();
-
- check_peer_pmtu(dst, peer);
}
+ check_peer_pmtu(dst, peer);
+
inet_putpeer(peer);
}
}