From patchwork Mon Jul 6 08:35:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 491494 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9A10A1409F8 for ; Mon, 6 Jul 2015 18:36:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=BVSysBa6; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752982AbbGFIgF (ORCPT ); Mon, 6 Jul 2015 04:36:05 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:34077 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbbGFIgC (ORCPT ); Mon, 6 Jul 2015 04:36:02 -0400 Received: by lagx9 with SMTP id x9so145477108lag.1 for ; Mon, 06 Jul 2015 01:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=2hMQATnHONPVqxGOWuJbna3VUZXxtx2kTf5lBP0F/Qc=; b=BVSysBa67gYosUr2rtNLF16s4kpiu0Fthsw6Cw+XE7L87YoZz/72YdzMj6/5vCFlr0 WZGC/zXRHc5g76/agxjjxoLLnlSbim3gFkO1pHKlBZWYhFTJ24oQ0U/QS+Crenz1tlDz PWyHy66fXaxVs/fbw+1hqEO4UCtwMFsKGPUYrWJr7kvD+6PkhC5LpzcZaIKovibIzuZB AR1ENnJEjoj+V+iz3ZXWFliUJSlxplDMfPLNsuIyvcd5IvkdL90WMZHWNKKHmBVbaX7t ScBV1ZlTrwGPQGLZwycaPzKhUeQinymXf/KhdK4d3/qiHhcjizSYNZEjfONOSQC49N92 WQOQ== X-Received: by 10.112.189.1 with SMTP id ge1mr48107809lbc.10.1436171761594; Mon, 06 Jul 2015 01:36:01 -0700 (PDT) Received: from vostro.util.wtbts.net ([83.145.235.199]) by mx.google.com with ESMTPSA id t1sm4520266lbb.25.2015.07.06.01.36.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jul 2015 01:36:00 -0700 (PDT) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= , Pravin B Shelar Subject: [PATCH] ip_tunnel: fix ipv4 pmtu check to honor inner ip header df Date: Mon, 6 Jul 2015 11:35:50 +0300 Message-Id: <1436171750-6029-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 2.4.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Frag needed should be sent only if the inner header asked to not fragment. Currently fragmentation is broken if the tunnel has df set. The tunnel's df needs to be still checked to update internally the pmtu cache. This got broken in commit 23a3647bc4f93bac and this fixes the pmtu check back to the way it was. Fixes: 23a3647bc4f93bac ("ip_tunnels: Use skb-len to PMTU check.") Cc: Pravin B Shelar --- Should go to -stable queues (3.12.y and never). net/ipv4/ip_tunnel.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 0bb8e14..6822572 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -587,7 +587,8 @@ int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, EXPORT_SYMBOL(ip_tunnel_encap); static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, - struct rtable *rt, __be16 df) + struct rtable *rt, __be16 df, + const struct iphdr *inner_iph) { struct ip_tunnel *tunnel = netdev_priv(dev); int pkt_size = skb->len - tunnel->hlen - dev->hard_header_len; @@ -604,7 +605,8 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, if (skb->protocol == htons(ETH_P_IP)) { if (!skb_is_gso(skb) && - (df & htons(IP_DF)) && mtu < pkt_size) { + (inner_iph->frag_off & htons(IP_DF)) && + mtu < pkt_size) { memset(IPCB(skb), 0, sizeof(*IPCB(skb))); icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); return -E2BIG; @@ -738,7 +740,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, goto tx_error; } - if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off)) { + if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off, inner_iph)) { ip_rt_put(rt); goto tx_error; }