netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: netdev@vger.kernel.org
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH -next crap] net: icmp: work around bogus pmtu errors
Date: Sat, 11 Jul 2015 01:56:49 +0200	[thread overview]
Message-ID: <1436572609-2097-1-git-send-email-fw@strlen.de> (raw)

sometimes tcp connections seem to hang.
tcpdump shows broken path mtu reports.  This "fix" avoids hang and gives:

[633.327834] icmp: 192.0.0.2 reports mtu 1474 for packet size 1474 to host 204.236.132.12
[635.586945] icmp: 192.0.0.2 reports mtu 1474 for packet size 1474 to host 54.219.255.254
[647.106708] icmp: 192.0.0.2 reports mtu 1474 for packet size 1466 to host 204.236.132.12
[663.084586] icmp: 192.0.0.2 reports mtu 1474 for packet size 1466 to host 54.219.255.254

sigh.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 Might be caused by DS-LITE.  I either need the turd below or iptables TCPMSS
 mangling rules to artificially lower received mss.

 I don't mind if this is rejected; I'm mostly wondering if anyone
 else came across suprise like this.

diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 36f5584..1ab08dd 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -771,6 +771,8 @@ static bool icmp_unreach(struct sk_buff *skb)
 		goto out_err;
 
 	if (icmph->type == ICMP_DEST_UNREACH) {
+		u16 tot_len;
+
 		switch (icmph->code & 15) {
 		case ICMP_NET_UNREACH:
 		case ICMP_HOST_UNREACH:
@@ -795,6 +797,17 @@ static bool icmp_unreach(struct sk_buff *skb)
 				/* fall through */
 			case 0:
 				info = ntohs(icmph->un.frag.mtu);
+
+				tot_len = ntohs(iph->tot_len);
+
+				if (tot_len <= info) {
+					pr_warn_ratelimited("%pI4 reports mtu %d for packet"
+							    " size %d to host %pI4\n",
+							    &ip_hdr(skb)->saddr, info,
+							    tot_len, &iph->daddr);
+					if (tot_len >= (536 + 8))
+						info = tot_len - 8;
+				}
 			}
 			break;
 		case ICMP_SR_FAILED:
-- 
2.0.5

             reply	other threads:[~2015-07-11  8:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 23:56 Florian Westphal [this message]
2015-07-14 22:40 ` [PATCH -next crap] net: icmp: work around bogus pmtu errors David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436572609-2097-1-git-send-email-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).