Received: by 10.223.176.46 with SMTP id f43csp3434679wra; Mon, 22 Jan 2018 14:18:08 -0800 (PST) X-Google-Smtp-Source: AH8x2272Bi36Sqz8IeX5/p94a0umch8qizpeHAw7KlryfjqpnOX9Ew10HKqZckHYRQpkJGkdvy7g X-Received: by 10.107.136.76 with SMTP id k73mr635370iod.301.1516659488160; Mon, 22 Jan 2018 14:18:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516659488; cv=none; d=google.com; s=arc-20160816; b=JMslQKIT24L5YhAydDCiw1oW1T8FFky340JV9xDBkqnSYxN0dV+bAQgDShygs1PjI9 0n3tb/HSNCiQZv/VUm12uEYn282IYH0L+RB8wfIt0rxV/M6r+6kR4/DQI6YP9OR71U0j w3SsFO638NPEPt3uc5MkymfEQdzOFJDrsOFYY5UZWYvoP99l6y4KJOr7n6/g0f4Mc4c7 0vr8tBItbgvpggmrWh3Q+5RxwbrUypMrMZrzxqZImHAZGUyEOjSSt0zd8guA7apEW3nv Gj62yEBZn/+IMT4GesEhKgprG98hh4aU9nMdBH1a5hM3hlidF6GOISFBz/tJ5y4w2RLA dnKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=+vD4/OJT+15LFzQIwOQtIGeuJYJVrlpdiYTW3YICc9M=; b=dMpahpZvmD6WXSHSSIr1VMLa6a556Ol+zwb43ROnD9DZDxXFAF6Ky2or5xQee9aHXk PpnUcb8tzFwUchVy+9MMQVz555tWF6kd/djfRxRa/NVfWIsgfVPmJXYiA0ejL+ZJwbYo NXyzWnHKRoKkO7U8TEzuQ1YLHkKBNSmvPtrJ4whbqWUjwTOH1wBf3ofjrG3rAweSkj4s SNNw3c4R9QGBnDywJTSy3wzqWjVy13j07uB0XqTY/d3hWWo8hEpXzjXI1E2IXSJJ+Als P1XiM3jYZmD5Z4CU1xVYxjRFP2e7OyvTnNRu+p2I2i2qER/o9AniUaEVS3fn02Q+Imd6 QWCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Mellanox.com header.s=selector1 header.b=LR6xGu+9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si14050406iof.322.2018.01.22.14.17.55; Mon, 22 Jan 2018 14:18:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@Mellanox.com header.s=selector1 header.b=LR6xGu+9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751228AbeAVWRU (ORCPT + 99 others); Mon, 22 Jan 2018 17:17:20 -0500 Received: from mail-eopbgr00048.outbound.protection.outlook.com ([40.107.0.48]:54304 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751002AbeAVWRQ (ORCPT ); Mon, 22 Jan 2018 17:17:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+vD4/OJT+15LFzQIwOQtIGeuJYJVrlpdiYTW3YICc9M=; b=LR6xGu+93c0Gug1Mv4IxFVrFo7ZtXxYHYeeFNjV5SEMqmql7zrKamVgQIBvHTffeco3sjBWiKVpykcvXL+Czhnp7x0YS0kVpaSG6mJE4O3HGufUe2GmbviB4yZ0fx8n0Kvf9B1A0ZrRpvQ3pETEmWSdj7J41VHQ7Vyp1BzrQh9c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yossiku@mellanox.com; Received: from dev-l-vrt-187.mtl.labs.mlnx (141.226.120.58) by DB6PR0501MB2709.eurprd05.prod.outlook.com (2603:10a6:4:81::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Mon, 22 Jan 2018 22:17:10 +0000 From: yossiku@mellanox.com To: Steffen Klassert , Herbert Xu , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Yossi Kuperman Subject: [PATCH net] xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version Date: Tue, 23 Jan 2018 00:16:21 +0200 Message-Id: <1516659381-12971-1-git-send-email-yossiku@mellanox.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.120.58] X-ClientProxiedBy: AM5PR06CA0001.eurprd06.prod.outlook.com (2603:10a6:206:2::14) To DB6PR0501MB2709.eurprd05.prod.outlook.com (2603:10a6:4:81::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e71ae5f4-b032-4712-e478-08d561e5e278 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020);SRVR:DB6PR0501MB2709; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2709;3:r/1aGleKbW5jD4X0ow6bYJt/gEDeF5iiKgDGhGMas7lsHe/JmyHmC7d3TK5MVJfb/Qyzl2g0fCXABbVYyxxCRB84Z1He3zXtE66ZniErghCknUqEN1ZnG8BvfLkzeiyGmDHzPp1z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cQdUdE8zmTYFDMIsUC4o7UyyfQmHeDhwgexVjjh9Q/kSQnnVgOSZZmv0yDN/p0f3BsDl9foKBUa0WcWsnToC7+MBbE9APsCB/aExq6AjG5/gODzCYiZ0E5mxIOlInAprVf8pGpnWOuHEkFq6nCESL/+L/lNo+FAdoGKV8s3YxDWixxvtJEAAwrMWxc5FVwUGT0NiqDYngFsmO/4;4:P7fDfG1jhaKgG393aiBGP6ssfF0ADNqVjAqtKnB33uUvDcxrZ832GFnTSdDCcilFB2UwBWOjNZqEaLlhrTO5WZBc2PkD0NT8t11QLCGacOhsLNk1YcD6wbi2Yidyvsu67zDZVuJZPqCxMFQ6hB7R2nG771exMD9Q4OgLSeL/ck3Xyo/NV5NQlMR6MOvYGtyJtp/Kq2Y2hgFT+HzKNX5nb4ljJkY88YazUmQpG/0rc0TsyddLJpqbipFiX6y7TBGsE9d3M0rxvd0U6twzXxA9Pw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(5005006)(8121501046)(3231023)(2400081)(944501161)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DB6PR0501MB2709;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DB6PR0501MB2709; X-Forefront-PRVS: 0560A2214D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(366004)(396003)(376002)(39860400002)(346002)(39380400002)(189003)(199004)(8936002)(50226002)(68736007)(2906002)(81156014)(105586002)(6512007)(6486002)(9686003)(97736004)(53936002)(50466002)(107886003)(6666003)(478600001)(81166006)(26005)(85782001)(8676002)(48376002)(305945005)(5660300001)(6116002)(3846002)(4326008)(16526018)(110136005)(66066001)(47776003)(36756003)(16586007)(316002)(106356001)(52116002)(25786009)(51416003)(6506007)(386003)(33896004)(86362001)(7736002)(85772001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2709;H:dev-l-vrt-187.mtl.labs.mlnx;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB6PR0501MB2709;23:2BEZuJ/KDHHuc+0Lmiakk6A//jBCFg/GRb8gvwF?= =?us-ascii?Q?9wClAx5NCPwx79habkQiDSzbMZ73cHBJWz97VIo3gi/j/U4H+2kxZ19Q3BBg?= =?us-ascii?Q?GmtYF4PQpC7TJF0wR19HLB4WBdtYb36yOrrUhM5A7lKAOGCKoC+u/5pZWthm?= =?us-ascii?Q?LhFNBZUDHVtgOnUI5MdT3fR5mMI0yM3kM7m1DFBFhAppqTbEQq79Vlm7FT7m?= =?us-ascii?Q?zHFn4YMpkX5hkbvFAHQHCt1Z5JCSzwuU7+QnZPo06UDSjMrm2jWggIcLkL1B?= =?us-ascii?Q?6arpSH4ObDf442vWZwiSby/M6B21JS12r2uLu9ALHaMdslTsO/NwB2hFpzh2?= =?us-ascii?Q?HzoNJpj+dql+ZY08M6rzMP4eGeQIaqDzLMfXCqgCVv9WrUwJinfmL/wL/Q3/?= =?us-ascii?Q?70XbyrBq/J25lFM9QJIFUreXKZJJw4GEc7dx2JyXvy1fC/cCjjFzppoWMIjx?= =?us-ascii?Q?PspIHxy50zo+riE4tFBCl8Dzy7gW7W4odwvyi9+Pno8n6UKYcgtrLmO/r1nX?= =?us-ascii?Q?88MoCmL6xlj+COA3pcmeG/rZCXnzV0hlrfO5dLzZxy4DoBq1Kv2PbvcrHIG3?= =?us-ascii?Q?jYJTBnm/WPCa4gUTfsD4PVuLCAE11xNaMb17FdwAwUb0tGaz2ovGsBHQLGuX?= =?us-ascii?Q?dzKjpkpE9S4paQ7zcNfaMkbaRQbivbp/9H0sTFWHmBeWE7pR6gwZPiiO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Bn4IdaxAT1rMOTPSBBASzYBbHVD14BUTB3XOyx1QrpgE7fA+0hi75EIb+H32c=;24:PtlPpMkdnqhEXfj0X7aZG1ViUiGpd8iCoFJDWmgJv85GtKdaMaH59BZ0UZ0TJPWk+wOPpf1Un8EFmLGwRUjH80bi1vO3msgVSXtzWCJSQwY=;7:Ac0xgSmW1v/FES2e1jKwzbzVyEFoSoP4z94bdWqh/WmnQFgPwxffQME7TwlWowUzullwQnkRM/uhQ4tZE2G0ARH8jucBmqofAkRKDblONJHTxCcDlyfTyjuyot9LFqiJvwRaZO8S+yOd84n594RlPg3y/01W4ElGTBmoCuCK03UdzpkFZfY1IKgRmSD3weuyg8tLcva4ujfC1hBfSP9G7qTPKBhRFk+rKOyqnZVqpZaPCFmGGdoCvPHiqbMZ6x/d SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2018 22:17:10.8709 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e71ae5f4-b032-4712-e478-08d561e5e278 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2709 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yossi Kuperman IPSec tunnel mode supports encapsulation of IPv4 over IPv6 and vice-versa. The outer IP header is stripped and the inner IP inherits the original Ethernet header. Tcpdump fails to properly decode the inner packet in case that h_proto is different than the inner IP version. Fix h_proto to reflect the inner IP version. Signed-off-by: Yossi Kuperman --- net/ipv4/xfrm4_mode_tunnel.c | 1 + net/ipv6/xfrm6_mode_tunnel.c | 1 + 2 files changed, 2 insertions(+) diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index e6265e2..20ca486 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c @@ -92,6 +92,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) skb_reset_network_header(skb); skb_mac_header_rebuild(skb); + eth_hdr(skb)->h_proto = skb->protocol; err = 0; diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index 02556e3..dc93002 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c @@ -92,6 +92,7 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) skb_reset_network_header(skb); skb_mac_header_rebuild(skb); + eth_hdr(skb)->h_proto = skb->protocol; err = 0; -- 2.8.1