From patchwork Mon Sep 7 11:51:57 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: 1358891 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.137; helo=fraxinus.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=dW22cwVa; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlRTv2ZHhz9sSJ for ; Mon, 7 Sep 2020 21:52:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A774A85E5C; Mon, 7 Sep 2020 11:52:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TihyK2unv_Dv; Mon, 7 Sep 2020 11:52:15 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 31E4485218; Mon, 7 Sep 2020 11:52:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 24B14C0859; Mon, 7 Sep 2020 11:52:15 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2B199C0051 for ; Mon, 7 Sep 2020 11:52:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0E36E20462 for ; Mon, 7 Sep 2020 11:52:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U2QTqm-pwbBX for ; Mon, 7 Sep 2020 11:52:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qq.com (out203-205-221-164.mail.qq.com [203.205.221.164]) by silver.osuosl.org (Postfix) with ESMTPS id DBB39203E0 for ; Mon, 7 Sep 2020 11:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1599479524; bh=2oze91PIX7CDcLAUjqtmX4l89i7BUNuJz9eKAZqNiKo=; h=From:To:Cc:Subject:Date; b=dW22cwVa7196AL78MYypFc3Rv5+U5fLGGa8ml/1JE0v0kdTB1kDY/i5gelL3dBhOu RZv0Uxb0vtSd7syWvEKxE1FdlOYrKWkgO7rn26KZq+/suasR6o4of/CZKzmdJHn6QS +D1DrvBS92dpcRUrGqRwEq2a/S1OI6WmhNAnf1sA= Received: from localhost.localdomain ([111.205.198.4]) by newxmesmtplogicsvrsza9.qq.com (NewEsmtp) with SMTP id D002204B; Mon, 07 Sep 2020 19:52:00 +0800 X-QQ-mid: xmsmtpt1599479520t9alypvm6 Message-ID: X-QQ-XMAILINFO: OezhL1htI/K/UM9ErqipARk3frPt/j91Bagc/icDZkEgwOzho/MyDMWe3oaQbN ZtuoLJw8FAx/mcXsBVoyx1qpakrXIgxz8zQuoOBMIs38ByQopZagH3nIIPaczPhFCkLFAUckCOth 5caPv06yaxY7iQpj5NDcjhG7rZskFyK3ALqBGpxWGQQbHeCESKZTl5c7dRoBjpknHDpNx1oFeA9T Uky5xW2hdQaSUtIkNKyU44MCx/uLrL6CFOLBIx15rBzL8YCFB1k2QQzhYfO8ILr0xfTYzPuzDKd5 ExeDGQTIydDNfF6c7jvJ/XWZ4Gq1Zl789lBmYubOH46OKSFE9uyzqYwLmKg4CWYi2OnDWYizaNJ6 YMCteryrxQwulq+y4+AH1nrGhABpt1jA9iZ5J9VdF4vbseq42hwZv/r4GSttDeu5JkuAqIINhTVu 0pS7CnwxxN9VufM19AJ766yCAFRgGUEWoYeMDVBbLYhuwui3yVt0RFdXPZcDO489wrZMVlt+JwpW nS9S+UTEenFNjWFZHmmmBfurX3eaDjnHwlAiO0NdTe+bcN9B9YEuhjGG3zCiXiffmPodX5VYcXZU rPptPm06SphKnA2/LSWEo0Jbdq7Xhucz/8GqP6K6Bwei7X7nc/bALu6VU366rbKznNuoiFNvq/NX YgmlOlf//uqrWapGbVM9KWaJ9YURKVSESaqU0bmi6JtV29MXbjnzpAOKj2sh3UQpq/5zVxHtRQk+ 2CqA79+oepWCi2Pbgv/8tB0L8+w+i0K1CFSDpAqc23ilRmyVNpag2vIvT/Q8JXcWUxt91dlQf/C2 s= From: 305753229@qq.com To: ovs-dev@openvswitch.org Date: Mon, 7 Sep 2020 19:51:57 +0800 X-OQ-MSGID: <20200907115157.41150-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] Subject:[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);