Fix for broken pmtu recovery in 2.1.36

kdp0101@hpmail.lrz-muenchen.de
Sat, 26 Apr 1997 14:15:55 METDST


Here is a fix to make PMTU recovery work again in the 2.1 kernels. The
tests in ip_output.c were obviously reversed. PMTU did work when you
set /proc/sys/net/ipv4/ip_no_pmtu_disc to 1 8) Not the expected behaviour..

Here is a patch to fix this. It is not extensively tested because I have
no easy access to connections with a smaller pmtu than my ethernet interfaces
but at least the DF bits are set correctly again.

--- linux/net/ipv4/ip_output.c-o Sat Apr 26 13:51:51 1997
+++ linux/net/ipv4/ip_output.c Sat Apr 26 14:03:27 1997
@@ -27,6 +27,8 @@
* (in case if packet not accepted by
* output firewall rules)
* Alexey Kuznetsov: use new route cache
+ * Andi Kleen: Fix broken PMTU recovery and remove
+ * some redundant tests.
*/

#include <asm/uaccess.h>
@@ -126,9 +128,8 @@
iph->ihl = 5;
iph->tos = sk->ip_tos;
iph->frag_off = 0;
- if (sk->ip_pmtudisc == IP_PMTUDISC_DONT ||
- (sk->ip_pmtudisc == IP_PMTUDISC_WANT &&
- rt->rt_flags&RTF_NOPMTUDISC))
+ if (sk->ip_pmtudisc == IP_PMTUDISC_WANT &&
+ !(rt->rt_flags & RTF_NOPMTUDISC))
iph->frag_off |= htons(IP_DF);
iph->ttl = sk->ip_ttl;
iph->daddr = rt->rt_dst;
@@ -207,9 +208,8 @@
iph->ihl = 5;
iph->tos = sk->ip_tos;
iph->frag_off = 0;
- if (sk->ip_pmtudisc == IP_PMTUDISC_DONT ||
- (sk->ip_pmtudisc == IP_PMTUDISC_WANT &&
- rt->rt_flags&RTF_NOPMTUDISC))
+ if (sk->ip_pmtudisc == IP_PMTUDISC_WANT &&
+ !(rt->rt_flags & RTF_NOPMTUDISC))
iph->frag_off |= htons(IP_DF);
iph->ttl = sk->ip_ttl;
iph->daddr = rt->rt_dst;
@@ -480,8 +480,7 @@
#endif

if (sk->ip_pmtudisc == IP_PMTUDISC_DONT ||
- (sk->ip_pmtudisc == IP_PMTUDISC_WANT &&
- rt->rt_flags&RTF_NOPMTUDISC))
+ rt->rt_flags&RTF_NOPMTUDISC)
df = 0;


-Andi