[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201031181043.805329-4-xie.he.0141@gmail.com>
Date: Sat, 31 Oct 2020 11:10:41 -0700
From: Xie He <xie.he.0141@...il.com>
To: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Krzysztof Halasa <khc@...waw.pl>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: Xie He <xie.he.0141@...il.com>
Subject: [PATCH net-next v7 3/5] net: hdlc_fr: Do skb_reset_mac_header for skbs received on normal PVC devices
When an skb is received on a normal (non-Ethernet-emulating) PVC device,
call skb_reset_mac_header before we pass it to upper layers.
This is because normal PVC devices don't have header_ops, so any header we
have would not be visible to upper layer code when sending, so the header
shouldn't be visible to upper layer code when receiving, either.
Cc: Krzysztof Halasa <khc@...waw.pl>
Cc: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Signed-off-by: Xie He <xie.he.0141@...il.com>
---
drivers/net/wan/hdlc_fr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 71ee9b60d91b..eb83116aa9df 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -935,6 +935,7 @@ static int fr_rx(struct sk_buff *skb)
skb_pull(skb, 4); /* Remove 4-byte header (hdr, UI, NLPID) */
skb->dev = pvc->main;
skb->protocol = htons(ETH_P_IP);
+ skb_reset_mac_header(skb);
} else if (data[3] == NLPID_IPV6) {
if (!pvc->main)
@@ -942,6 +943,7 @@ static int fr_rx(struct sk_buff *skb)
skb_pull(skb, 4); /* Remove 4-byte header (hdr, UI, NLPID) */
skb->dev = pvc->main;
skb->protocol = htons(ETH_P_IPV6);
+ skb_reset_mac_header(skb);
} else if (skb->len > 10 && data[3] == FR_PAD &&
data[4] == NLPID_SNAP && data[5] == FR_PAD) {
@@ -958,6 +960,7 @@ static int fr_rx(struct sk_buff *skb)
goto rx_drop;
skb->dev = pvc->main;
skb->protocol = htons(pid);
+ skb_reset_mac_header(skb);
break;
case 0x80C20007: /* bridged Ethernet frame */
--
2.27.0
Powered by blists - more mailing lists