Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2903314iog; Mon, 27 Jun 2022 05:26:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v4jSYb2esq3cwpMyDw5Dw7HOM6iZtSWKcUQ7a+MI4Cy/+UqQJtNWymgyXxZVGYfjkKuMJl X-Received: by 2002:a05:6402:1a45:b0:435:5c8b:26ed with SMTP id bf5-20020a0564021a4500b004355c8b26edmr15801860edb.376.1656332811106; Mon, 27 Jun 2022 05:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656332811; cv=none; d=google.com; s=arc-20160816; b=HsIAt6qhSjkBoicduWUXDhnQuQE/iCIjSUA6JgZoyYfDZRMLI8lDoSzCzMx9RM0B5k hEVUEuHwxgmmmDlVP/1BdLfwspk5VBHWror+E+CiUbkadYK0VM+NqoLXw33k/nu17B8x 53f4LZekw6XonGLq0jkd++jKkws0y8KIv+bviVY3q5IwUCYJ0Zabces1o7TdqKIy6I8B 6KgdU9a085y6oPBeL7kGOEBCYNeqBfy9WTDL1TTf7alYyS6dWen5+pVSDvYAPb7cLSRR P07/P/77FwviLiqiwCNPH77qRmUhmreEN8Y9zxPNmGVkNPQaw19GAvg6mobfa+TRSVgo ymZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BlnjK81SIRR+u3CFi7R8jPW5HUCThrvlYUECnjdejC8=; b=nVmhmFsksWOiLT7ZMSNLQzb+/ZWTMMV3/3qDBDtcCk0DCYSJDZFqMsn9X2PZFHaUJH 0UdkSl01/JDOFthJe2nGKq0BvgMQWQ1E2E0DA2A6rXOY1WLwVl2cLo9EBdlYhf3GB8YV /EML8b0ocKe/XTP4IY5uQksIQULu2U42e9nzVDtEhhmwMxUmnWk7fpshtaE29WZUB4v9 tca312KkKQ64SCx+eMmPJhw55OJqYA6FelL54ifnq+Lo7kle7uJfNgRpRbsSG+gWiMWh 4gaRmGYNp9tCP5+nYDAkDBDaaSF0aXHURV/yUhNwiaWhv+KY9a2JYX+qz9o36/Vcbea+ NGVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bSWmsO7g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga39-20020a1709070c2700b00726b4dfce1esi1924828ejc.167.2022.06.27.05.26.25; Mon, 27 Jun 2022 05:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bSWmsO7g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234547AbiF0LXF (ORCPT + 99 others); Mon, 27 Jun 2022 07:23:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234538AbiF0LXB (ORCPT ); Mon, 27 Jun 2022 07:23:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 871FC1C8; Mon, 27 Jun 2022 04:23:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B2B361451; Mon, 27 Jun 2022 11:23:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CBE2C341C7; Mon, 27 Jun 2022 11:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656328979; bh=SYnv/FhFH1ekUtV6eC1WyevHUII+0SmBoVZiwtyZeUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSWmsO7gzJHeISktB6p6nO1TqVnI+4oRrU64tJI7wLQTIL86KG2TNlumKnskmHAnC DwZs8Sl7NLfGYq83AH2Nb//eH0Tvjj78nmJ5xyl48uTz1G/krDwkitu7GiZxRxnPbF 7CxbNACqDyRP6x9PusgPHHEOv6rC4nwmvaxTUEXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rosemarie ORiorden , Eelco Chaudron , Paolo Abeni Subject: [PATCH 5.10 011/102] net: openvswitch: fix parsing of nw_proto for IPv6 fragments Date: Mon, 27 Jun 2022 13:20:22 +0200 Message-Id: <20220627111933.799293833@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111933.455024953@linuxfoundation.org> References: <20220627111933.455024953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rosemarie O'Riorden commit 12378a5a75e33f34f8586706eb61cca9e6d4690c upstream. When a packet enters the OVS datapath and does not match any existing flows installed in the kernel flow cache, the packet will be sent to userspace to be parsed, and a new flow will be created. The kernel and OVS rely on each other to parse packet fields in the same way so that packets will be handled properly. As per the design document linked below, OVS expects all later IPv6 fragments to have nw_proto=44 in the flow key, so they can be correctly matched on OpenFlow rules. OpenFlow controllers create pipelines based on this design. This behavior was changed by the commit in the Fixes tag so that nw_proto equals the next_header field of the last extension header. However, there is no counterpart for this change in OVS userspace, meaning that this field is parsed differently between OVS and the kernel. This is a problem because OVS creates actions based on what is parsed in userspace, but the kernel-provided flow key is used as a match criteria, as described in Documentation/networking/openvswitch.rst. This leads to issues such as packets incorrectly matching on a flow and thus the wrong list of actions being applied to the packet. Such changes in packet parsing cannot be implemented without breaking the userspace. The offending commit is partially reverted to restore the expected behavior. The change technically made sense and there is a good reason that it was implemented, but it does not comply with the original design of OVS. If in the future someone wants to implement such a change, then it must be user-configurable and disabled by default to preserve backwards compatibility with existing OVS versions. Cc: stable@vger.kernel.org Fixes: fa642f08839b ("openvswitch: Derive IP protocol number for IPv6 later frags") Link: https://docs.openvswitch.org/en/latest/topics/design/#fragments Signed-off-by: Rosemarie O'Riorden Acked-by: Eelco Chaudron Link: https://lore.kernel.org/r/20220621204845.9721-1-roriorden@redhat.com Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/openvswitch/flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c @@ -265,7 +265,7 @@ static int parse_ipv6hdr(struct sk_buff if (flags & IP6_FH_F_FRAG) { if (frag_off) { key->ip.frag = OVS_FRAG_TYPE_LATER; - key->ip.proto = nexthdr; + key->ip.proto = NEXTHDR_FRAGMENT; return 0; } key->ip.frag = OVS_FRAG_TYPE_FIRST;