All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] can: preserve skbuff protocol in can_put_echo_skb
@ 2014-02-14 20:57 Oliver Hartkopp
  2014-02-14 20:57 ` [PATCH 2/4] can: netlink send bittiming data only when bittiming_const is available Oliver Hartkopp
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Oliver Hartkopp @ 2014-02-14 20:57 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] 7+ messages in thread

end of thread, other threads:[~2014-02-15 10:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-14 20:57 [PATCH 1/4] can: preserve skbuff protocol in can_put_echo_skb Oliver Hartkopp
2014-02-14 20:57 ` [PATCH 2/4] can: netlink send bittiming data only when bittiming_const is available Oliver Hartkopp
2014-02-14 21:26   ` Marc Kleine-Budde
2014-02-15  7:10     ` Oliver Hartkopp
2014-02-15 10:06       ` Marc Kleine-Budde
2014-02-14 20:57 ` [PATCH 3/4] can: provide a separate bittiming_const parameter to bittiming functions Oliver Hartkopp
2014-02-14 20:57 ` [PATCH 4/4] can: introduce a second bitrate for CAN FD data bitrate configuration Oliver Hartkopp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.