Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3338734ybl; Mon, 20 Jan 2020 22:03:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxZRym46l+07+1DMv0JbJsYc87yeSwOTG9Sd4tpbhAtLSe68oq341vcrF0SZcwfm9T/BGAq X-Received: by 2002:a9d:6ac1:: with SMTP id m1mr2360632otq.101.1579586583250; Mon, 20 Jan 2020 22:03:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579586583; cv=none; d=google.com; s=arc-20160816; b=Vdixg2WPMQ6UOLekfkzS49eTwiWyuNOL9drbNkUDUdZckMAgKwzb1C/llndeBgRCtZ aCaboFaBVR366gC8U1CsPcPPYBgFbg6TqjNvqrSlNypUTGhpFCyzQ0LVnZHV57u+O71o GiAd/BbRr7FlgZvqT/VQV8GkMbWIC2oeZ+f+U8NrpVy+lbkyUWGQ2PviTrsGyAQVInlz f0OsGJ1Rtp80+cT3K/42tnzJ7k9DCpSbnh7BkLotGGUpfNROeAiFAJ06AuRhx7enDycI SvPWM5VzHIsfdjdJwN+9XlhlZwzPQ2VcL2P3r6Gb57TM0b2r6AfSwISlkOxV2GxFA/uP 1/8Q== 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:date:subject:cc:to:from; bh=mrUMzeVAWWK90bDFSvJ2H7CyIJ1SQylmMERD/Cwyh1Y=; b=HKqkfXKcstytewlY/4rHjN4V7sX+Pdm4xrzek5+nNzg1jVl5nwkUzef9HEwzyK7848 SXM2Ol5cucWLUk8QUMWgpoGY0FONTCUcdpyV/MG9ZuWWUZAFZVJoU1ykwRmf6bRpAZ2m W1NMJxEwh2hTopSAUw8YdYF2W6PD6JDn2J12TkRT0Lt4t5a5A1MOT/GUy51O6Juc5Eac mC9Jw0DZfQxQnEYvAl8pMjjrfOnWRBkWI+esv/O4l2Wd0ZxnKYbbnhc63VdE3Sm5aHfF Xvw0sl3hGzA+hoPJ8hYEDzdkzebkEU43lEZCMjQ6RU8cJ/3P//44s9mi/BqlWPDuko9A 8Cyw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x207si18462737oif.30.2020.01.20.22.02.51; Mon, 20 Jan 2020 22:03:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728779AbgAUGAv (ORCPT + 99 others); Tue, 21 Jan 2020 01:00:51 -0500 Received: from host-88-217-225-28.customer.m-online.net ([88.217.225.28]:5778 "EHLO mail.dev.tdt.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725789AbgAUGAu (ORCPT ); Tue, 21 Jan 2020 01:00:50 -0500 Received: from mschiller01.dev.tdt.de (unknown [10.2.3.20]) by mail.dev.tdt.de (Postfix) with ESMTPSA id D5E7521141; Tue, 21 Jan 2020 06:00:48 +0000 (UTC) From: Martin Schiller To: kubakici@wp.pl, khc@pm.waw.pl, davem@davemloft.net Cc: linux-x25@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Schiller Subject: [PATCH v4 2/2] wan/hdlc_x25: fix skb handling Date: Tue, 21 Jan 2020 07:00:34 +0100 Message-Id: <20200121060034.30554-2-ms@dev.tdt.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200121060034.30554-1-ms@dev.tdt.de> References: <20200121060034.30554-1-ms@dev.tdt.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Additionally call skb_reset_network_header() after each skb_push() / skb_pull(). Signed-off-by: Martin Schiller --- drivers/net/wan/hdlc_x25.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c index 688233c2e1ea..63c9aeed9a34 100644 --- a/drivers/net/wan/hdlc_x25.c +++ b/drivers/net/wan/hdlc_x25.c @@ -71,11 +71,12 @@ static int x25_data_indication(struct net_device *dev, struct sk_buff *skb) { unsigned char *ptr; - skb_push(skb, 1); - if (skb_cow(skb, 1)) return NET_RX_DROP; + skb_push(skb, 1); + skb_reset_network_header(skb); + ptr = skb->data; *ptr = X25_IFACE_DATA; @@ -88,6 +89,13 @@ 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); + + skb_reset_network_header(skb); + skb->protocol = hdlc_type_trans(skb, dev); + + if (dev_nit_active(dev)) + dev_queue_xmit_nit(skb, dev); + hdlc->xmit(skb, dev); /* Ignore return value :-( */ } @@ -102,6 +110,7 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) switch (skb->data[0]) { case X25_IFACE_DATA: /* Data to be transmitted */ skb_pull(skb, 1); + skb_reset_network_header(skb); if ((result = lapb_data_request(dev, skb)) != LAPB_OK) dev_kfree_skb(skb); return NETDEV_TX_OK; -- 2.20.1