{"id":814043,"url":"http://patchwork.ozlabs.org/api/1.2/patches/814043/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/4337e23831098961437503efa2c9d7adfce96b81.1505448007.git.lucien.xin@gmail.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<4337e23831098961437503efa2c9d7adfce96b81.1505448007.git.lucien.xin@gmail.com>","list_archive_url":null,"date":"2017-09-15T04:00:07","name":"[net] ip6_gre: skb_push ipv6hdr before packing the header in ip6gre_header","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"6962b811131df591c3d5f6cf90f3e26ad2f22d25","submitter":{"id":61073,"url":"http://patchwork.ozlabs.org/api/1.2/people/61073/?format=json","name":"Xin Long","email":"lucien.xin@gmail.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/4337e23831098961437503efa2c9d7adfce96b81.1505448007.git.lucien.xin@gmail.com/mbox/","series":[{"id":3205,"url":"http://patchwork.ozlabs.org/api/1.2/series/3205/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=3205","date":"2017-09-15T04:00:07","name":"[net] ip6_gre: skb_push ipv6hdr before packing the header in ip6gre_header","version":1,"mbox":"http://patchwork.ozlabs.org/series/3205/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814043/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814043/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"OOmL5ZuA\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xthWS4Jf8z9t2Z\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 15 Sep 2017 14:00:20 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750797AbdIOEAR (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 15 Sep 2017 00:00:17 -0400","from mail-pf0-f194.google.com ([209.85.192.194]:36759 \"EHLO\n\tmail-pf0-f194.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750708AbdIOEAP (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 15 Sep 2017 00:00:15 -0400","by mail-pf0-f194.google.com with SMTP id f84so636416pfj.3\n\tfor <netdev@vger.kernel.org>; Thu, 14 Sep 2017 21:00:15 -0700 (PDT)","from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id\n\tx8sm29094947pff.104.2017.09.14.21.00.14\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Sep 2017 21:00:14 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=qFDolY+aJ/KFn6aZ/NkNBTtOCjb+gbfMUutjD1/k4OU=;\n\tb=OOmL5ZuAXasPyYDJ5Qnza/bUMHnOZkXT2WFMNmHJEXOZF8t8ZetRDk0Xa8jFHEzGeJ\n\t3kGPH/kVafopI+083VOXTLi/2kQlQPQ2vpytwvN/Kr4ewspJxA3AnLaRm+QEHZEGMFlQ\n\t1LeRdItbfFDfxQUQqr1tb/bysUa8c+35PbVsxaXHp/6cbr+6IA805aL99utpDsrtQYYz\n\tXbR+cZI9eUiPwCseykGlRnY7WWyf25voaTd73YD8v6Zq5qRDE35VeusDN5IwPTefZTe7\n\t2J1PciCGWYUL3WgygXFxaU1UtxLHMiVHtrMFD7ux66QqWkFk2H4vXFmCyLOKAwi4AbSV\n\tkkKw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=qFDolY+aJ/KFn6aZ/NkNBTtOCjb+gbfMUutjD1/k4OU=;\n\tb=FB0l3eWgU6JjhPwlHIWPPE9uz/vsUCC2pOznOV7cRU8oZchGove9Lci1xX7nF6XGb9\n\t1PdcNdPau7prmW+lzaLvrZbFhNSHspAEHtyw74Oo878nhHQTmipNHvVuNW6JBP7uTs2r\n\tXcSvsA7kimLesxbs94hzueDOWe667/DIavey72ffRghHaFoukgPuqnmHUM3a5TCUaxzL\n\tO4Qbkdfo1of0yzda66qOWqxr5Xj0v//Sdrvl8tkqaDcCxwvTMvogJbTB+PWJTiZuMFII\n\tIEgjnip/ihrExqr8o+yHxC4K3u9o6WkohN/BH8Asftl+63laGFmd6wbhHiqOBxr6oidl\n\tVRAA==","X-Gm-Message-State":"AHPjjUgKCE6iyZWODr8MTBqnTCjP32KvpdhYyHq/jScrT5QLLA7I8/WS\n\tIfLr9lXgiSJ6LizAbrY=","X-Google-Smtp-Source":"ADKCNb7H2h3oBVUZZCYWdKwIlwOXi0nLXGYu0QcDfovR6I9NcroSig2HFr/iIHR6CI9y8fXblxLwrg==","X-Received":"by 10.98.18.215 with SMTP id 84mr23297111pfs.42.1505448015269;\n\tThu, 14 Sep 2017 21:00:15 -0700 (PDT)","From":"Xin Long <lucien.xin@gmail.com>","To":"network dev <netdev@vger.kernel.org>","Cc":"davem@davemloft.net, Dmitry Kozlov <xeb@mail.ru>","Subject":"[PATCH net] ip6_gre: skb_push ipv6hdr before packing the header in\n\tip6gre_header","Date":"Fri, 15 Sep 2017 12:00:07 +0800","Message-Id":"<4337e23831098961437503efa2c9d7adfce96b81.1505448007.git.lucien.xin@gmail.com>","X-Mailer":"git-send-email 2.1.0","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Now in ip6gre_header before packing the ipv6 header, it skb_push t->hlen\nwhich only includes encap_hlen + tun_hlen. It means greh and inner header\nwould be over written by ipv6 stuff and ipv6h might have no chance to set\nup.\n\nJianlin found this issue when using remote any on ip6_gre, the packets he\ncaptured on gre dev are truncated:\n\n22:50:26.210866 Out ethertype IPv6 (0x86dd), length 120: truncated-ip6 -\\\n8128 bytes missing!(flowlabel 0x92f40, hlim 0, next-header Options (0)  \\\npayload length: 8192) ::1:2000:0 > ::1:0:86dd: HBH [trunc] ip-proto-128 \\\n8184\n\nIt should also skb_push ipv6hdr so that ipv6h points to the right position\nto set ipv6 stuff up.\n\nThis patch is to skb_push hlen + sizeof(*ipv6h) and also fix some indents\nin ip6gre_header.\n\nFixes: c12b395a4664 (\"gre: Support GRE over IPv6\")\nReported-by: Jianlin Shi <jishi@redhat.com>\nSigned-off-by: Xin Long <lucien.xin@gmail.com>\n---\n net/ipv6/ip6_gre.c | 21 +++++++++++----------\n 1 file changed, 11 insertions(+), 10 deletions(-)","diff":"diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c\nindex b7a72d4..20f66f4 100644\n--- a/net/ipv6/ip6_gre.c\n+++ b/net/ipv6/ip6_gre.c\n@@ -940,24 +940,25 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,\n }\n \n static int ip6gre_header(struct sk_buff *skb, struct net_device *dev,\n-\t\t\tunsigned short type,\n-\t\t\tconst void *daddr, const void *saddr, unsigned int len)\n+\t\t\t unsigned short type, const void *daddr,\n+\t\t\t const void *saddr, unsigned int len)\n {\n \tstruct ip6_tnl *t = netdev_priv(dev);\n-\tstruct ipv6hdr *ipv6h = skb_push(skb, t->hlen);\n-\t__be16 *p = (__be16 *)(ipv6h+1);\n+\tstruct ipv6hdr *ipv6h;\n+\t__be16 *p;\n \n-\tip6_flow_hdr(ipv6h, 0,\n-\t\t     ip6_make_flowlabel(dev_net(dev), skb,\n-\t\t\t\t\tt->fl.u.ip6.flowlabel, true,\n-\t\t\t\t\t&t->fl.u.ip6));\n+\tipv6h = skb_push(skb, t->hlen + sizeof(*ipv6h));\n+\tip6_flow_hdr(ipv6h, 0, ip6_make_flowlabel(dev_net(dev), skb,\n+\t\t\t\t\t\t  t->fl.u.ip6.flowlabel,\n+\t\t\t\t\t\t  true, &t->fl.u.ip6));\n \tipv6h->hop_limit = t->parms.hop_limit;\n \tipv6h->nexthdr = NEXTHDR_GRE;\n \tipv6h->saddr = t->parms.laddr;\n \tipv6h->daddr = t->parms.raddr;\n \n-\tp[0]\t\t= t->parms.o_flags;\n-\tp[1]\t\t= htons(type);\n+\tp = (__be16 *)(ipv6h + 1);\n+\tp[0] = t->parms.o_flags;\n+\tp[1] = htons(type);\n \n \t/*\n \t *\tSet the source hardware address.\n","prefixes":["net"]}