From patchwork Wed Apr 26 17:07:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Craig Gallek X-Patchwork-Id: 755574 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 3wCmj53tccz9s8c for ; Thu, 27 Apr 2017 03:07:21 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750862AbdDZRHO (ORCPT ); Wed, 26 Apr 2017 13:07:14 -0400 Received: from mail-qk0-f181.google.com ([209.85.220.181]:35882 "EHLO mail-qk0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbdDZRHK (ORCPT ); Wed, 26 Apr 2017 13:07:10 -0400 Received: by mail-qk0-f181.google.com with SMTP id u75so6338961qka.3 for ; Wed, 26 Apr 2017 10:07:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0+K1z26D46cjn3KvV4CShOE/ZJ6jplErGTO/L+W1Q5M=; b=CjtuWRonjowuiF7rpIfhJfXdxNXATg6dJyeKm/gLlLYGx04BrGObE+XgIh1SUPTzu9 7Hzu8HcH+QrkMrM8+7/IOmWR5BH51ODxiqRS4kt5vnKQS6BhnRH2j+Qn4U6V78NCxzbB mXIML5CheSRc7rSwIcNn3HE/JBAW4hv1kwlJ+e0FgL9vw5iTrT0bSjqd3gIk6iMY8omW y5EsVGfe8EdfPo2CGONC/ntoRrerV+t60QFM7v/6VS06aQNxay88BlxM3oQVzr8uL5nf bKbboPzR7LgEHYI85kJ1XTffi9OyTdD2BZb4B/qaG2uIn1OCGp8qa7Vanudr2XZbKRVI Zqyg== X-Gm-Message-State: AN3rC/5Yvf1lkQRfm2oK5wUdT/Fg2NPHxsUTFMwe5aQDl/pA1oD67/g8 FcaRCJV6DlqUWfe8aiQ7Kw== X-Received: by 10.55.79.87 with SMTP id d84mr873508qkb.172.1493226429326; Wed, 26 Apr 2017 10:07:09 -0700 (PDT) Received: from monkey.nyc.corp.google.com ([172.26.104.74]) by smtp.gmail.com with ESMTPSA id 139sm564242qkl.13.2017.04.26.10.07.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Apr 2017 10:07:08 -0700 (PDT) From: Craig Gallek To: Hideaki YOSHIFUJI , Alexey Kuznetsov , "David S . Miller" Cc: netdev@vger.kernel.org Subject: [PATCH net-next] ip6_tunnel: Fix missing tunnel encapsulation limit option Date: Wed, 26 Apr 2017 13:07:07 -0400 Message-Id: <20170426170707.165201-1-kraigatgoog@gmail.com> X-Mailer: git-send-email 2.13.0.rc0.306.g87b477812d-goog Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Craig Gallek The IPv6 tunneling code tries to insert IPV6_TLV_TNL_ENCAP_LIMIT and IPV6_TLV_PADN options when an encapsulation limit is defined (the default is a limit of 4). An MTU adjustment is done to account for these options as well. However, the options are never present in the generated packets. ipv6_push_nfrag_opts requires that IPV6_RTHDR be present in order to include any IPV6_DSTOPTS options. The v6 tunnel code does not use routing options, so the encap limit options are not included. A brief reading of RFC 3542 section 9.2 (specifically the 4th paragraph) makes me believe that this requirement in the kernel is incorrect. Fixes: 333fad5364d6: ("[IPV6]: Support several new sockopt / ancillary data in Advanced API (RFC3542)") Signed-off-by: Craig Gallek --- net/ipv6/exthdrs.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 25192a3b0cd7..224a89e68a42 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -932,15 +932,12 @@ void ipv6_push_nfrag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt, u8 *proto, struct in6_addr **daddr, struct in6_addr *saddr) { - if (opt->srcrt) { + if (opt->srcrt) ipv6_push_rthdr(skb, proto, opt->srcrt, daddr, saddr); - /* - * IPV6_RTHDRDSTOPTS is ignored - * unless IPV6_RTHDR is set (RFC3542). - */ - if (opt->dst0opt) - ipv6_push_exthdr(skb, proto, NEXTHDR_DEST, opt->dst0opt); - } + + if (opt->dst0opt) + ipv6_push_exthdr(skb, proto, NEXTHDR_DEST, opt->dst0opt); + if (opt->hopopt) ipv6_push_exthdr(skb, proto, NEXTHDR_HOP, opt->hopopt); }