From patchwork Mon Sep 27 13:57:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilson Peng X-Patchwork-Id: 1533361 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HJ4ND2tvFz9tk7 for ; Tue, 28 Sep 2021 00:12:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5C99C60811; Mon, 27 Sep 2021 14:12:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id djOszCM8Pn8q; Mon, 27 Sep 2021 14:12:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id A1A886066B; Mon, 27 Sep 2021 14:12:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 67D45C000F; Mon, 27 Sep 2021 14:12:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B1E95C000D for ; Mon, 27 Sep 2021 14:12:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 93BD380FEF for ; Mon, 27 Sep 2021 14:12:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YNHeCphKIeQJ for ; Mon, 27 Sep 2021 14:12:38 +0000 (UTC) X-Greylist: delayed 00:15:04 by SQLgrey-1.8.0 Received: from EX13-EDG-OU-002.vmware.com (ex13-edg-ou-002.vmware.com [208.91.0.190]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6056580FE8 for ; Mon, 27 Sep 2021 14:12:38 +0000 (UTC) Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Mon, 27 Sep 2021 06:57:32 -0700 Received: from chef-node-1.example.com.com (pek2-office-04-dhcp50.eng.vmware.com [10.117.4.50]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 38AA72020A; Mon, 27 Sep 2021 06:57:32 -0700 (PDT) From: wilsonpeng To: Date: Mon, 27 Sep 2021 06:57:27 -0700 Message-ID: <20210927135727.11512-1-pweisong@vmware.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Received-SPF: None (EX13-EDG-OU-002.vmware.com: pweisong@vmware.com does not designate permitted sender hosts) Subject: [ovs-dev] [ovs-dev v1 1/1] datapath-windows:adjust Offset when processing packet in POP_VLAN action X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" In one typical setup, on the Windows VM running OVS Windows Kernel, a Geneva packet with 8021.q VLAN tag is received. Then it may do POP_VLAN action processing in Actions.c, if the packet does not have Ieee8021QNetBufferListInfo in the oob of the packet, it will be processed by function OvsPopVlanInPktBuf(). In the function it will go on remove VLAN header present in the nbl, but related layers is never readjusted for the offset value at this moment. As a result, it will cause function OvsValidateIPChecksum drop the packet. Reported-at:https://github.com/openvswitch/ovs-issues/issues/225 Signed-off-by: wilsonpeng --- datapath-windows/ovsext/Actions.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c index e130c2f96..a9e486752 100644 --- a/datapath-windows/ovsext/Actions.c +++ b/datapath-windows/ovsext/Actions.c @@ -1122,6 +1122,13 @@ OvsPopFieldInPacketBuf(OvsForwardingContext *ovsFwdCtx, if (bufferData) { *bufferData = bufferStart + shiftLength; + } else { + /* Currently !bufferData means it should be treated as VLAN; + * Adjust layers Offset value as the vlan tag is removed + */ + OVS_PACKET_HDR_INFO *layers = &ovsFwdCtx->layers; + layers->l3Offset -= (UINT16)shiftLength; + layers->l4Offset -= (UINT16)shiftLength; } return NDIS_STATUS_SUCCESS;