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=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 EDE4EC4363D for ; Mon, 5 Oct 2020 15:32:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A28E0208C7 for ; Mon, 5 Oct 2020 15:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601911949; bh=vCcve0wi8t7ey0BmtIhX6anlHczScg0Iv+pVMrRjvdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ucK+BXCLuGCf/CuXt4rQQduAboU5HfvV1+jkhFu03R8MaLfLjjaS5nnhDwbNcwPB+ gnjqRiZmNTp8J+yebViNRIQL/8FDwXeZZl6+/V2pH+cJPFP1lNHnYAjWL2VWLGn1Mo ZK7IA3ESQ424HzXVk9j5fPgVXrCv+B3kPuE09dQk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728016AbgJEPc2 (ORCPT ); Mon, 5 Oct 2020 11:32:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:59816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727996AbgJEPcV (ORCPT ); Mon, 5 Oct 2020 11:32:21 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 E85ED208C7; Mon, 5 Oct 2020 15:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601911940; bh=vCcve0wi8t7ey0BmtIhX6anlHczScg0Iv+pVMrRjvdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cYmV4/pMLWMlcp4XJ1lH8U+93Yc3B3MW6Sz3HEx0L/MOsfVmXeUG5ObWqLNo9BNo9 7Q04RSY9A+h4Sz3K6JeR168P34TPx0tZRkE13Bb1ivdCuT/Ih7FsS4iFhdTcTCon5M EZRp+v6sm6VBVnmVvAltbV9cwb/0FOCcmAqe5NTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Schiller , Xie He , "David S. Miller" , Sasha Levin Subject: [PATCH 5.8 37/85] drivers/net/wan/lapbether: Make skb->protocol consistent with the header Date: Mon, 5 Oct 2020 17:26:33 +0200 Message-Id: <20201005142116.526721773@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005142114.732094228@linuxfoundation.org> References: <20201005142114.732094228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xie He [ Upstream commit 83f9a9c8c1edc222846dc1bde6e3479703e8e5a3 ] This driver is a virtual driver stacked on top of Ethernet interfaces. When this driver transmits data on the Ethernet device, the skb->protocol setting is inconsistent with the Ethernet header prepended to the skb. This causes a user listening on the Ethernet interface with an AF_PACKET socket, to see different sll_protocol values for incoming and outgoing frames, because incoming frames would have this value set by parsing the Ethernet header. This patch changes the skb->protocol value for outgoing Ethernet frames, making it consistent with the Ethernet header prepended. This makes a user listening on the Ethernet device with an AF_PACKET socket, to see the same sll_protocol value for incoming and outgoing frames. Cc: Martin Schiller Signed-off-by: Xie He Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/wan/lapbether.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index e61616b0b91c7..b726101d4707a 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c @@ -198,8 +198,6 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) struct net_device *dev; int size = skb->len; - skb->protocol = htons(ETH_P_X25); - ptr = skb_push(skb, 2); *ptr++ = size % 256; @@ -210,6 +208,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) skb->dev = dev = lapbeth->ethdev; + skb->protocol = htons(ETH_P_DEC); + skb_reset_network_header(skb); dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); -- 2.25.1