From patchwork Mon Sep 7 11:40:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weili zhang <305753229@qq.com> X-Patchwork-Id: 1358869 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.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=qq.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=qq.com header.i=@qq.com header.a=rsa-sha256 header.s=s201512 header.b=hwI0Qx+R; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlRFF30szz9sSJ for ; Mon, 7 Sep 2020 21:41:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EA31B87034; Mon, 7 Sep 2020 11:41:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iJ67XHwITftV; Mon, 7 Sep 2020 11:41:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 0D94382063; Mon, 7 Sep 2020 11:41:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EE34BC0859; Mon, 7 Sep 2020 11:41:17 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id ECD9DC0051 for ; Mon, 7 Sep 2020 11:41:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DCD028675D for ; Mon, 7 Sep 2020 11:41:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eaClp060iPX0 for ; Mon, 7 Sep 2020 11:41:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qq.com (out203-205-221-250.mail.qq.com [203.205.221.250]) by whitealder.osuosl.org (Postfix) with ESMTPS id 140FA86759 for ; Mon, 7 Sep 2020 11:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1599478867; bh=2oze91PIX7CDcLAUjqtmX4l89i7BUNuJz9eKAZqNiKo=; h=From:To:Cc:Subject:Date; b=hwI0Qx+RCd53wIuwVblV97TozirnT5n7M76igzRQQvIK+ra+v5lmgBZupM+5hUzNZ EK5XgJjnRAV1fIJrEX6oTHzXbHniZUfh85KYouGKcNvaR5AN9agPzHxnU8xXw2jfNu O9umPXKnGLEome/S/y/3mWTjShutPCv6whMXv14s= Received: from localhost.localdomain ([111.205.198.4]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id A40B168A; Mon, 07 Sep 2020 19:41:00 +0800 X-QQ-mid: xmsmtpt1599478860tqena42la Message-ID: X-QQ-XMAILINFO: MoiCBUY3VLu8scXO2EUVl9AIYnuCQfFcihb4r4whNWLSXOKnRMrvIOBGCYCPdX 3/ccQRKYfoGjuteSECgFFN2bcT1BQFPedW+/PVmd7EV5r9zq7/RNP+lqXhShuXf83ptfjbY+/Y/A SJ45uSM13T6gbiAuE8PKH6inxO9m4/nNPI7rd8bHbA8LeawnkVq7gUuxhvLTcb6fVP+2DmyZbOBm cl1ylpzX9HurQvX+Org8vOvuodD3ENTsz6hOaav7NgLZ31rVVBp2kUywHKFGY3fjKWZcArFJuxhz ghkdwzvioVw349vtBtHByaePC/zBBxNgbjYtYaxkMUgGfkzE5+xOz1msvxs/N2lR6G4v0aB5OLe3 AUMr59rfL2fOXfxhosk89xhzAe8aTxoyP69hsTC+feCq6ZO9qRKp493FSTIHBHRQsbbV2dg+Ep93 55TpQCc7iTn1u/9W+KIGcpZBE1lZTqC/dYoqC/JE7S47Vc+fTgRK13MXRByx0ibmDixr1kkxc3bf mqlrLm3KuNrcbQGkLMv5oaZrgeXpts//XolsM81EwR5BZ1Dz83ll8fa+PhC4nrcBKXeDlVUVoXrF dczB427ll6B7GeZBD8JVwgp8InbRdp7igBje/sXvJ2esOeazAwX2xhFdFUY1eM+uUlak21jLxasl PxhyxBn51CdarxtQ+JFI3OjzTzj0bKGlcjtmRvKxLPk26Dm3FA0osSMKLxRXmpmee1MXbu1WJLob amK3uhwv26lb9LqVuNp/QRzvwwvrw0wtkW From: 305753229@qq.com To: ovs-dev@openvswitch.org Date: Mon, 7 Sep 2020 19:40:45 +0800 X-OQ-MSGID: <20200907114044.40417-1-305753229@qq.com> X-Mailer: git-send-email 2.24.2 (Apple Git-127) MIME-Version: 1.0 Cc: Weili Zhang <305753229@qq.com> Subject: [ovs-dev] [PATCH]netdev-native-tnl: strip padding bytes of inner L2. 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" From: Weili Zhang <305753229@qq.com> We need strip the inner L2 padding bytes, before enapcasulate a packet. Signed-off-by: Weili Zhang <305753229@qq.com> --- lib/netdev-native-tnl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c index b89dfdd52..acfbb13c4 100644 --- a/lib/netdev-native-tnl.c +++ b/lib/netdev-native-tnl.c @@ -149,11 +149,15 @@ void * netdev_tnl_push_ip_header(struct dp_packet *packet, const void *header, int size, int *ip_tot_size) { + int padding = dp_packet_l2_pad_size(packet); struct eth_header *eth; struct ip_header *ip; struct ovs_16aligned_ip6_hdr *ip6; eth = dp_packet_push_uninit(packet, size); + if (padding) { + dp_packet_set_size(packet, dp_packet_size(packet) - padding); + } *ip_tot_size = dp_packet_size(packet) - sizeof (struct eth_header); memcpy(eth, header, size);