linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/5] can: preserve skbuff protocol in can_put_echo_skb
@ 2014-02-15 16:32 Oliver Hartkopp
  2014-02-15 16:32 ` [PATCH v3 2/5] can: netlink send bittiming data only when a bitrate is available Oliver Hartkopp
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Oliver Hartkopp @ 2014-02-15 16:32 UTC (permalink / raw)
  To: linux-can; +Cc: Oliver Hartkopp

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>
---
 drivers/net/can/dev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index c0563f1..e1a3741 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;
-- 
1.9.0.rc3


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

end of thread, other threads:[~2014-02-21  8:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-15 16:32 [PATCH v3 1/5] can: preserve skbuff protocol in can_put_echo_skb Oliver Hartkopp
2014-02-15 16:32 ` [PATCH v3 2/5] can: netlink send bittiming data only when a bitrate is available Oliver Hartkopp
2014-02-15 16:32 ` [PATCH v3 3/5] can: provide a separate bittiming_const parameter to bittiming functions Oliver Hartkopp
2014-02-15 16:32 ` [PATCH v3 4/5] can: introduce the data bitrate configuration for CAN FD Oliver Hartkopp
2014-02-21  8:27   ` Stephane Grosjean
2014-02-15 16:32 ` [PATCH v3 5/5] can: allow to change the device mtu for CAN FD capable devices Oliver Hartkopp
2014-02-15 16:59   ` Marc Kleine-Budde
2014-02-15 17:00     ` Marc Kleine-Budde
2014-02-15 17:29     ` Oliver Hartkopp
2014-02-18 11:09       ` Marc Kleine-Budde
2014-02-18 13:08         ` Oliver Hartkopp
2014-02-19 18:25           ` Oliver Hartkopp

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).