From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F0EBC2D0E4 for ; Tue, 24 Nov 2020 02:58:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A0B9206FA for ; Tue, 24 Nov 2020 02:58:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="O84cUwRQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728919AbgKXC63 (ORCPT ); Mon, 23 Nov 2020 21:58:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:37928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727983AbgKXC60 (ORCPT ); Mon, 23 Nov 2020 21:58:26 -0500 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E3FB8206FA; Tue, 24 Nov 2020 02:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606186706; bh=D88RoA3yna6KC8S15hel0H49TPaGQF8wOE/3vR14YlA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=O84cUwRQUnVifMzdRwAN6xWDZGSfiYAk7/JTVJ2737Zh7EvW59vc1KaHIEYm2Kh/m A1nROVW6lv3LInIVpGLVasHlEwAdOBPOLsPo34GtGX23/NBe+UfpurnihrFBDndjCE 9TycJNw9MecgUIuj5cfDw8/UbRPNvO0DSs1w9/Eg= Date: Mon, 23 Nov 2020 18:58:24 -0800 From: Jakub Kicinski To: Willem de Bruijn Cc: "Jason A. Donenfeld" , Eyal Birger , David Miller , Network Development , Xie He Subject: Re: [net,v2] net/packet: fix packet receive on L3 devices without visible hard header Message-ID: <20201123185825.7fc734a6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: <20201121062817.3178900-1-eyal.birger@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, 21 Nov 2020 08:23:30 -0500 Willem de Bruijn wrote: > On Sat, Nov 21, 2020 at 2:56 AM Jason A. Donenfeld wrote: > > > > On 11/21/20, Eyal Birger wrote: > > > In the patchset merged by commit b9fcf0a0d826 > > > ("Merge branch 'support-AF_PACKET-for-layer-3-devices'") L3 devices which > > > did not have header_ops were given one for the purpose of protocol parsing > > > on af_packet transmit path. > > > > > > That change made af_packet receive path regard these devices as having a > > > visible L3 header and therefore aligned incoming skb->data to point to the > > > skb's mac_header. Some devices, such as ipip, xfrmi, and others, do not > > > reset their mac_header prior to ingress and therefore their incoming > > > packets became malformed. > > > > > > Ideally these devices would reset their mac headers, or af_packet would be > > > able to rely on dev->hard_header_len being 0 for such cases, but it seems > > > this is not the case. > > > > > > Fix by changing af_packet RX ll visibility criteria to include the > > > existence of a '.create()' header operation, which is used when creating > > > a device hard header - via dev_hard_header() - by upper layers, and does > > > not exist in these L3 devices. > > > > > > As this predicate may be useful in other situations, add it as a common > > > dev_has_header() helper in netdevice.h. > > > > > > Fixes: b9fcf0a0d826 ("Merge branch > > > 'support-AF_PACKET-for-layer-3-devices'") > > > Signed-off-by: Eyal Birger > > > Acked-by: Jason A. Donenfeld > > Acked-by: Willem de Bruijn Applied, thanks!