Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3963039ybl; Mon, 13 Jan 2020 05:46:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzKq0aMtUJge+8CgyQGP3BfV9NuARSrdPHFyPNrK4IfnCoUhggSj4skzkK2tei+EDF6j23W X-Received: by 2002:a9d:4b05:: with SMTP id q5mr12342898otf.174.1578923171012; Mon, 13 Jan 2020 05:46:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578923171; cv=none; d=google.com; s=arc-20160816; b=bNn+RiPbDR5RQSYcXdmEcooY38l2r3gPKdrt3JGNyvcXQh4roJSkkmr2tjBwULJhZl rzEMYhS2UTP8oyRyTBwGZMc0/NbZz2BSRZsqUOV56yKhOwYDnqtn8lZzLN66z7Y5SObo JOvzlmM8NY0KiH+fXmvn89/w2nFEixCFwwXeYb9/3/WoD3GJ0huuKNvfHx6eABBdUZbo 3qc0EqOM1B9JtoltCkowZEtwDGA6x58EJsPPM2gxiiM5u4etQD0xqevZKg3iFQ1m7mFN pKFpjybtBC3FFzOjoFLPIKw8O4vrE2KHQU8bCYs03rDLJmDDpkf5GBpBAmW4LG8wnwdG WzZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=UsdRYxS3iGOmtf0BEiK0IvADZIqLSlvpWzvsyvMhIXo=; b=iryQpRXYAdO+JCNPGzeglC1EJW1dPQbL71jAzhLeILLDab/h+Ab55IduK1qumi0t1u RfyIPOO7BwwhYbAYY3VXCICXEpElmnZ7SLAxd7wDp0sKCtTn9GWcUDKMb9AAvAeZuFXj MzjQuOudJLPewpjhKfgHp14W2t9dpqbjiPlBoX6gBTjd5BocmVT7zPYr6oyNeiLSIde/ X8bLZNUDgLCTuu6RuekhxNO7SmaKBkaHSSylwkPQ4SdzsnUtNnKBJCjfwG7OXd1kW89j C1hWqeDo4rIKdVpp6X7PVkcntP8p52VgWDk6JX8B0cztyBEKcTdcqa3W6D18jlvoAjds fGqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=gN9yEc2V; 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=wp.pl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si6725538oti.104.2020.01.13.05.45.59; Mon, 13 Jan 2020 05:46:11 -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 (test mode) header.i=@wp.pl header.s=1024a header.b=gN9yEc2V; 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=wp.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728810AbgAMNoc (ORCPT + 99 others); Mon, 13 Jan 2020 08:44:32 -0500 Received: from mx3.wp.pl ([212.77.101.10]:54034 "EHLO mx3.wp.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbgAMNoc (ORCPT ); Mon, 13 Jan 2020 08:44:32 -0500 Received: (wp-smtpd smtp.wp.pl 10166 invoked from network); 13 Jan 2020 14:44:29 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1578923069; bh=UsdRYxS3iGOmtf0BEiK0IvADZIqLSlvpWzvsyvMhIXo=; h=From:To:Cc:Subject; b=gN9yEc2Vyd63V7y0w1TnejykErvemGMT0NtKxOurlQfv5EjFBMaOZMthDVqh6mtoO T+tjr4cyHs+GHch7mQ3HcWX/AlQb3jfWvms5l92k9selHMGC34ygppSvj23nXxAGUX iH2WR19JM4B5HfoGJIc5Ucgwxpw1YL4yK7S5r6JY= Received: from c-73-93-4-247.hsd1.ca.comcast.net (HELO cakuba) (kubakici@wp.pl@[73.93.4.247]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 13 Jan 2020 14:44:29 +0100 Date: Mon, 13 Jan 2020 05:44:21 -0800 From: Jakub Kicinski To: Martin Schiller Cc: khc@pm.waw.pl, davem@davemloft.net, linux-x25@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] wan/hdlc_x25: fix skb handling Message-ID: <20200113054421.55cd5ddc@cakuba> In-Reply-To: <20200113124551.2570-2-ms@dev.tdt.de> References: <20200113124551.2570-1-ms@dev.tdt.de> <20200113124551.2570-2-ms@dev.tdt.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-WP-MailID: 5947819778d9914c21dddc05a56b3135 X-WP-AV: skaner antywirusowy Poczty Wirtualnej Polski X-WP-SPAM: NO 000000A [QfPU] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 13 Jan 2020 13:45:51 +0100, Martin Schiller wrote: > o call skb_reset_network_header() before hdlc->xmit() > o change skb proto to HDLC (0x0019) before hdlc->xmit() > o call dev_queue_xmit_nit() before hdlc->xmit() > > This changes make it possible to trace (tcpdump) outgoing layer2 > (ETH_P_HDLC) packets > > o use a copy of the skb for lapb_data_request() in x25_xmit() It's not clear to me why > This fixes the problem, that tracing layer3 (ETH_P_X25) packets > results in a malformed first byte of the packets. > > Signed-off-by: Martin Schiller > --- > drivers/net/wan/hdlc_x25.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c > index b28051eba736..434e5263eddf 100644 > --- a/drivers/net/wan/hdlc_x25.c > +++ b/drivers/net/wan/hdlc_x25.c > @@ -72,6 +72,7 @@ static int x25_data_indication(struct net_device *dev, struct sk_buff *skb) > unsigned char *ptr; > > skb_push(skb, 1); > + skb_reset_network_header(skb); > > if (skb_cow(skb, 1)) This skb_cow() here is for the next handler down to have a 1 byte of headroom guaranteed? It'd seem more natural to have skb_cow before the push.. not that it's related to your patch. > return NET_RX_DROP; > @@ -88,6 +89,9 @@ static int x25_data_indication(struct net_device *dev, struct sk_buff *skb) > static void x25_data_transmit(struct net_device *dev, struct sk_buff *skb) > { > hdlc_device *hdlc = dev_to_hdlc(dev); Please insert a new line after the variable declaration since you're touching this one. > + skb_reset_network_header(skb); > + skb->protocol = hdlc_type_trans(skb, dev); > + dev_queue_xmit_nit(skb, dev); > hdlc->xmit(skb, dev); /* Ignore return value :-( */ > } >