linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] drivers/net/wan/lapbether: Set network_header before transmitting
@ 2020-08-26  3:03 Xie He
  2020-08-26 22:51 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Xie He @ 2020-08-26  3:03 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, netdev, linux-kernel, linux-x25
  Cc: Xie He, Martin Schiller

Set the skb's network_header before it is passed to the underlying
Ethernet device for transmission.

This patch fixes the following issue:

When we use this driver with AF_PACKET sockets, there would be error
messages of:
   protocol 0805 is buggy, dev (Ethernet interface name)
printed in the system "dmesg" log.

This is because skbs passed down to the Ethernet device for transmission
don't have their network_header properly set, and the dev_queue_xmit_nit
function in net/core/dev.c complains about this.

Reason of setting the network_header to this place (at the end of the
Ethernet header, and at the beginning of the Ethernet payload):

Because when this driver receives an skb from the Ethernet device, the
network_header is also set at this place.

Cc: Martin Schiller <ms@dev.tdt.de>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
---
 drivers/net/wan/lapbether.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index cc297ea9c6ec..e61616b0b91c 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -210,6 +210,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb)
 
 	skb->dev = dev = lapbeth->ethdev;
 
+	skb_reset_network_header(skb);
+
 	dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0);
 
 	dev_queue_xmit(skb);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] drivers/net/wan/lapbether: Set network_header before transmitting
  2020-08-26  3:03 [PATCH net] drivers/net/wan/lapbether: Set network_header before transmitting Xie He
@ 2020-08-26 22:51 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-26 22:51 UTC (permalink / raw)
  To: xie.he.0141; +Cc: kuba, netdev, linux-kernel, linux-x25, ms

From: Xie He <xie.he.0141@gmail.com>
Date: Tue, 25 Aug 2020 20:03:53 -0700

> Set the skb's network_header before it is passed to the underlying
> Ethernet device for transmission.
> 
> This patch fixes the following issue:
> 
> When we use this driver with AF_PACKET sockets, there would be error
> messages of:
>    protocol 0805 is buggy, dev (Ethernet interface name)
> printed in the system "dmesg" log.
> 
> This is because skbs passed down to the Ethernet device for transmission
> don't have their network_header properly set, and the dev_queue_xmit_nit
> function in net/core/dev.c complains about this.
> 
> Reason of setting the network_header to this place (at the end of the
> Ethernet header, and at the beginning of the Ethernet payload):
> 
> Because when this driver receives an skb from the Ethernet device, the
> network_header is also set at this place.
> 
> Cc: Martin Schiller <ms@dev.tdt.de>
> Signed-off-by: Xie He <xie.he.0141@gmail.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-26 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26  3:03 [PATCH net] drivers/net/wan/lapbether: Set network_header before transmitting Xie He
2020-08-26 22:51 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).