diff options
author | 2014-02-28 16:36:19 +0100 | |
---|---|---|
committer | 2014-03-07 09:18:20 +0100 | |
commit | a94bc9c46e8e3e1bb5f707e81fd8c60fd93266e6 (patch) | |
tree | 9a91c5d0cad70cc4d9691f245d2385aaffc5230b /drivers/net/can | |
parent | can: janz-ican3: convert dev_<level> printing to netdev_<level> (diff) | |
download | linux-a94bc9c46e8e3e1bb5f707e81fd8c60fd93266e6.tar.gz linux-a94bc9c46e8e3e1bb5f707e81fd8c60fd93266e6.tar.bz2 linux-a94bc9c46e8e3e1bb5f707e81fd8c60fd93266e6.zip |
can: preserve skbuff protocol in can_put_echo_skb
The skbuff protocol value was formerly fixed/sanitized to ETH_P_CAN in
can_put_echo_skb(). With CAN FD this value has to be preserved.
This patch changes the hard assignment of the protocol value to a check of
valid protocol values for CAN and CAN FD.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/dev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index c0563f183721..e1a37413d53e 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -317,7 +317,9 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, BUG_ON(idx >= priv->echo_skb_max); /* check flag whether this packet has to be looped back */ - if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK) { + if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK || + (skb->protocol != htons(ETH_P_CAN) && + skb->protocol != htons(ETH_P_CANFD))) { kfree_skb(skb); return; } @@ -329,7 +331,6 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, return; /* make settings for echo to reduce code in irq context */ - skb->protocol = htons(ETH_P_CAN); skb->pkt_type = PACKET_BROADCAST; skb->ip_summed = CHECKSUM_UNNECESSARY; skb->dev = dev; |