From patchwork Fri Nov 8 02:32:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 289661 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 ED0E62C00C4 for ; Fri, 8 Nov 2013 13:32:29 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932617Ab3KHCcU (ORCPT ); Thu, 7 Nov 2013 21:32:20 -0500 Received: from mail-pd0-f172.google.com ([209.85.192.172]:52794 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932391Ab3KHCcO (ORCPT ); Thu, 7 Nov 2013 21:32:14 -0500 Received: by mail-pd0-f172.google.com with SMTP id w10so1475012pde.31 for ; Thu, 07 Nov 2013 18:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:content-transfer-encoding:mime-version; bh=4JUE2L+SFYzxz4z540/SlekCKPPkS2nF8nR1T1RKA4c=; b=w8vnc5A9tzelimEfLuzFxIy6rhc/WQNBigboDYnim+a4Vf6gbtODFOS+6o8iiahI6L a18+gIfLZw0KxmIsfxQfrmyBUzfUDXJneOui410uGt3Qaqg66mmUDqmwimu1107ctLg8 EI12HRkTGnxYFpvQlUJvEPhGcutbckypXVtFxYQiiiExlywVvkp/igLQpjUKxUvzyt2e eDGP802Vg3V7tmADnoTwDi/MIaRub43qhHHs8X+mfkzJ5+lB8Jsk4pr16x2uxBEdjliH 049lXA3xYIiUuDbpu9kaWqImU4yjIrgdaruxGqQNsyCubIBr5qqn2a6HNag3QHxKw8dk 0LdQ== X-Received: by 10.66.249.134 with SMTP id yu6mr13040071pac.37.1383877933815; Thu, 07 Nov 2013 18:32:13 -0800 (PST) Received: from [172.26.55.63] ([172.26.55.63]) by mx.google.com with ESMTPSA id ef10sm10114229pac.1.2013.11.07.18.32.10 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Thu, 07 Nov 2013 18:32:13 -0800 (PST) Message-ID: <1383877926.9412.145.camel@edumazet-glaptop2.roam.corp.google.com> Subject: [PATCH v2 net-next] inet: fix a UFO regression From: Eric Dumazet To: Alexei Starovoitov Cc: David Miller , netdev@vger.kernel.org, Hannes Frederic Sowa Date: Thu, 07 Nov 2013 18:32:06 -0800 In-Reply-To: <1383871465.9412.118.camel@edumazet-glaptop2.roam.corp.google.com> References: <1382674000.7572.75.camel@edumazet-glaptop.roam.corp.google.com> <1382692140.7572.79.camel@edumazet-glaptop.roam.corp.google.com> <20131025.181809.348808013109842304.davem@davemloft.net> <1382923096.13037.10.camel@edumazet-glaptop.roam.corp.google.com> <1383863586.9412.101.camel@edumazet-glaptop2.roam.corp.google.com> <1383871465.9412.118.camel@edumazet-glaptop2.roam.corp.google.com> X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet While testing virtio_net and skb_segment() changes, Hannes reported that UFO was sending wrong frames. It appears this was introduced by a recent commit : 8c3a897bfab1 ("inet: restore gso for vxlan") The old condition to perform IP frag was : tunnel = !!skb->encapsulation; ... if (!tunnel && proto == IPPROTO_UDP) { So the new one should be : udpfrag = !skb->encapsulation && proto == IPPROTO_UDP; ... if (udpfrag) { Initialization of udpfrag must be done before call to ops->callbacks.gso_segment(skb, features), as skb_udp_tunnel_segment() clears skb->encapsulation (We want udpfrag to be true for UFO, false for VXLAN) With help from Alexei Starovoitov Reported-by: Hannes Frederic Sowa Signed-off-by: Eric Dumazet Cc: Alexei Starovoitov --- v2: move the udpfrag init, as spotted by Alexei. net/ipv4/af_inet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 09d78d4a3cff..68af9aac91d0 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1299,6 +1299,9 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, segs = ERR_PTR(-EPROTONOSUPPORT); + /* Note : following gso_segment() might change skb->encapsulation */ + udpfrag = !skb->encapsulation && proto == IPPROTO_UDP; + ops = rcu_dereference(inet_offloads[proto]); if (likely(ops && ops->callbacks.gso_segment)) segs = ops->callbacks.gso_segment(skb, features); @@ -1306,7 +1309,6 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, if (IS_ERR_OR_NULL(segs)) goto out; - udpfrag = !!skb->encapsulation && proto == IPPROTO_UDP; skb = segs; do { iph = (struct iphdr *)(skb_mac_header(skb) + nhoff);